Skip FocusIn events with mode == NOTIFY_MODE_GRAB or NOTIFY_MODE_UNGRAB

According to the Xlib Programming Manual section 10.7.2 [1], these events are
generated when keyboard grabs activate/deactivate, while we are only interested
in focus changes which are done by other programs independend from the
keyboard.

[1] http://tronche.com/gui/x/xlib/events/input-focus/grab.html
This commit is contained in:
Michael Stapelberg 2011-03-30 23:00:48 +02:00
parent 4fd4e619ec
commit 20b1fd4293
1 changed files with 6 additions and 0 deletions

View File

@ -896,6 +896,12 @@ static int handle_focus_in(xcb_focus_in_event_t *event) {
return 1; return 1;
DLOG("That is con %p / %s\n", con, con->name); DLOG("That is con %p / %s\n", con, con->name);
if (event->mode == XCB_NOTIFY_MODE_GRAB ||
event->mode == XCB_NOTIFY_MODE_UNGRAB) {
DLOG("FocusIn event for grab/ungrab, ignoring\n");
return 1;
}
if (event->detail == XCB_NOTIFY_DETAIL_POINTER) { if (event->detail == XCB_NOTIFY_DETAIL_POINTER) {
DLOG("notify detail is pointer, ignoring this event\n"); DLOG("notify detail is pointer, ignoring this event\n");
return 1; return 1;