From 9bb332754997a0acdcbab51d81fa93c5054a563d Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Thu, 4 Oct 2018 09:36:48 +0200 Subject: [PATCH] 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 --- src/compton.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/compton.c b/src/compton.c index 342cb2d8..ab8fbdd9 100644 --- a/src/compton.c +++ b/src/compton.c @@ -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); + } } /**