From 8cad97e3db879e21663aea5da6138618f4901154 Mon Sep 17 00:00:00 2001 From: Po Lu Date: Fri, 26 Aug 2022 09:42:35 +0800 Subject: [PATCH] Restore old code in x_sync_trigger_fence * src/xterm.c (x_sync_trigger_fence): Restore old code, since that makes it easier to adapt to more than 2 sync fences (which might be necessary in the future, if we ever decide to do frame handling asynchronously), and is much more recognizable for people coming from other programs. --- src/xterm.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/xterm.c b/src/xterm.c index 5a36aa03029..b91d3a95173 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -6905,16 +6905,22 @@ x_sync_update_begin (struct frame *f) static void x_sync_trigger_fence (struct frame *f, XSyncValue value) { + uint_fast64_t n, low, high, idx; + /* Sync fences aren't supported by the X server. */ if (FRAME_DISPLAY_INFO (f)->xsync_major < 3 || (FRAME_DISPLAY_INFO (f)->xsync_major == 3 && FRAME_DISPLAY_INFO (f)->xsync_minor < 1)) return; - bool idx = !! (XSyncValueLow32 (value) & 4); + low = XSyncValueLow32 (value); + high = XSyncValueHigh32 (value); + + n = low | (high << 32); + idx = (n / 4) % 2; #ifdef FRAME_DEBUG - fprintf (stderr, "Triggering synchronization fence: %d\n", idx); + fprintf (stderr, "Triggering synchronization fence: %lu\n", idx); #endif XSyncTriggerFence (FRAME_X_DISPLAY (f), -- 2.39.2