x: remove x_sync and use xcb_aux_sync instead

This commit is contained in:
Maxim Solovyov 2024-02-14 20:30:39 +03:00
parent b0dfcf4a32
commit 1aa90f6466
No known key found for this signature in database
3 changed files with 9 additions and 18 deletions

View File

@ -35,6 +35,7 @@
#include <xcb/randr.h>
#include <xcb/render.h>
#include <xcb/sync.h>
#include <xcb/xcb_aux.h>
#include <xcb/xfixes.h>
#include <ev.h>
@ -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);

View File

@ -6,6 +6,7 @@
#include <xcb/composite.h>
#include <xcb/render.h>
#include <xcb/sync.h>
#include <xcb/xcb_aux.h>
#include <xcb/xcb_image.h>
#include <xcb/xcb_renderutil.h>
@ -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)) {

11
src/x.h
View File

@ -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.
*