aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPo Lu2022-07-30 10:04:26 +0800
committerPo Lu2022-07-30 10:04:26 +0800
commita1975a69b24f01c0ab6a039f0e2f6bde6b2bf741 (patch)
tree7cb4e2592ff9de00a211222616bab9e03b40d245 /src
parentaf152ffab15174838f11075248353ce66ace1635 (diff)
downloademacs-a1975a69b24f01c0ab6a039f0e2f6bde6b2bf741.tar.gz
emacs-a1975a69b24f01c0ab6a039f0e2f6bde6b2bf741.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/xterm.c14
1 files 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)
6736 x_sync_wait_for_frame_drawn_event (f); 6736 x_sync_wait_for_frame_drawn_event (f);
6737 6737
6738 /* Since Emacs needs a non-urgent redraw, ensure that value % 4 == 6738 /* Since Emacs needs a non-urgent redraw, ensure that value % 4 ==
6739 0. */ 6739 1. Later, add 3 to create the even counter value. */
6740 if (XSyncValueLow32 (value) % 4 == 2) 6740 if (XSyncValueLow32 (value) % 4 == 2)
6741 XSyncIntToValue (&add, 3); 6741 XSyncIntToValue (&add, 3);
6742 else 6742 else
@@ -6748,7 +6748,7 @@ x_sync_update_begin (struct frame *f)
6748 if (overflow) 6748 if (overflow)
6749 XSyncIntToValue (&FRAME_X_COUNTER_VALUE (f), 3); 6749 XSyncIntToValue (&FRAME_X_COUNTER_VALUE (f), 3);
6750 6750
6751 eassert (XSyncValueLow32 (FRAME_X_COUNTER_VALUE (f)) % 4 != 1); 6751 eassert (XSyncValueLow32 (FRAME_X_COUNTER_VALUE (f)) % 4 == 1);
6752 6752
6753 XSyncSetCounter (FRAME_X_DISPLAY (f), 6753 XSyncSetCounter (FRAME_X_DISPLAY (f),
6754 FRAME_X_EXTENDED_COUNTER (f), 6754 FRAME_X_EXTENDED_COUNTER (f),
@@ -6772,7 +6772,15 @@ x_sync_update_finish (struct frame *f)
6772 if (!(XSyncValueLow32 (value) % 2)) 6772 if (!(XSyncValueLow32 (value) % 2))
6773 return; 6773 return;
6774 6774
6775 XSyncIntToValue (&add, 1); 6775 if ((XSyncValueLow32 (value) % 4) == 1)
6776 /* This means the frame is non-urgent and should be drawn at the
6777 next redraw point. */
6778 XSyncIntToValue (&add, 3);
6779 else
6780 /* Otherwise, the frame is urgent and should be drawn as soon as
6781 possible. */
6782 XSyncIntToValue (&add, 1);
6783
6776 XSyncValueAdd (&FRAME_X_COUNTER_VALUE (f), 6784 XSyncValueAdd (&FRAME_X_COUNTER_VALUE (f),
6777 value, add, &overflow); 6785 value, add, &overflow);
6778 6786