diff options
| author | Po Lu | 2022-08-04 09:13:53 +0800 |
|---|---|---|
| committer | Po Lu | 2022-08-04 09:13:53 +0800 |
| commit | cb8eb5e83050f0c58f06820d2f192e583018a66f (patch) | |
| tree | 1813fde33bd280b141b335173ba5f58d948e5caf /src/xterm.c | |
| parent | 9e9b0e13bc8fbf716bb48e68bb642b130ff41fed (diff) | |
| download | emacs-cb8eb5e83050f0c58f06820d2f192e583018a66f.tar.gz emacs-cb8eb5e83050f0c58f06820d2f192e583018a66f.zip | |
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.
Diffstat (limited to 'src/xterm.c')
| -rw-r--r-- | src/xterm.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/xterm.c b/src/xterm.c index f82340958e5..63e62f39bef 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -25750,6 +25750,7 @@ x_make_frame_visible (struct frame *f) | |||
| 25750 | struct x_display_info *dpyinfo; | 25750 | struct x_display_info *dpyinfo; |
| 25751 | struct x_output *output; | 25751 | struct x_output *output; |
| 25752 | #endif | 25752 | #endif |
| 25753 | bool output_flushed; | ||
| 25753 | 25754 | ||
| 25754 | if (FRAME_PARENT_FRAME (f)) | 25755 | if (FRAME_PARENT_FRAME (f)) |
| 25755 | { | 25756 | { |
| @@ -25840,8 +25841,6 @@ x_make_frame_visible (struct frame *f) | |||
| 25840 | } | 25841 | } |
| 25841 | } | 25842 | } |
| 25842 | 25843 | ||
| 25843 | XFlush (FRAME_X_DISPLAY (f)); | ||
| 25844 | |||
| 25845 | /* Synchronize to ensure Emacs knows the frame is visible | 25844 | /* Synchronize to ensure Emacs knows the frame is visible |
| 25846 | before we do anything else. We do this loop with input not blocked | 25845 | before we do anything else. We do this loop with input not blocked |
| 25847 | so that incoming events are handled. */ | 25846 | so that incoming events are handled. */ |
| @@ -25860,6 +25859,10 @@ x_make_frame_visible (struct frame *f) | |||
| 25860 | /* This must come after we set COUNT. */ | 25859 | /* This must come after we set COUNT. */ |
| 25861 | unblock_input (); | 25860 | unblock_input (); |
| 25862 | 25861 | ||
| 25862 | /* Keep track of whether or not the output buffer was flushed, to | ||
| 25863 | avoid any extra flushes. */ | ||
| 25864 | output_flushed = false; | ||
| 25865 | |||
| 25863 | /* We unblock here so that arriving X events are processed. */ | 25866 | /* We unblock here so that arriving X events are processed. */ |
| 25864 | 25867 | ||
| 25865 | /* Now move the window back to where it was "supposed to be". | 25868 | /* Now move the window back to where it was "supposed to be". |
| @@ -25893,6 +25896,7 @@ x_make_frame_visible (struct frame *f) | |||
| 25893 | there, and take the potential window manager hit. */ | 25896 | there, and take the potential window manager hit. */ |
| 25894 | XGetGeometry (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f), | 25897 | XGetGeometry (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f), |
| 25895 | &rootw, &x, &y, &width, &height, &border, &depth); | 25898 | &rootw, &x, &y, &width, &height, &border, &depth); |
| 25899 | output_flushed = true; | ||
| 25896 | 25900 | ||
| 25897 | if (original_left != x || original_top != y) | 25901 | if (original_left != x || original_top != y) |
| 25898 | XMoveWindow (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f), | 25902 | XMoveWindow (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f), |
| @@ -25927,7 +25931,11 @@ x_make_frame_visible (struct frame *f) | |||
| 25927 | (f, build_string ("x_make_frame_visible")); | 25931 | (f, build_string ("x_make_frame_visible")); |
| 25928 | 25932 | ||
| 25929 | x_wait_for_event (f, MapNotify); | 25933 | x_wait_for_event (f, MapNotify); |
| 25934 | output_flushed = true; | ||
| 25930 | } | 25935 | } |
| 25936 | |||
| 25937 | if (!output_flushed) | ||
| 25938 | x_flush (f); | ||
| 25931 | } | 25939 | } |
| 25932 | } | 25940 | } |
| 25933 | 25941 | ||