From 61a5bbc6836337479f5d8dba1897380b1c63bc25 Mon Sep 17 00:00:00 2001 From: Po Lu Date: Mon, 7 Feb 2022 14:58:32 +0800 Subject: [PATCH] Really fix extended frame synchronization * src/xterm.c (XTframe_up_to_date): Make sure the extended counter ends up even. --- src/xterm.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/xterm.c b/src/xterm.c index d3d8dc468cd..49fc2b1bb74 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -1848,6 +1848,12 @@ x_update_end (struct frame *f) static void XTframe_up_to_date (struct frame *f) { +#ifdef HAVE_XSYNC + XSyncValue add; + XSyncValue current; + Bool overflow_p; +#endif + eassert (FRAME_X_P (f)); block_input (); FRAME_MOUSE_UPDATE (f); @@ -1867,12 +1873,15 @@ XTframe_up_to_date (struct frame *f) if (FRAME_X_OUTPUT (f)->ext_sync_end_pending_p && FRAME_X_EXTENDED_COUNTER (f) != None) { - XSyncValue add; - Bool overflow_p; + current = FRAME_X_OUTPUT (f)->current_extended_counter_value; + + if (XSyncValueLow32 (current) % 2) + XSyncIntToValue (&add, 1); + else + XSyncIntToValue (&add, 2); - XSyncIntToValue (&add, 1); XSyncValueAdd (&FRAME_X_OUTPUT (f)->current_extended_counter_value, - add, add, &overflow_p); + current, add, &overflow_p); if (overflow_p) emacs_abort (); -- 2.39.5