focus events question

Uli Schlachter psychon at znc.in
Tue Feb 11 16:14:44 UTC 2025


Hi,

Am 09.02.25 um 20:04 schrieb Steven J Abner:
[...]
> I remembered that on one window 
> manager the use of the combo leave/focus/enter for a focus in event. 
> That window manager only passed on the leave of the combo the mode 
> member of XCB_NOTIFY_MODE_GRAB.
[...]
> but was wondering 
> under what condition this is used.

Sorry, but I am not quite sure what you are asking for. So here is some 
documentation on X11 focus events:

https://www.x.org/releases/X11R7.7/doc/xproto/x11protocol.html#events:input_focus

You are asking for when the "mode" is set to "grab". The above link says:

 > Events generated when a keyboard grab activates have mode Grab,

So, I guess this means the window manager used a GrabButton or 
GrabKeyboard request with a grab-window other than the window that is 
currently focused. At the end of the above "Input focus events" 
documentation, it says:

 > When a keyboard grab activates (but before generating any actual
 > KeyPress event that activates the grab), G is the grab-window for the
 > grab, and F is the current focus:
 >
 > - FocusIn and FocusOut events with mode Grab are generated (as for
 >   Normal above) as if the focus were to change from F to G.

These seem to be the focus change events you are seeing.

Random guess would be a grab on the root window. When that grab 
activates, focus shifts to the root window and you get the above events. 
The window manager could then set the input focus while that grab is 
active and the mode=Ungrab FocusIn event would then be sent to the newly 
focused window when the grab deactivates? Dunno, just a guess.

Also: I doubt a lot that Xlib and XCB behave differently here. Both just 
give you the events that the X11 server generates.

Cheers,
Uli
-- 
If you have to type the letters "A-E-S" into your source code, you're 
doing it wrong.


More information about the Xcb mailing list