emacs-diffs
[Top][All Lists]
Advanced

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

master cb8eb5e830: Avoid redundant calls to XFlush in x_make_frame_visib


From: Po Lu
Subject: master cb8eb5e830: Avoid redundant calls to XFlush in x_make_frame_visible
Date: Wed, 3 Aug 2022 21:14:05 -0400 (EDT)

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

    Avoid redundant calls to XFlush in x_make_frame_visible
    
    * src/xterm.c (x_make_frame_visible): Keep track of whether or
    not the output buffer was implictly flushed before issuing
    XFlush.
---
 src/xterm.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/xterm.c b/src/xterm.c
index f82340958e..63e62f39be 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -25750,6 +25750,7 @@ x_make_frame_visible (struct frame *f)
   struct x_display_info *dpyinfo;
   struct x_output *output;
 #endif
+  bool output_flushed;
 
   if (FRAME_PARENT_FRAME (f))
     {
@@ -25840,8 +25841,6 @@ x_make_frame_visible (struct frame *f)
        }
     }
 
-  XFlush (FRAME_X_DISPLAY (f));
-
   /* Synchronize to ensure Emacs knows the frame is visible
      before we do anything else.  We do this loop with input not blocked
      so that incoming events are handled.  */
@@ -25860,6 +25859,10 @@ x_make_frame_visible (struct frame *f)
     /* This must come after we set COUNT.  */
     unblock_input ();
 
+    /* Keep track of whether or not the output buffer was flushed, to
+       avoid any extra flushes.  */
+    output_flushed = false;
+
     /* We unblock here so that arriving X events are processed.  */
 
     /* Now move the window back to where it was "supposed to be".
@@ -25893,6 +25896,7 @@ x_make_frame_visible (struct frame *f)
           there, and take the potential window manager hit.  */
        XGetGeometry (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f),
                      &rootw, &x, &y, &width, &height, &border, &depth);
+       output_flushed = true;
 
        if (original_left != x || original_top != y)
          XMoveWindow (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f),
@@ -25927,7 +25931,11 @@ x_make_frame_visible (struct frame *f)
            (f, build_string ("x_make_frame_visible"));
 
        x_wait_for_event (f, MapNotify);
+       output_flushed = true;
       }
+
+    if (!output_flushed)
+      x_flush (f);
   }
 }
 



reply via email to

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