Proper fix for screen freeze

If an X event is received at a very specific point in time, it can trigger
a race condition in Xlib. Said event will be read, but Xlib will
nonetheless be completely unaware of the event.

This cause compton to sometimes block on select() while there are events
ready to be processed. If the event is a damage report, screen freeze
will happen until some other event is received.

The proper fix is to switch to xcb for event handling, thus avoid this
problem entirely.
This commit is contained in:
Yuxuan Shui
2018-09-22 23:44:44 +01:00
parent 43f3744fea
commit 7af815a0aa
4 changed files with 79 additions and 119 deletions

View File

@ -78,6 +78,7 @@
#include <ctype.h>
#include <sys/time.h>
#include <X11/Xlib-xcb.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xatom.h>
@ -1071,7 +1072,7 @@ struct win {
/// when the window is unmapped.
bool need_configure;
/// Queued <code>ConfigureNotify</code> when the window is unmapped.
XConfigureEvent queue_configure;
xcb_configure_notify_event_t queue_configure;
/// Region to be ignored when painting. Basically the region where
/// higher opaque windows will paint upon. Depends on window frame
/// opacity state, window geometry, window mapped/unmapped state,