]> git.eshelyaron.com Git - emacs.git/commitdiff
Further reduce monitor change event duplication
authorPo Lu <luangruo@yahoo.com>
Tue, 2 Aug 2022 07:15:03 +0000 (15:15 +0800)
committerPo Lu <luangruo@yahoo.com>
Tue, 2 Aug 2022 07:17:11 +0000 (15:17 +0800)
* src/xterm.c (handle_one_xevent): Also don't store duplicate
events for ConfigureNotify events bound for the root window.

src/xterm.c

index 017e63d8b6b429d5b392ee5bd484c4bc2c87dd36..52d08e76a724f91893cb177847e8a3c4cd078558 100644 (file)
@@ -16499,8 +16499,6 @@ x_wait_for_cell_change (Lisp_Object cell, struct timespec timeout)
     }
 }
 
-#if defined USE_GTK || defined HAVE_XRANDR
-
 /* Find whether or not an undelivered MONITORS_CHANGED_EVENT is
    already on the event queue.  DPYINFO is the display any such event
    must apply to.  */
@@ -16524,8 +16522,6 @@ x_find_monitors_changed_event (struct x_display_info *dpyinfo)
   return false;
 }
 
-#endif
-
 #ifdef USE_GTK
 static void
 x_monitors_changed_cb (GdkScreen *gscr, gpointer user_data)
@@ -18914,13 +18910,20 @@ handle_one_xevent (struct x_display_info *dpyinfo,
          if (configureEvent.xconfigure.width != dpyinfo->screen_width
              || configureEvent.xconfigure.height != dpyinfo->screen_height)
            {
-             inev.ie.kind = MONITORS_CHANGED_EVENT;
-             XSETTERMINAL (inev.ie.arg, dpyinfo->terminal);
+             /* Also avoid storing duplicate events here, since
+                Fx_display_monitor_attributes_list will return the
+                same information for both invocations of the
+                hook.  */
+             if (!x_find_monitors_changed_event (dpyinfo))
+               {
+                 inev.ie.kind = MONITORS_CHANGED_EVENT;
+                 XSETTERMINAL (inev.ie.arg, dpyinfo->terminal);
 
-             /* Store this event now since inev.ie.type could be set to
-                MOVE_FRAME_EVENT later.  */
-             kbd_buffer_store_event (&inev.ie);
-             inev.ie.kind = NO_EVENT;
+                 /* Store this event now since inev.ie.type could be set to
+                    MOVE_FRAME_EVENT later.  */
+                 kbd_buffer_store_event (&inev.ie);
+                 inev.ie.kind = NO_EVENT;
+               }
 
              /* Also update the position of the drag-and-drop
                 tooltip.  */