[Xcb] Mouse pointer and window focusing

Michael Stapelberg michael+xcb at stapelberg.de
Sun Sep 18 06:46:52 PDT 2011


Hi Viet,

Excerpts from Viet Nguyen's message of 2011-09-17 05:06:37 +0100:
> I am writing a tiling window manager based on XCB (just for studying).
Quite a big task just out of interest :).

> Currently, my only problem is when I change focus by keyboard, I have
> to move the mouse pointer to that window too.
I can assure you that this is not necessary when you handle all events
correctly :).

> I do not know why focus in happened before key press, it seems the
> window under the mouse pointer is automatically focused. How can I
> disable this behaviour?
In general, you cannot disable X11 behaviour - you can only change your
EventMasks and handle events in a different way.

I would recommend you to take a look at the source code of i3 or awesome, both
are tiling window managers using XCB.

For i3, the appropriate places to look are the FocusIn handler:
http://code.stapelberg.de/git/i3/tree/src/handlers.c#n883
and maybe also the part where the internal state is transferred to X11:
http://code.stapelberg.de/git/i3/tree/src/x.c#n507

Best regards,
Michael


More information about the Xcb mailing list