emacs-diffs
[Top][All Lists]
Advanced

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

master 36b31d38cd: Get rid of a loop through all frames when processing


From: Po Lu
Subject: master 36b31d38cd: Get rid of a loop through all frames when processing events
Date: Sun, 6 Mar 2022 19:55:04 -0500 (EST)

branch: master
commit 36b31d38cd9bde7ad1ec18c136854cddba0d6bbe
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>

    Get rid of a loop through all frames when processing events
    
    * src/xterm.c (handle_one_xevent): Just flip back buffer of f
    and any instead.
    (flush_dirty_back_buffer_on): New function.
    (flush_dirty_back_buffers): Delete function.
---
 src/xterm.c | 35 ++++++++++++++++++-----------------
 1 file changed, 18 insertions(+), 17 deletions(-)

diff --git a/src/xterm.c b/src/xterm.c
index 8642345549..d368c72323 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -9887,23 +9887,18 @@ x_net_wm_state (struct frame *f, Window window)
   store_frame_param (f, Qshaded, shaded ? Qt : Qnil);
 }
 
-/* Flip back buffers on any frames with undrawn content.  */
+/* Flip back buffers on FRAME if it has undrawn content.  */
 static void
-flush_dirty_back_buffers (void)
+flush_dirty_back_buffer_on (struct frame *f)
 {
   block_input ();
-  Lisp_Object tail, frame;
-  FOR_EACH_FRAME (tail, frame)
-    {
-      struct frame *f = XFRAME (frame);
-      if (FRAME_LIVE_P (f) &&
-          FRAME_X_P (f) &&
-          FRAME_X_WINDOW (f) &&
-          !FRAME_GARBAGED_P (f) &&
-          !buffer_flipping_blocked_p () &&
-          FRAME_X_NEED_BUFFER_FLIP (f))
-        show_back_buffer (f);
-    }
+  if (FRAME_LIVE_P (f) &&
+      FRAME_X_P (f) &&
+      FRAME_X_WINDOW (f) &&
+      !FRAME_GARBAGED_P (f) &&
+      !buffer_flipping_blocked_p () &&
+      FRAME_X_NEED_BUFFER_FLIP (f))
+    show_back_buffer (f);
   unblock_input ();
 }
 
@@ -13490,9 +13485,15 @@ handle_one_xevent (struct x_display_info *dpyinfo,
       count++;
     }
 
-  /* Sometimes event processing draws to the frame outside redisplay.
-     To ensure that these changes become visible, draw them here.  */
-  flush_dirty_back_buffers ();
+  /* Sometimes event processing draws to either F or ANY outside
+     redisplay.  To ensure that these changes become visible, draw
+     them here.  */
+
+  if (f)
+    flush_dirty_back_buffer_on (f);
+
+  if (any && any != f)
+    flush_dirty_back_buffer_on (any);
   return count;
 }
 



reply via email to

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