From 1aa90f646652b0571ad628c9374fb8e9e4bcd99f Mon Sep 17 00:00:00 2001 From: Maxim Solovyov Date: Wed, 14 Feb 2024 20:30:39 +0300 Subject: [PATCH] x: remove x_sync and use xcb_aux_sync instead --- src/picom.c | 9 +++++---- src/render.c | 7 ++++--- src/x.h | 11 ----------- 3 files changed, 9 insertions(+), 18 deletions(-) diff --git a/src/picom.c b/src/picom.c index 841c6f32..c2cac46a 100644 --- a/src/picom.c +++ b/src/picom.c @@ -35,6 +35,7 @@ #include #include #include +#include #include #include @@ -1501,7 +1502,7 @@ static bool redirect_start(session_t *ps) { return false; } - x_sync(&ps->c); + xcb_aux_sync(ps->c.c); if (!initialize_backend(ps)) { return false; @@ -1560,7 +1561,7 @@ static bool redirect_start(session_t *ps) { } // Must call XSync() here - x_sync(&ps->c); + xcb_aux_sync(ps->c.c); ps->redirected = true; ps->first_frame = true; @@ -1603,7 +1604,7 @@ static void unredirect(session_t *ps) { } // Must call XSync() here - x_sync(&ps->c); + xcb_aux_sync(ps->c.c); ps->redirected = false; log_debug("Screen unredirected."); @@ -2789,7 +2790,7 @@ static void session_destroy(session_t *ps) { #endif // Flush all events - x_sync(&ps->c); + xcb_aux_sync(ps->c.c); ev_io_stop(ps->loop, &ps->xiow); if (ps->o.legacy_backends) { free_conv((conv *)ps->shadow_context); diff --git a/src/render.c b/src/render.c index 371a9be7..9712974c 100644 --- a/src/render.c +++ b/src/render.c @@ -6,6 +6,7 @@ #include #include #include +#include #include #include @@ -1229,7 +1230,7 @@ void paint_all(session_t *ps, struct managed_win *t) { if (ps->o.vsync) { // Make sure all previous requests are processed to achieve best // effect - x_sync(&ps->c); + xcb_aux_sync(ps->c.c); #ifdef CONFIG_OPENGL if (glx_has_context(ps)) { if (ps->o.vsync_use_glfinish) { @@ -1288,7 +1289,7 @@ void paint_all(session_t *ps, struct managed_win *t) { break; #ifdef CONFIG_OPENGL case BKEND_XR_GLX_HYBRID: - x_sync(&ps->c); + xcb_aux_sync(ps->c.c); if (ps->o.vsync_use_glfinish) { glFinish(); } else { @@ -1313,7 +1314,7 @@ void paint_all(session_t *ps, struct managed_win *t) { default: assert(0); } - x_sync(&ps->c); + xcb_aux_sync(ps->c.c); #ifdef CONFIG_OPENGL if (glx_has_context(ps)) { diff --git a/src/x.h b/src/x.h index 898c5f52..3f1ecff8 100644 --- a/src/x.h +++ b/src/x.h @@ -207,17 +207,6 @@ void x_discard_pending(struct x_connection *c, uint32_t sequence); /// This function logs X errors, or aborts the program based on severity of the error. void x_handle_error(struct x_connection *c, xcb_generic_error_t *ev); -/** - * Send a request to X server and get the reply to make sure all previous - * requests are processed, and their replies received - * - * xcb_get_input_focus is used here because it is the same request used by - * libX11 - */ -static inline void x_sync(struct x_connection *c) { - free(xcb_get_input_focus_reply(c->c, xcb_get_input_focus(c->c), NULL)); -} - /** * Get a specific attribute of a window. *