diff options
| author | Po Lu | 2022-12-05 19:55:04 +0800 |
|---|---|---|
| committer | Po Lu | 2022-12-05 19:58:05 +0800 |
| commit | 2a907bcd4bbcf733931143eb62fe9d7520a011fe (patch) | |
| tree | 6b04bc63a1d3d7bd934b5b22899a6e7817223f1a /src | |
| parent | 4fa37dc426184811e39ce113f6af7f5b308f116b (diff) | |
| download | emacs-2a907bcd4bbcf733931143eb62fe9d7520a011fe.tar.gz emacs-2a907bcd4bbcf733931143eb62fe9d7520a011fe.zip | |
Don't excessively sync in some other code
* configure.ac (USE_XCB): Remove xcb-util dependency.
* src/frame.h: Remove x_sync.
* src/gtkutil.c (xg_frame_restack, xg_update_scrollbar_pos)
(xg_update_horizontal_scrollbar_pos): Call XSync manually
instead of x_sync.
* src/xfns.c (x_sync): Delete unused function.
* src/xterm.c (x_send_hourglass_message): New function.
(x_show_hourglass, x_hide_hourglass): Avoid XSync in these two
pieces of frequently used code.
(handle_one_xevent): Handle hourglass messages.
(x_make_frame_invisible): Stop using x_sync.
Diffstat (limited to 'src')
| -rw-r--r-- | src/frame.h | 1 | ||||
| -rw-r--r-- | src/gtkutil.c | 6 | ||||
| -rw-r--r-- | src/xfns.c | 14 | ||||
| -rw-r--r-- | src/xterm.c | 47 |
4 files changed, 42 insertions, 26 deletions
diff --git a/src/frame.h b/src/frame.h index d6fd62b2ac2..dcd32036b86 100644 --- a/src/frame.h +++ b/src/frame.h | |||
| @@ -1718,7 +1718,6 @@ extern void x_wm_set_icon_position (struct frame *, int, int); | |||
| 1718 | #if !defined USE_X_TOOLKIT | 1718 | #if !defined USE_X_TOOLKIT |
| 1719 | extern const char *x_get_resource_string (const char *, const char *); | 1719 | extern const char *x_get_resource_string (const char *, const char *); |
| 1720 | #endif | 1720 | #endif |
| 1721 | extern void x_sync (struct frame *); | ||
| 1722 | #endif /* HAVE_X_WINDOWS */ | 1721 | #endif /* HAVE_X_WINDOWS */ |
| 1723 | 1722 | ||
| 1724 | #if !defined (HAVE_NS) && !defined (HAVE_PGTK) | 1723 | #if !defined (HAVE_NS) && !defined (HAVE_PGTK) |
diff --git a/src/gtkutil.c b/src/gtkutil.c index a6bba096a43..592bb497749 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c | |||
| @@ -2103,7 +2103,7 @@ xg_frame_restack (struct frame *f1, struct frame *f2, bool above_flag) | |||
| 2103 | 2103 | ||
| 2104 | gdk_window_restack (gwin1, gwin2, above_flag); | 2104 | gdk_window_restack (gwin1, gwin2, above_flag); |
| 2105 | #ifndef HAVE_PGTK | 2105 | #ifndef HAVE_PGTK |
| 2106 | x_sync (f1); | 2106 | XSync (FRAME_X_DISPLAY (f1), False); |
| 2107 | #else | 2107 | #else |
| 2108 | gdk_flush (); | 2108 | gdk_flush (); |
| 2109 | #endif | 2109 | #endif |
| @@ -4793,7 +4793,7 @@ xg_update_scrollbar_pos (struct frame *f, | |||
| 4793 | here to get some events. */ | 4793 | here to get some events. */ |
| 4794 | 4794 | ||
| 4795 | #ifndef HAVE_PGTK | 4795 | #ifndef HAVE_PGTK |
| 4796 | x_sync (f); | 4796 | XSync (FRAME_X_DISPLAY (f), False); |
| 4797 | #else | 4797 | #else |
| 4798 | gdk_flush (); | 4798 | gdk_flush (); |
| 4799 | #endif | 4799 | #endif |
| @@ -4894,7 +4894,7 @@ xg_update_horizontal_scrollbar_pos (struct frame *f, | |||
| 4894 | } | 4894 | } |
| 4895 | 4895 | ||
| 4896 | #ifndef HAVE_PGTK | 4896 | #ifndef HAVE_PGTK |
| 4897 | x_sync (f); | 4897 | XSync (FRAME_X_DISPLAY (f), False); |
| 4898 | #else | 4898 | #else |
| 4899 | gdk_flush (); | 4899 | gdk_flush (); |
| 4900 | #endif | 4900 | #endif |
diff --git a/src/xfns.c b/src/xfns.c index df805d66db9..d713d3c378c 100644 --- a/src/xfns.c +++ b/src/xfns.c | |||
| @@ -7377,20 +7377,6 @@ If TERMINAL is omitted or nil, that stands for the selected frame's display. */ | |||
| 7377 | return Qnil; | 7377 | return Qnil; |
| 7378 | } | 7378 | } |
| 7379 | 7379 | ||
| 7380 | /* Wait for responses to all X commands issued so far for frame F. */ | ||
| 7381 | |||
| 7382 | void | ||
| 7383 | x_sync (struct frame *f) | ||
| 7384 | { | ||
| 7385 | block_input (); | ||
| 7386 | #ifndef USE_XCB | ||
| 7387 | XSync (FRAME_X_DISPLAY (f), False); | ||
| 7388 | #else | ||
| 7389 | xcb_aux_sync (FRAME_DISPLAY_INFO (f)->xcb_connection); | ||
| 7390 | #endif | ||
| 7391 | unblock_input (); | ||
| 7392 | } | ||
| 7393 | |||
| 7394 | 7380 | ||
| 7395 | /*********************************************************************** | 7381 | /*********************************************************************** |
| 7396 | Window properties | 7382 | Window properties |
diff --git a/src/xterm.c b/src/xterm.c index d57830163cb..d3842810c3f 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -11005,6 +11005,31 @@ x_clear_frame (struct frame *f) | |||
| 11005 | unblock_input (); | 11005 | unblock_input (); |
| 11006 | } | 11006 | } |
| 11007 | 11007 | ||
| 11008 | /* Send a message to frame F telling the event loop to track whether | ||
| 11009 | or not an hourglass is being displayed. This is required to ignore | ||
| 11010 | the right events when the hourglass is mapped without callig XSync | ||
| 11011 | after displaying or hiding the hourglass. */ | ||
| 11012 | |||
| 11013 | static void | ||
| 11014 | x_send_hourglass_message (struct frame *f, bool hourglass_enabled) | ||
| 11015 | { | ||
| 11016 | struct x_display_info *dpyinfo; | ||
| 11017 | XEvent msg; | ||
| 11018 | |||
| 11019 | dpyinfo = FRAME_DISPLAY_INFO (f); | ||
| 11020 | memset (&msg, 0, sizeof msg); | ||
| 11021 | |||
| 11022 | msg.xclient.type = ClientMessage; | ||
| 11023 | msg.xclient.message_type | ||
| 11024 | = dpyinfo->Xatom_EMACS_TMP; | ||
| 11025 | msg.xclient.format = 8; | ||
| 11026 | msg.xclient.window = FRAME_X_WINDOW (f); | ||
| 11027 | msg.xclient.data.b[0] = hourglass_enabled ? 1 : 0; | ||
| 11028 | |||
| 11029 | XSendEvent (dpyinfo->display, FRAME_X_WINDOW (f), | ||
| 11030 | False, NoEventMask, &msg); | ||
| 11031 | } | ||
| 11032 | |||
| 11008 | /* RIF: Show hourglass cursor on frame F. */ | 11033 | /* RIF: Show hourglass cursor on frame F. */ |
| 11009 | 11034 | ||
| 11010 | static void | 11035 | static void |
| @@ -11025,14 +11050,14 @@ x_show_hourglass (struct frame *f) | |||
| 11025 | if (popup_activated ()) | 11050 | if (popup_activated ()) |
| 11026 | return; | 11051 | return; |
| 11027 | 11052 | ||
| 11053 | x_send_hourglass_message (f, true); | ||
| 11054 | |||
| 11028 | #ifdef USE_X_TOOLKIT | 11055 | #ifdef USE_X_TOOLKIT |
| 11029 | if (x->widget) | 11056 | if (x->widget) |
| 11030 | #else | 11057 | #else |
| 11031 | if (FRAME_OUTER_WINDOW (f)) | 11058 | if (FRAME_OUTER_WINDOW (f)) |
| 11032 | #endif | 11059 | #endif |
| 11033 | { | 11060 | { |
| 11034 | x->hourglass_p = true; | ||
| 11035 | |||
| 11036 | if (!x->hourglass_window) | 11061 | if (!x->hourglass_window) |
| 11037 | { | 11062 | { |
| 11038 | #ifndef USE_XCB | 11063 | #ifndef USE_XCB |
| @@ -11099,15 +11124,11 @@ x_hide_hourglass (struct frame *f) | |||
| 11099 | { | 11124 | { |
| 11100 | #ifndef USE_XCB | 11125 | #ifndef USE_XCB |
| 11101 | XUnmapWindow (FRAME_X_DISPLAY (f), x->hourglass_window); | 11126 | XUnmapWindow (FRAME_X_DISPLAY (f), x->hourglass_window); |
| 11102 | /* Sync here because XTread_socket looks at the | ||
| 11103 | hourglass_p flag that is reset to zero below. */ | ||
| 11104 | XSync (FRAME_X_DISPLAY (f), False); | ||
| 11105 | #else | 11127 | #else |
| 11106 | xcb_unmap_window (FRAME_DISPLAY_INFO (f)->xcb_connection, | 11128 | xcb_unmap_window (FRAME_DISPLAY_INFO (f)->xcb_connection, |
| 11107 | (xcb_window_t) x->hourglass_window); | 11129 | (xcb_window_t) x->hourglass_window); |
| 11108 | xcb_aux_sync (FRAME_DISPLAY_INFO (f)->xcb_connection); | ||
| 11109 | #endif | 11130 | #endif |
| 11110 | x->hourglass_p = false; | 11131 | x_send_hourglass_message (f, false); |
| 11111 | } | 11132 | } |
| 11112 | } | 11133 | } |
| 11113 | 11134 | ||
| @@ -18620,6 +18641,16 @@ handle_one_xevent (struct x_display_info *dpyinfo, | |||
| 18620 | } | 18641 | } |
| 18621 | } | 18642 | } |
| 18622 | 18643 | ||
| 18644 | if (event->xclient.message_type == dpyinfo->Xatom_EMACS_TMP | ||
| 18645 | && event->xclient.format == 8) | ||
| 18646 | { | ||
| 18647 | /* This is actually an hourglass message. Set whether or | ||
| 18648 | not events from here on have the hourglass enabled. */ | ||
| 18649 | |||
| 18650 | if (any) | ||
| 18651 | FRAME_X_OUTPUT (any)->hourglass_p = event->xclient.data.b[0]; | ||
| 18652 | } | ||
| 18653 | |||
| 18623 | if (event->xclient.message_type == dpyinfo->Xatom_wm_protocols | 18654 | if (event->xclient.message_type == dpyinfo->Xatom_wm_protocols |
| 18624 | && event->xclient.format == 32) | 18655 | && event->xclient.format == 32) |
| 18625 | { | 18656 | { |
| @@ -28273,7 +28304,7 @@ x_make_frame_invisible (struct frame *f) | |||
| 28273 | error ("Can't notify window manager of window withdrawal"); | 28304 | error ("Can't notify window manager of window withdrawal"); |
| 28274 | } | 28305 | } |
| 28275 | 28306 | ||
| 28276 | x_sync (f); | 28307 | XSync (FRAME_X_DISPLAY (f), False); |
| 28277 | 28308 | ||
| 28278 | /* We can't distinguish this from iconification | 28309 | /* We can't distinguish this from iconification |
| 28279 | just by the event that we get from the server. | 28310 | just by the event that we get from the server. |