]> git.eshelyaron.com Git - emacs.git/commitdiff
Really fix extended frame synchronization
authorPo Lu <luangruo@yahoo.com>
Mon, 7 Feb 2022 06:58:32 +0000 (14:58 +0800)
committerPo Lu <luangruo@yahoo.com>
Mon, 7 Feb 2022 06:59:06 +0000 (14:59 +0800)
* src/xterm.c (XTframe_up_to_date): Make sure the extended
counter ends up even.

src/xterm.c

index d3d8dc468cd26039edd2f06bc510dd1883947489..49fc2b1bb7422b735a817b6e582b319e96622aa1 100644 (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 ();