使用xlib捕获按键事件

发布于 2024-10-04 20:58:30 字数 157 浏览 0 评论 0原文

在尝试捕获 F1 时,出现了一个问题,我无法捕获它,因为系统挂钩正在执行,在我的程序之前显示“帮助”内容, 有人可以帮助我吗? 有什么方法可以在系统挂钩之前执行我的挂钩。 在 Linux 中,当 Xserver 执行一个钩子时,它不会在同一按键按下事件上执行下一个钩子。
任何帮助将不胜感激。

while trying to capture the F1, there is a problem, i can't capture it, because the system hook was execute showing the "help" content before my program,
could anyone help me?
Is there any ways to execute my hook before the system hook.
In Linux, when an Xserver executed an hook, it won't execute the next hook on the same-key press event.
Any helps would be preciate.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

淤浪 2024-10-11 20:58:30

X 中没有“系统挂钩”,只有在您的程序之前启动并已经获取密钥的程序(在本例中,可能是窗口管理器)。如果这仅供您使用,请更改其他程序的配置。如果这是您为其他人制作的程序,则无论如何您都需要使您的按键可配置,因为您永远不知道用户使用什么按键
已经分配给其他应用程序使用,如果您尝试强制对它们进行键绑定,它们更有可能放弃您的应用程序。

There is no “system hook” in X, just programs that started before yours and already grabbed the key (in this case, probably the window manager). If this is just for your use, change the configuration of the other program. If this is a program you're making for others, you'll need to make your keys configurable anyway, since you never know what keys the users
have already assigned to other applications to use, and they're more likely to discard your app if you try to force your keybindings on them.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文