diff --git a/src/picom.c b/src/picom.c index 74fb2a9..fedcf55 100644 --- a/src/picom.c +++ b/src/picom.c @@ -1205,7 +1205,13 @@ static bool redirect_start(session_t *ps) { xcb_map_window(ps->c, ps->overlay); } - xcb_composite_redirect_subwindows(ps->c, ps->root, session_redirection_mode(ps)); + bool success = XCB_AWAIT_VOID(xcb_composite_redirect_subwindows, ps->c, ps->root, + session_redirection_mode(ps)); + if (!success) { + log_fatal("Another composite manager is already running " + "(and does not handle _NET_WM_CM_Sn correctly)"); + return false; + } x_sync(ps->c); diff --git a/src/x.c b/src/x.c index fe162d2..4d1f43c 100644 --- a/src/x.c +++ b/src/x.c @@ -334,12 +334,6 @@ void x_print_error(unsigned long serial, uint8_t major, uint16_t minor, uint8_t int o = 0; const char *name = "Unknown"; - if (major == ps->composite_opcode && minor == XCB_COMPOSITE_REDIRECT_SUBWINDOWS) { - log_fatal("Another composite manager is already running " - "(and does not handle _NET_WM_CM_Sn correctly)"); - exit(1); - } - #define CASESTRRET2(s) \ case s: name = #s; break diff --git a/src/x.h b/src/x.h index e98b211..8238b7c 100644 --- a/src/x.h +++ b/src/x.h @@ -50,27 +50,27 @@ struct xvisual_info { #define XCB_AWAIT_VOID(func, c, ...) \ ({ \ - bool success = true; \ - __auto_type e = xcb_request_check(c, func##_checked(c, __VA_ARGS__)); \ - if (e) { \ - x_print_error(e->sequence, e->major_code, e->minor_code, \ - e->error_code); \ - free(e); \ - success = false; \ + bool __success = true; \ + __auto_type __e = xcb_request_check(c, func##_checked(c, __VA_ARGS__)); \ + if (__e) { \ + x_print_error(__e->sequence, __e->major_code, __e->minor_code, \ + __e->error_code); \ + free(__e); \ + __success = false; \ } \ - success; \ + __success; \ }) #define XCB_AWAIT(func, c, ...) \ ({ \ - xcb_generic_error_t *e = NULL; \ - __auto_type r = func##_reply(c, func(c, __VA_ARGS__), &e); \ - if (e) { \ - x_print_error(e->sequence, e->major_code, e->minor_code, \ - e->error_code); \ - free(e); \ + xcb_generic_error_t *__e = NULL; \ + __auto_type __r = func##_reply(c, func(c, __VA_ARGS__), &__e); \ + if (__e) { \ + x_print_error(__e->sequence, __e->major_code, __e->minor_code, \ + __e->error_code); \ + free(__e); \ } \ - r; \ + __r; \ }) /// Wraps x_new_id. abort the program if x_new_id returns error