emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master a1975a69b2: Fix failure caused by misreading the frame synchroniz


From: Po Lu
Subject: master a1975a69b2: Fix failure caused by misreading the frame synchronization spec
Date: Fri, 29 Jul 2022 22:04:38 -0400 (EDT)

branch: master
commit a1975a69b24f01c0ab6a039f0e2f6bde6b2bf741
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>

    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 9f8afa61cf..dc9637d35c 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);
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]