Die when the X11 connection breaks

With libX11, the library calls an I/O error handler if the connection to
the server breaks. The default I/O error handler prints an error message
and calls exit(). This can be seen when running a "pre-xcb" compton
against Xephyr and then closing the Xephyr window:

XIO:  fatal IO error 11 (Resource temporarily unavailable) on X server ":1"
      after 241 requests (241 known processed) with 0 events remaining.

The current compton would just continue running. After this commit, it
instead exits with this message:

handle_queued_x_events(): X11 server connection broke (error 1)

Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Uli Schlachter 2018-10-04 09:36:48 +02:00 committed by Yuxuan Shui
parent 1c1adc96c8
commit 9bb3327549
1 changed files with 5 additions and 0 deletions

View File

@ -4682,6 +4682,11 @@ handle_queued_x_events(EV_P_ ev_prepare *w, int revents) {
};
XFlush(ps->dpy);
xcb_flush(ps->c);
int err = xcb_connection_has_error(ps->c);
if (err) {
printf_errfq(1, "(): X11 server connection broke (error %d)", err);
}
}
/**