emacs-diffs
[Top][All Lists]
Advanced

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

master 0b233d3e5f: Further reduce monitor change event duplication


From: Po Lu
Subject: master 0b233d3e5f: Further reduce monitor change event duplication
Date: Tue, 2 Aug 2022 03:17:22 -0400 (EDT)

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

    Further reduce monitor change event duplication
    
    * src/xterm.c (handle_one_xevent): Also don't store duplicate
    events for ConfigureNotify events bound for the root window.
---
 src/xterm.c | 23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)

diff --git a/src/xterm.c b/src/xterm.c
index 017e63d8b6..52d08e76a7 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -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.  */



reply via email to

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