From a1975a69b24f01c0ab6a039f0e2f6bde6b2bf741 Mon Sep 17 00:00:00 2001 From: Po Lu Date: Sat, 30 Jul 2022 10:04:26 +0800 Subject: [PATCH] Fix failure caused by misreading the frame synchronization spec * src/xterm.c (x_sync_update_begin): Ensure value % 4 is 1. (x_sync_update_finish): Then, add 3. --- src/xterm.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/xterm.c b/src/xterm.c index 9f8afa61cf1..dc9637d35c7 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -6736,7 +6736,7 @@ x_sync_update_begin (struct frame *f) x_sync_wait_for_frame_drawn_event (f); /* Since Emacs needs a non-urgent redraw, ensure that value % 4 == - 0. */ + 1. Later, add 3 to create the even counter value. */ if (XSyncValueLow32 (value) % 4 == 2) XSyncIntToValue (&add, 3); else @@ -6748,7 +6748,7 @@ x_sync_update_begin (struct frame *f) if (overflow) XSyncIntToValue (&FRAME_X_COUNTER_VALUE (f), 3); - eassert (XSyncValueLow32 (FRAME_X_COUNTER_VALUE (f)) % 4 != 1); + eassert (XSyncValueLow32 (FRAME_X_COUNTER_VALUE (f)) % 4 == 1); XSyncSetCounter (FRAME_X_DISPLAY (f), FRAME_X_EXTENDED_COUNTER (f), @@ -6772,7 +6772,15 @@ x_sync_update_finish (struct frame *f) if (!(XSyncValueLow32 (value) % 2)) return; - XSyncIntToValue (&add, 1); + if ((XSyncValueLow32 (value) % 4) == 1) + /* This means the frame is non-urgent and should be drawn at the + next redraw point. */ + XSyncIntToValue (&add, 3); + else + /* Otherwise, the frame is urgent and should be drawn as soon as + possible. */ + XSyncIntToValue (&add, 1); + XSyncValueAdd (&FRAME_X_COUNTER_VALUE (f), value, add, &overflow); -- 2.39.5