Really fix extended frame synchronization

* src/xterm.c (XTframe_up_to_date): Make sure the extended
counter ends up even.
This commit is contained in:
Po Lu 2022-02-07 14:58:32 +08:00
parent f91a911ef3
commit 61a5bbc683

View file

@ -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 ();