awesome/objects
Uli Schlachter 19094de661 Speed up client_ignore_enterleave_events()
There are some situations where we do things that can make the mouse pointer
enter another window. We do not want to react to these "self inflicted" mouse
enter and leave events, because they aren't "real" (= generated by the user).

Before this commit, this is done by going through all windows and toggling the
"please send us enter and leave events"-bit on them. This becomes slower when
many windows are visible and floods the server with requests.

This commit changes this to a constant-time logic. Each event contains the
sequence number of the last request that the X11 server handled. Thus, we just
remember the right sequence numbers and ignore any events that comes in whose
sequence number falls into the ignored range.

In detail, we keep a list of "begin" and "end" sequence numbers and ignore any
enter and leave events that fall in this range. If we get any event with a
sequence number higher than "end", we remove this pair from the list, since it
is no longer needed.

To generate these pairs, we use a GrabServer request in
client_ignore_enterleave_events(). This gives us a sequence number and makes
sure that nothing else besides us can cause events. The server is ours! In
client_restore_enterleave_events(), we first do a NoOperation request to
generate the sequence number for the end of the pair and then do UngrabServer.
Any event that is generated after UngrabServer will have at least the sequence
number of the UngrabServer request and thus no longer fails between begin and
end.

Fixes: https://github.com/awesomeWM/awesome/issues/1107
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-09-30 09:37:55 +02:00
..
button.c C: Remove unneeded calls to signal_add() 2016-06-04 17:57:08 +02:00
button.h Clean up header includes 2014-03-30 20:07:48 +02:00
client.c Speed up client_ignore_enterleave_events() 2016-09-30 09:37:55 +02:00
client.h Only configure client geometries once per main loop iteration 2016-09-15 18:48:56 +02:00
drawable.c C: Remove unneeded calls to signal_add() 2016-06-04 17:57:08 +02:00
drawable.h drawable/drawin: Pass both lua_State and stack index around 2014-12-06 10:46:45 +01:00
drawin.c drawin_map: Ignore enter/leave after apply_moveresize 2016-09-30 09:37:55 +02:00
drawin.h drawin: lazily configure drawin windows 2015-08-23 15:25:23 +02:00
key.c C: Remove unneeded calls to signal_add() 2016-06-04 17:57:08 +02:00
key.h remove encoding=utf-8 from modelines 2011-09-11 17:34:09 +02:00
screen.c Fix a bug moving between a tiled and a floating screen. 2016-09-02 20:15:00 +01:00
screen.h Fix a bug moving between a tiled and a floating screen. 2016-09-02 20:15:00 +01:00
tag.c C: Remove unneeded calls to signal_add() 2016-06-04 17:57:08 +02:00
tag.h Attempt at better handling of NET_CURRENT_DESKTOP property. 2016-06-04 16:42:54 +03:00
window.c C: Remove unneeded calls to signal_add() 2016-06-04 17:57:08 +02:00
window.h geometry: Use the relevant rounding functions instead of integers 2016-04-18 04:20:22 -04:00