c - 应用程序失去焦点时的 X11 事件

标签 c linux x11 xorg xcb

有没有类似Windows的XAppFocusOut事件WM_ACTIVATEAPP 或 OSX 的 applicationDidResignActive或其他方式在应用程序失去焦点时收到通知?首选 XCB 解决方案。

澄清一下:我对应用(而不是窗口)失去焦点时的事件感兴趣。

谢谢。

最佳答案

您想要FocusOut X event .

The X server can report FocusIn or FocusOut events to clients wanting information about when the input focus changes. The keyboard is always attached to some window (typically, the root window or a top-level window), which is called the focus window. The focus window and the position of the pointer determine the window that receives keyboard input. Clients may need to know when the input focus changes to control highlighting of areas on the screen.

To receive FocusIn or FocusOut events, set the FocusChangeMask bit in the event-mask attribute of the window.

关于c - 应用程序失去焦点时的 X11 事件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31438020/

相关文章:

ubuntu - 客户端服务器 GUI 资源

c++ - 如何从原始数据 C++ 在 X11 中创建游标

C - 带信号量的多个 fork

c - 我将如何使用 strchr 替换此示例中的字符?

c - 新数据类型( vector )的 printf 实现

linux - 有没有办法提取 Artifactory 的存储摘要?

linux - 在 Ubuntu 64 位上设置计算机时间后,计时器(使用 boost chrono steady_clock)到期

linux - 为什么 trickle 实用程序不影响我的动态链接 golang 程序?

macos - 使用 iTerm2 作为 X11 终端(用于字体、主题等)?

c - 将 Shellcode 输出定向到文件 - C