commit ccf3705892d93159f655d3aab822ed62249e78dc (HEAD, refs/remotes/origin/master) Merge: 2c8b09b06e7 717f8477284 Author: Stefan Kangas Date: Tue Dec 6 06:30:29 2022 +0100 Merge from origin/emacs-29 717f8477284 ; Fix typo in js--treesit-imenu c26fe45cb80 Fix treesit-query-capture 318bf42b410 Improve fontification of typescript-ts-mode (bug#59831) 64271bbb7d9 Add back pair feature in json-ts-mode fontification (bug#... 16b94888429 Fix mouse clicks on a non-selected frame ca0da3b83df ; Clarify description of display on the margins commit 717f8477284170dd59315a3c64cc7e492e9366e2 (refs/remotes/origin/emacs-29) Author: Randy Taylor Date: Mon Dec 5 20:30:56 2022 -0500 ; Fix typo in js--treesit-imenu * lisp/progmodes/js.el (js--treesit-imenu): Fix a typo. (Bug#59849) diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el index 90ab7cc924b..45dfef372cd 100644 --- a/lisp/progmodes/js.el +++ b/lisp/progmodes/js.el @@ -3734,7 +3734,7 @@ js--treesit-imenu (var-tree (treesit-induce-sparse-tree node "lexical_declaration" nil 1000))) `(("Class" . ,(js--treesit-imenu-1 class-tree)) - ("Varieable" . ,(js--treesit-imenu-1 var-tree)) + ("Variable" . ,(js--treesit-imenu-1 var-tree)) ("Function" . ,(js--treesit-imenu-1 func-tree))))) ;;; Main Function commit c26fe45cb8046eecaf3a74e3e7d4bc62ab511a8c Author: Yuan Fu Date: Mon Dec 5 18:37:47 2022 -0800 Fix treesit-query-capture Before this change Ftreesit_query_capture doesn't convert character position to byte position for BEG and END parameters. I observed fontification issue in css files but couldn't figure out why, now I know :-) I decide to keep treesit--font-lock-query-expand-range, since it might provide a escape hatch for problems we discover in the future, and it should be very cheap so no downside of keeping it. * lisp/textmodes/css-mode.el (css-ts-mode): Stop setting treesit--font-lock-query-expand-range. * lisp/treesit.el (treesit--font-lock-query-expand-range): Update docstring. * src/treesit.c (Ftreesit_query_capture): Convert BEG and END to byte position. Also added parentheses wround "beg_byte - visible_beg" in the call to ts_query_cursor_set_byte_range (i.e., style change). diff --git a/lisp/textmodes/css-mode.el b/lisp/textmodes/css-mode.el index b82886e3974..8a66986dc6f 100644 --- a/lisp/textmodes/css-mode.el +++ b/lisp/textmodes/css-mode.el @@ -1839,11 +1839,6 @@ css-ts-mode '((selector comment query keyword) (property constant string) (error variable function operator bracket))) - ;; Tree-sitter-css, for whatever reason, cannot reliably return - ;; the captured nodes in a given range (it instead returns the - ;; nodes preceding range). Before this is fixed in - ;; tree-sitter-css, use this heuristic as a temporary fix. - (setq-local treesit--font-lock-query-expand-range (cons 80 80)) (setq-local imenu-create-index-function #'css--treesit-imenu) (setq-local which-func-functions nil) (treesit-major-mode-setup))) diff --git a/lisp/treesit.el b/lisp/treesit.el index eee6eee0c7f..dbbf7ec18c3 100644 --- a/lisp/treesit.el +++ b/lisp/treesit.el @@ -545,12 +545,7 @@ treesit--font-lock-query-expand-range buffer, Emacs will move the start of the query range backward by START amount, and the end of the query range by END amount. Both START and END should be positive integers or 0. This doesn't -affect the fontified range. - -Sometimes, querying on some parser with a restricted range -returns nodes not in that range but before it, which breaks -fontification. Major modes can adjust this variable as a -temporarily fix.") +affect the fontified range.") (defvar-local treesit-font-lock-feature-list nil "A list of lists of feature symbols. diff --git a/src/treesit.c b/src/treesit.c index 4b150059fac..343054ed53e 100644 --- a/src/treesit.c +++ b/src/treesit.c @@ -2507,14 +2507,17 @@ DEFUN ("treesit-query-capture", /* Set query range. */ if (!NILP (beg) && !NILP (end)) { - EMACS_INT beg_byte = XFIXNUM (beg); - EMACS_INT end_byte = XFIXNUM (end); + EMACS_INT beg_byte = buf_charpos_to_bytepos (current_buffer, + XFIXNUM (beg)); + EMACS_INT end_byte = buf_charpos_to_bytepos (current_buffer, + XFIXNUM (end)); /* We never let tree-sitter run on buffers too large, so these assertion should never hit. */ eassert (beg_byte - visible_beg <= UINT32_MAX); eassert (end_byte - visible_beg <= UINT32_MAX); - ts_query_cursor_set_byte_range (cursor, (uint32_t) beg_byte - visible_beg, - (uint32_t) end_byte - visible_beg); + ts_query_cursor_set_byte_range (cursor, + (uint32_t) (beg_byte - visible_beg), + (uint32_t) (end_byte - visible_beg)); } /* Execute query. */ commit 2c8b09b06e731943c9471a57d90d52363c7c192c Author: Po Lu Date: Tue Dec 6 09:30:00 2022 +0800 Fix crash on Windows 9X * src/emacs.c (main): Call init_bignum before init_window_once. diff --git a/src/emacs.c b/src/emacs.c index 00e7f86e9ae..d8a2863fd9c 100644 --- a/src/emacs.c +++ b/src/emacs.c @@ -1924,6 +1924,12 @@ main (int argc, char **argv) Vcoding_system_hash_table. */ syms_of_coding (); /* This should be after syms_of_fileio. */ init_frame_once (); /* Before init_window_once. */ + /* init_window_once calls make_initial_frame, which calls + Fcurrent_time and bset_display_time, both of which allocate + bignums. Without the following call to init_bignums, crashes + happen on Windows 9X after dumping when GC tries to free a + pointer allocated on the system heap. */ + init_bignum (); init_window_once (); /* Init the window system. */ #ifdef HAVE_WINDOW_SYSTEM init_fringe_once (); /* Swap bitmaps if necessary. */ commit 318bf42b410d4a8ecf0e8ff64280cfd655884877 Author: Jostein Kjønigsen Date: Mon Dec 5 09:31:58 2022 +0100 Improve fontification of typescript-ts-mode (bug#59831) - Highlight property and field definitions in class declaration. - Highlight property-keys in object initializaters. - Highlight variable-names in function/method return-statements. * lisp/progmodes/typescript-ts-mode.el (typescript-ts-mode--font-lock-settings): Add fontification rules. diff --git a/lisp/progmodes/typescript-ts-mode.el b/lisp/progmodes/typescript-ts-mode.el index 48ac1169fe8..3da690567e2 100644 --- a/lisp/progmodes/typescript-ts-mode.el +++ b/lisp/progmodes/typescript-ts-mode.el @@ -213,7 +213,14 @@ typescript-ts-mode--font-lock-settings parameters: [(_ (identifier) @font-lock-variable-name-face) (_ (_ (identifier) @font-lock-variable-name-face)) - (_ (_ (_ (identifier) @font-lock-variable-name-face)))])) + (_ (_ (_ (identifier) @font-lock-variable-name-face)))]) + + (return_statement (identifier) @font-lock-variable-name-face) + + (binary_expression left: (identifier) @font-lock-variable-name-face) + (binary_expression right: (identifier) @font-lock-variable-name-face) + + (arguments (identifier) @font-lock-variable-name-face)) :language language :override t @@ -282,7 +289,14 @@ typescript-ts-mode--font-lock-settings :language language :override t :feature 'property - `((pair value: (identifier) @font-lock-variable-name-face) + `((property_signature + name: (property_identifier) @font-lock-property-face) + (public_field_definition + name: (property_identifier) @font-lock-property-face) + + (pair key: (property_identifier) @font-lock-variable-name-face) + + (pair value: (identifier) @font-lock-variable-name-face) ((shorthand_property_identifier) @font-lock-property-face) commit 64271bbb7d9066080ea1e8dbae72beed979350e6 Author: Theodor Thornhill Date: Mon Dec 5 15:59:41 2022 +0100 Add back pair feature in json-ts-mode fontification (bug#59833) * lisp/progmodes/json-ts-mode.el (json-ts-mode--font-lock-settings): Add back in removed pair feature. Also alphabetize features. (json-ts-mode): Use the new feature. diff --git a/lisp/progmodes/json-ts-mode.el b/lisp/progmodes/json-ts-mode.el index 101e873cf6e..8ea582ad8fa 100644 --- a/lisp/progmodes/json-ts-mode.el +++ b/lisp/progmodes/json-ts-mode.el @@ -93,6 +93,10 @@ json-ts-mode--font-lock-settings :override t '((escape_sequence) @font-lock-escape-face) :language 'json + :feature 'pair + :override t ; Needed for overriding string face on keys. + '((pair key: (_) @font-lock-variable-name-face)) + :language 'json :feature 'error :override t '((ERROR) @font-lock-warning-face)) @@ -156,7 +160,7 @@ json-ts-mode ;; Font-lock. (setq-local treesit-font-lock-settings json-ts-mode--font-lock-settings) (setq-local treesit-font-lock-feature-list - '((constant number string) + '((constant number pair string) (escape-sequence) (bracket delimiter error))) commit 16b948884294d6081fbcdd734df06f3bb14da96d Author: Eli Zaretskii Date: Mon Dec 5 21:55:25 2022 +0200 Fix mouse clicks on a non-selected frame * lisp/mouse-drag.el (mouse-drag-drag): Skip switch-frame events while tracking mouse. (Bug#59785) diff --git a/lisp/mouse-drag.el b/lisp/mouse-drag.el index f515cc8aacf..81b699c0202 100644 --- a/lisp/mouse-drag.el +++ b/lisp/mouse-drag.el @@ -275,6 +275,7 @@ mouse-drag-drag have-scrolled window-last-row col window-last-col + switch-frame-p (scroll-col-delta 0) ;; be conservative about allowing horizontal scrolling (col-scrolling-p (mouse-drag-should-do-col-scrolling))) @@ -286,15 +287,21 @@ mouse-drag-drag (setq track-mouse 'drag-dragging) (while (progn (setq event (read--potential-mouse-event) - end (event-end event) - row (cdr (posn-col-row end)) - col (car (posn-col-row end))) - (or (mouse-movement-p event) - (eq (car-safe event) 'switch-frame))) + switch-frame-p (eq (car-safe event) 'switch-frame)) + ;; We want to skip switch-frame events and treat then + ;; as moves over a different window. These events have + ;; no position spec, so all the posn-* accessor + ;; functions are likely to barf if passed such an + ;; event. + (or switch-frame-p + (setq end (event-end event) + row (cdr (posn-col-row end)) + col (car (posn-col-row end)))) + (or (mouse-movement-p event) switch-frame-p)) ;; Scroll if see if we're on the edge. ;; FIXME: should handle mouse-in-other window. (cond - ((not (eq start-window (posn-window end))) + ((or switch-frame-p (not (eq start-window (posn-window end)))) t) ; wait for return to original window ((<= row 0) (mouse-drag-repeatedly-safe-scroll -1 0)) ((>= row window-last-row) (mouse-drag-repeatedly-safe-scroll 1 0)) commit ca0da3b83dfc4a366978c9cd17db7a212a83f6d3 Author: Eli Zaretskii Date: Mon Dec 5 21:45:01 2022 +0200 ; Clarify description of display on the margins * doc/lispref/display.texi (Display Margins): More accurate explanation of how to show text in the display margin without concealing buffer text. (Bug#59841) diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi index 9d929950a7e..340aa400cfa 100644 --- a/doc/lispref/display.texi +++ b/doc/lispref/display.texi @@ -5467,8 +5467,9 @@ Display Margins To display something in the margin @emph{in association with} certain buffer text, without altering or preventing the display of -that text, put a @code{before-string} property on the text and put the -margin display specification on the contents of the before-string. +that text, put on that text an overlay with a @code{before-string} +property, and put the margin display specification on the contents of +the before-string. Note that if the string to be displayed in the margin doesn't specify a face, its face is determined using the same rules and commit 3114158a384d4c1fdc3e1845bf8a55fca7787916 Author: Eli Zaretskii Date: Mon Dec 5 18:55:19 2022 +0200 ; * src/xfns.c: Actually remove "#include ". diff --git a/src/xfns.c b/src/xfns.c index 6d09527409c..9951ced6611 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -43,7 +43,6 @@ Copyright (C) 1989, 1992-2022 Free Software Foundation, Inc. #ifdef USE_XCB #include #include -#include #endif #include "bitmaps/gray.xbm" commit c1a3e8830bb2fa8c3e8056bb42360f3504c434e9 Author: Po Lu Date: Mon Dec 5 20:41:37 2022 +0800 Fix build with old XCB * src/xfns.c (x_get_net_workarea): * src/xterm.c (x_dnd_compute_toplevels, x_dnd_get_proxy_proto) (x_dnd_get_wm_state_and_proto, handle_one_xevent): Do not include xcb_aux.h. Use XA_ constants instead of XCB_ATOM_ ones. diff --git a/src/xfns.c b/src/xfns.c index d713d3c378c..6d09527409c 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -5723,13 +5723,13 @@ x_get_net_workarea (struct x_display_info *dpyinfo, XRectangle *rect) = xcb_get_property (dpyinfo->xcb_connection, 0, (xcb_window_t) dpyinfo->root_window, (xcb_atom_t) dpyinfo->Xatom_net_current_desktop, - XCB_ATOM_CARDINAL, 0, 1); + XA_CARDINAL, 0, 1); workarea_cookie = xcb_get_property (dpyinfo->xcb_connection, 0, (xcb_window_t) dpyinfo->root_window, (xcb_atom_t) dpyinfo->Xatom_net_workarea, - XCB_ATOM_CARDINAL, 0, UINT32_MAX); + XA_CARDINAL, 0, UINT32_MAX); reply = xcb_get_property_reply (dpyinfo->xcb_connection, current_desktop_cookie, &error); @@ -5740,7 +5740,7 @@ x_get_net_workarea (struct x_display_info *dpyinfo, XRectangle *rect) else { if (xcb_get_property_value_length (reply) != 4 - || reply->type != XCB_ATOM_CARDINAL || reply->format != 32) + || reply->type != XA_CARDINAL || reply->format != 32) rc = false; else current_workspace = *(uint32_t *) xcb_get_property_value (reply); @@ -5755,7 +5755,7 @@ x_get_net_workarea (struct x_display_info *dpyinfo, XRectangle *rect) free (error), rc = false; else { - if (rc && reply->type == XCB_ATOM_CARDINAL && reply->format == 32 + if (rc && reply->type == XA_CARDINAL && reply->format == 32 && (xcb_get_property_value_length (reply) / sizeof (uint32_t) >= current_workspace + 4)) { diff --git a/src/xterm.c b/src/xterm.c index d3842810c3f..ab31f0d93e6 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -574,7 +574,6 @@ Copyright (C) 1989, 1993-2022 Free Software Foundation, Inc. #ifdef USE_XCB #include #include -#include #endif /* If we have Xfixes extension, use it for pointer blanking. */ @@ -3072,7 +3071,7 @@ x_dnd_compute_toplevels (struct x_display_info *dpyinfo) 0, 0); get_property_cookies[i] = xcb_get_property (dpyinfo->xcb_connection, 0, (xcb_window_t) toplevels[i], - (xcb_atom_t) dpyinfo->Xatom_wm_state, XCB_ATOM_ANY, + (xcb_atom_t) dpyinfo->Xatom_wm_state, 0, 0, 2); xm_property_cookies[i] = xcb_get_property (dpyinfo->xcb_connection, 0, (xcb_window_t) toplevels[i], @@ -3083,7 +3082,7 @@ x_dnd_compute_toplevels (struct x_display_info *dpyinfo) = xcb_get_property (dpyinfo->xcb_connection, 0, (xcb_window_t) toplevels[i], (xcb_atom_t) dpyinfo->Xatom_net_frame_extents, - XCB_ATOM_CARDINAL, 0, 4); + XA_CARDINAL, 0, 4); get_geometry_cookies[i] = xcb_get_geometry (dpyinfo->xcb_connection, (xcb_window_t) toplevels[i]); @@ -3211,7 +3210,7 @@ x_dnd_compute_toplevels (struct x_display_info *dpyinfo) { if (xcb_get_property_value_length (extent_property_reply) == 16 && extent_property_reply->format == 32 - && extent_property_reply->type == XCB_ATOM_CARDINAL) + && extent_property_reply->type == XA_CARDINAL) { fextents = xcb_get_property_value (extent_property_reply); frame_extents[0] = fextents[0]; @@ -3585,13 +3584,13 @@ x_dnd_get_proxy_proto (struct x_display_info *dpyinfo, Window wdesc, xdnd_proxy_cookie = xcb_get_property (dpyinfo->xcb_connection, 0, (xcb_window_t) wdesc, (xcb_atom_t) dpyinfo->Xatom_XdndProxy, - XCB_ATOM_WINDOW, 0, 1); + XA_WINDOW, 0, 1); if (proto_out) xdnd_proto_cookie = xcb_get_property (dpyinfo->xcb_connection, 0, (xcb_window_t) wdesc, (xcb_atom_t) dpyinfo->Xatom_XdndAware, - XCB_ATOM_ATOM, 0, 1); + XA_ATOM, 0, 1); if (proxy_out) { @@ -3603,7 +3602,7 @@ x_dnd_get_proxy_proto (struct x_display_info *dpyinfo, Window wdesc, else { if (reply->format == 32 - && reply->type == XCB_ATOM_WINDOW + && reply->type == XA_WINDOW && (xcb_get_property_value_length (reply) >= 4)) *proxy_out = *(xcb_window_t *) xcb_get_property_value (reply); @@ -3621,7 +3620,7 @@ x_dnd_get_proxy_proto (struct x_display_info *dpyinfo, Window wdesc, else { if (reply->format == 32 - && reply->type == XCB_ATOM_ATOM + && reply->type == XA_ATOM && (xcb_get_property_value_length (reply) >= 4)) *proto_out = (int) *(xcb_atom_t *) xcb_get_property_value (reply); @@ -3805,15 +3804,15 @@ x_dnd_get_wm_state_and_proto (struct x_display_info *dpyinfo, wmstate_cookie = xcb_get_property (dpyinfo->xcb_connection, 0, (xcb_window_t) window, (xcb_atom_t) dpyinfo->Xatom_wm_state, - XCB_ATOM_ANY, 0, 2); + 0, 0, 2); xdnd_proto_cookie = xcb_get_property (dpyinfo->xcb_connection, 0, (xcb_window_t) window, (xcb_atom_t) dpyinfo->Xatom_XdndAware, - XCB_ATOM_ATOM, 0, 1); + XA_ATOM, 0, 1); xdnd_proxy_cookie = xcb_get_property (dpyinfo->xcb_connection, 0, (xcb_window_t) window, (xcb_atom_t) dpyinfo->Xatom_XdndProxy, - XCB_ATOM_WINDOW, 0, 1); + XA_WINDOW, 0, 1); xm_style_cookie = xcb_get_property (dpyinfo->xcb_connection, 0, (xcb_window_t) window, (xcb_atom_t) dpyinfo->Xatom_MOTIF_DRAG_RECEIVER_INFO, @@ -3860,7 +3859,7 @@ x_dnd_get_wm_state_and_proto (struct x_display_info *dpyinfo, else { if (reply->format == 32 - && reply->type == XCB_ATOM_WINDOW + && reply->type == XA_WINDOW && (xcb_get_property_value_length (reply) >= 4)) *proxy_out = *(xcb_window_t *) xcb_get_property_value (reply); @@ -19239,7 +19238,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, = xcb_get_property (dpyinfo->xcb_connection, 0, (xcb_window_t) FRAME_OUTER_WINDOW (f), (xcb_atom_t) dpyinfo->Xatom_net_wm_window_opacity, - XCB_ATOM_CARDINAL, 0, 1); + XA_CARDINAL, 0, 1); opacity_reply = xcb_get_property_reply (dpyinfo->xcb_connection, opacity_cookie, &error); @@ -19248,9 +19247,9 @@ handle_one_xevent (struct x_display_info *dpyinfo, free (error), rc = false; else rc = (opacity_reply->format == 32 - && (opacity_reply->type == XCB_ATOM_CARDINAL - || opacity_reply->type == XCB_ATOM_ATOM - || opacity_reply->type == XCB_ATOM_WINDOW) + && (opacity_reply->type == XA_CARDINAL + || opacity_reply->type == XA_ATOM + || opacity_reply->type == XA_WINDOW) && (xcb_get_property_value_length (opacity_reply) >= 4)); if (rc) commit a8574e76ff054aa70598ac7c21abc39736be9874 Author: Eli Zaretskii Date: Mon Dec 5 14:21:36 2022 +0200 ; * etc/NEWS: Fix entry for 'vc-git-shortlog-switches'. diff --git a/etc/NEWS b/etc/NEWS index 8f5b17fb4af..3eeef0ab4c3 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -44,9 +44,10 @@ connection. ** VC --- -*** New user option 'vc-git-shortlog-switches' -String or list of strings giving Git log switches for shortlogs, such -as 'C-x v L'. 'vc-git-log-switches' is no longer used for shortlogs. +*** New user option 'vc-git-shortlog-switches'. +This is a string or a list of strings that specifies the Git log +switches for shortlogs, such as the one produced by 'C-x v L'. +'vc-git-log-switches' is no longer used for shortlogs. * New Modes and Packages in Emacs 30.1 commit 2a907bcd4bbcf733931143eb62fe9d7520a011fe Author: Po Lu Date: Mon Dec 5 19:55:04 2022 +0800 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. diff --git a/configure.ac b/configure.ac index 9f431fc78b2..2770694b9c5 100644 --- a/configure.ac +++ b/configure.ac @@ -3933,21 +3933,10 @@ AC_DEFUN if test "${HAVE_XCB}" = "yes"; then AC_CHECK_LIB([X11-xcb], [XGetXCBConnection], [HAVE_X11_XCB=yes]) if test "${HAVE_X11_XCB}" = "yes"; then - AC_CHECK_LIB([xcb-util], [xcb_aux_sync], [HAVE_XCB_UTIL=yes]) - if test "${HAVE_XCB_UTIL}" = "yes"; then - AC_DEFINE([USE_XCB], [1], + AC_DEFINE([USE_XCB], [1], [Define to 1 if you have the XCB library and X11-XCB library for mixed - X11/XCB programming.]) - XCB_LIBS="-lX11-xcb -lxcb -lxcb-util" - else - AC_CHECK_LIB([xcb-aux], [xcb_aux_sync], [HAVE_XCB_AUX=yes]) - if test "${HAVE_XCB_AUX}" = "yes"; then - AC_DEFINE([USE_XCB], [1], -[Define to 1 if you have the XCB library and X11-XCB library for mixed - X11/XCB programming.]) - XCB_LIBS="-lX11-xcb -lxcb -lxcb-aux" - fi - fi +X11/XCB programming.]) + XCB_LIBS="-lX11-xcb -lxcb" fi fi fi 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 @@ #define EMACS_CLASS "Emacs" #if !defined USE_X_TOOLKIT extern const char *x_get_resource_string (const char *, const char *); #endif -extern void x_sync (struct frame *); #endif /* HAVE_X_WINDOWS */ #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) gdk_window_restack (gwin1, gwin2, above_flag); #ifndef HAVE_PGTK - x_sync (f1); + XSync (FRAME_X_DISPLAY (f1), False); #else gdk_flush (); #endif @@ -4793,7 +4793,7 @@ xg_update_scrollbar_pos (struct frame *f, here to get some events. */ #ifndef HAVE_PGTK - x_sync (f); + XSync (FRAME_X_DISPLAY (f), False); #else gdk_flush (); #endif @@ -4894,7 +4894,7 @@ xg_update_horizontal_scrollbar_pos (struct frame *f, } #ifndef HAVE_PGTK - x_sync (f); + XSync (FRAME_X_DISPLAY (f), False); #else gdk_flush (); #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 @@ DEFUN ("x-synchronize", Fx_synchronize, Sx_synchronize, 1, 2, 0, return Qnil; } -/* Wait for responses to all X commands issued so far for frame F. */ - -void -x_sync (struct frame *f) -{ - block_input (); -#ifndef USE_XCB - XSync (FRAME_X_DISPLAY (f), False); -#else - xcb_aux_sync (FRAME_DISPLAY_INFO (f)->xcb_connection); -#endif - unblock_input (); -} - /*********************************************************************** 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) unblock_input (); } +/* Send a message to frame F telling the event loop to track whether + or not an hourglass is being displayed. This is required to ignore + the right events when the hourglass is mapped without callig XSync + after displaying or hiding the hourglass. */ + +static void +x_send_hourglass_message (struct frame *f, bool hourglass_enabled) +{ + struct x_display_info *dpyinfo; + XEvent msg; + + dpyinfo = FRAME_DISPLAY_INFO (f); + memset (&msg, 0, sizeof msg); + + msg.xclient.type = ClientMessage; + msg.xclient.message_type + = dpyinfo->Xatom_EMACS_TMP; + msg.xclient.format = 8; + msg.xclient.window = FRAME_X_WINDOW (f); + msg.xclient.data.b[0] = hourglass_enabled ? 1 : 0; + + XSendEvent (dpyinfo->display, FRAME_X_WINDOW (f), + False, NoEventMask, &msg); +} + /* RIF: Show hourglass cursor on frame F. */ static void @@ -11025,14 +11050,14 @@ x_show_hourglass (struct frame *f) if (popup_activated ()) return; + x_send_hourglass_message (f, true); + #ifdef USE_X_TOOLKIT if (x->widget) #else if (FRAME_OUTER_WINDOW (f)) #endif { - x->hourglass_p = true; - if (!x->hourglass_window) { #ifndef USE_XCB @@ -11099,15 +11124,11 @@ x_hide_hourglass (struct frame *f) { #ifndef USE_XCB XUnmapWindow (FRAME_X_DISPLAY (f), x->hourglass_window); - /* Sync here because XTread_socket looks at the - hourglass_p flag that is reset to zero below. */ - XSync (FRAME_X_DISPLAY (f), False); #else xcb_unmap_window (FRAME_DISPLAY_INFO (f)->xcb_connection, (xcb_window_t) x->hourglass_window); - xcb_aux_sync (FRAME_DISPLAY_INFO (f)->xcb_connection); #endif - x->hourglass_p = false; + x_send_hourglass_message (f, false); } } @@ -18620,6 +18641,16 @@ handle_one_xevent (struct x_display_info *dpyinfo, } } + if (event->xclient.message_type == dpyinfo->Xatom_EMACS_TMP + && event->xclient.format == 8) + { + /* This is actually an hourglass message. Set whether or + not events from here on have the hourglass enabled. */ + + if (any) + FRAME_X_OUTPUT (any)->hourglass_p = event->xclient.data.b[0]; + } + if (event->xclient.message_type == dpyinfo->Xatom_wm_protocols && event->xclient.format == 32) { @@ -28273,7 +28304,7 @@ x_make_frame_invisible (struct frame *f) error ("Can't notify window manager of window withdrawal"); } - x_sync (f); + XSync (FRAME_X_DISPLAY (f), False); /* We can't distinguish this from iconification just by the event that we get from the server.