commit ca8f4ebc492c470ec041e11f5d5b005c6d0d44e6 (HEAD, refs/remotes/origin/master) Merge: 86969f9658 225e0d6047 Author: Stefan Kangas Date: Thu Mar 3 06:30:34 2022 +0100 Merge from origin/emacs-28 225e0d6047 Correct etc/NEWS entry about bitmapped fonts # Conflicts: # etc/NEWS commit 86969f9658e278ebacb3d625d0309046ff1f2b54 Author: Dmitry Gutov Date: Thu Mar 3 05:23:26 2022 +0200 Cache the backend value together with the project root * lisp/progmodes/project.el (project-try-vc): Cache the backend value together with the root. (project-root, project-files, project-ignores): Update to access the new data structure. diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el index 4d6b93ceb5..b44f4618be 100644 --- a/lisp/progmodes/project.el +++ b/lisp/progmodes/project.el @@ -418,30 +418,33 @@ The directory names should be absolute. Used in the VC project backend implementation of `project-external-roots'.") (defun project-try-vc (dir) - (let* ((backend - ;; FIXME: This is slow. Cache it. - (ignore-errors (vc-responsible-backend dir))) - (root - (pcase backend - ('Git - ;; Don't stop at submodule boundary. - ;; FIXME: Cache for a shorter time. - (or (vc-file-getprop dir 'project-git-root) - (let ((root (vc-call-backend backend 'root dir))) - (vc-file-setprop - dir 'project-git-root - (if (and - ;; FIXME: Invalidate the cache when the value - ;; of this variable changes. - (project--vc-merge-submodules-p root) - (project--submodule-p root)) - (let* ((parent (file-name-directory - (directory-file-name root)))) - (vc-call-backend backend 'root parent)) - root))))) - ('nil nil) - (_ (ignore-errors (vc-call-backend backend 'root dir)))))) - (and root (cons 'vc root)))) + (or (vc-file-getprop dir 'project-vc) + (let* ((backend (ignore-errors (vc-responsible-backend dir))) + (root + (pcase backend + ('Git + ;; Don't stop at submodule boundary. + (or (vc-file-getprop dir 'project-git-root) + (let ((root (vc-call-backend backend 'root dir))) + (vc-file-setprop + dir 'project-git-root + (if (and + ;; FIXME: Invalidate the cache when the value + ;; of this variable changes. + (project--vc-merge-submodules-p root) + (project--submodule-p root)) + (let* ((parent (file-name-directory + (directory-file-name root)))) + (vc-call-backend backend 'root parent)) + root))))) + ('nil nil) + (_ (ignore-errors (vc-call-backend backend 'root dir))))) + project) + (when root + (setq project (list 'vc backend root)) + ;; FIXME: Cache for a shorter time. + (vc-file-setprop dir 'project-vc project) + project)))) (defun project--submodule-p (root) ;; XXX: We only support Git submodules for now. @@ -467,7 +470,7 @@ backend implementation of `project-external-roots'.") (t nil)))) (cl-defmethod project-root ((project (head vc))) - (cdr project)) + (nth 2 project)) (cl-defmethod project-external-roots ((project (head vc))) (project-subtract-directories @@ -482,8 +485,8 @@ backend implementation of `project-external-roots'.") (lambda (dir) (let ((ignores (project--value-in-dir 'project-vc-ignores dir)) backend) - (if (and (file-equal-p dir (cdr project)) - (setq backend (vc-responsible-backend dir)) + (if (and (file-equal-p dir (nth 2 project)) + (setq backend (cadr project)) (cond ((eq backend 'Hg)) ((and (eq backend 'Git) @@ -595,11 +598,11 @@ backend implementation of `project-external-roots'.") (file-missing nil))) (cl-defmethod project-ignores ((project (head vc)) dir) - (let* ((root (cdr project)) + (let* ((root (nth 2 project)) backend) (append (when (file-equal-p dir root) - (setq backend (vc-responsible-backend root)) + (setq backend (cadr project)) (delq nil (mapcar commit d845ccb7cfeeffc68fe49276d5cd16b0dfac64a2 Author: Po Lu Date: Thu Mar 3 11:39:55 2022 +0800 * src/xterm.c: Fix commentary on GTK client side windows. diff --git a/src/xterm.c b/src/xterm.c index 6489a18f90..b6c200a27a 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -309,12 +309,12 @@ along with GNU Emacs. If not, see . */ to X windows, since the toolkit might decide to keep only a client-side record of the widgets for performance reasons. - Because the GtkFixed widget that holds the "edit area" never - corresponds to an X window, drawing operations are directly + Because the GtkFixed widget that holds the "edit area" might not + correspond to an X window, drawing operations may be directly performed on the outer window, with special care taken to not overwrite the surrounding GTK widgets. This also means that the only important window for most purposes is the outer window, which - on GTK builds can also be accessed using the macro + on GTK builds can usually be accessed using the macro `FRAME_X_WINDOW'. How `handle_one_xevent' is called also depends on the configuration. commit 39aac09940fa3710302819f9395fe83aa9a5f708 Author: Po Lu Date: Thu Mar 3 11:16:25 2022 +0800 Fix Motif build without toolkit scroll bars * src/xterm.c: Always include Xm.h on Motif. diff --git a/src/xterm.c b/src/xterm.c index 47f9d31ad4..6489a18f90 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -597,13 +597,15 @@ along with GNU Emacs. If not, see . */ #include #endif +#ifdef USE_MOTIF +#include +#endif + #ifdef USE_X_TOOLKIT /* Include toolkit specific headers for the scroll bar widget. */ - #ifdef USE_TOOLKIT_SCROLL_BARS #if defined USE_MOTIF -#include /* For LESSTIF_VERSION */ #include #else /* !USE_MOTIF i.e. use Xaw */ commit 890b08e41580a716c2f0b3f1a40ef9b52a19372c Author: Dmitry Gutov Date: Thu Mar 3 04:55:05 2022 +0200 * lisp/progmodes/xref.el: Bump the version. diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el index 96c1609b34..a5e6edf951 100644 --- a/lisp/progmodes/xref.el +++ b/lisp/progmodes/xref.el @@ -1,7 +1,7 @@ ;;; xref.el --- Cross-referencing commands -*-lexical-binding:t-*- ;; Copyright (C) 2014-2022 Free Software Foundation, Inc. -;; Version: 1.4.0 +;; Version: 1.4.1 ;; Package-Requires: ((emacs "26.1")) ;; This is a GNU ELPA :core package. Avoid functionality that is not commit b727d6ebeb45ef4e9e7098a1e67949774009ec95 Author: Po Lu Date: Thu Mar 3 10:49:55 2022 +0800 Don't calculate any frame for extension events * src/xterm.c (handle_one_xevent): If event is not a core event, don't try to calculate any from event.xany.window. diff --git a/src/xterm.c b/src/xterm.c index 9960f4930d..47f9d31ad4 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -9794,10 +9794,10 @@ handle_one_xevent (struct x_display_info *dpyinfo, inev.ie.kind = NO_EVENT; inev.ie.arg = Qnil; -#ifdef HAVE_XKB - if (event->type != dpyinfo->xkb_event_type) + /* Ignore events coming from various extensions, such as XFIXES and + XKB. */ + if (event->type < LASTEvent) { -#endif #ifdef HAVE_XINPUT2 if (event->type != GenericEvent) #endif @@ -9806,11 +9806,9 @@ handle_one_xevent (struct x_display_info *dpyinfo, else any = NULL; #endif -#ifdef HAVE_XKB } else any = NULL; -#endif if (any && any->wait_event_type == event->type) any->wait_event_type = 0; /* Indicates we got it. */ commit 543640628607ec06e9698cc50c33497ca75155a4 Author: Po Lu Date: Thu Mar 3 09:05:00 2022 +0800 Implement `toolkit_position_hook' on PGTK * src/pgtkterm.c (pgtk_toolkit_position): New function. (pgtk_create_terminal): Set it as the toolkit position hook. diff --git a/src/pgtkterm.c b/src/pgtkterm.c index 84e20235fd..7855b7053a 100644 --- a/src/pgtkterm.c +++ b/src/pgtkterm.c @@ -105,7 +105,35 @@ static void pgtk_fill_rectangle (struct frame *f, unsigned long color, int x, bool respect_alpha_background); static void pgtk_clip_to_row (struct window *w, struct glyph_row *row, enum glyph_row_area area, cairo_t * cr); -static struct frame *pgtk_any_window_to_frame (GdkWindow * window); +static struct frame *pgtk_any_window_to_frame (GdkWindow *window); + +static void +pgtk_toolkit_position (struct frame *f, int x, int y, + bool *menu_bar_p, bool *tool_bar_p) +{ + GdkRectangle test_rect; + int scale; + + y += (FRAME_MENUBAR_HEIGHT (f) + + FRAME_TOOLBAR_TOP_HEIGHT (f)); + x += FRAME_TOOLBAR_LEFT_WIDTH (f); + + if (FRAME_EXTERNAL_MENU_BAR (f)) + *menu_bar_p = (x >= 0 && x < FRAME_PIXEL_WIDTH (f) + && y >= 0 && y < FRAME_MENUBAR_HEIGHT (f)); + + if (FRAME_X_OUTPUT (f)->toolbar_widget) + { + scale = xg_get_scale (f); + test_rect.x = x / scale; + test_rect.y = y / scale; + test_rect.width = 1; + test_rect.height = 1; + + *tool_bar_p = gtk_widget_intersect (FRAME_X_OUTPUT (f)->toolbar_widget, + &test_rect, NULL); + } +} /* * This is not a flip context in the same sense as gpu rendering @@ -4808,6 +4836,7 @@ pgtk_create_terminal (struct pgtk_display_info *dpyinfo) terminal->focus_frame_hook = pgtk_focus_frame; terminal->set_frame_offset_hook = x_set_offset; terminal->free_pixmap = pgtk_free_pixmap; + terminal->toolkit_position_hook = pgtk_toolkit_position; /* Other hooks are NULL by default. */ commit 8c8093aa6f20a7a4f3799cbdb9270cac013ef71d Author: Po Lu Date: Wed Mar 2 19:16:53 2022 +0800 ; * src/termhooks.h (struct terminal): Fix typo in comment. diff --git a/src/termhooks.h b/src/termhooks.h index 8fb4837ee5..93ac9ba0d2 100644 --- a/src/termhooks.h +++ b/src/termhooks.h @@ -835,8 +835,8 @@ struct terminal /* Called to determine whether a position is on the toolkit tool bar or menu bar. May be NULL. It should accept five arguments FRAME, X, Y, MENU_BAR_P, TOOL_BAR_P, and store true into - `menu_bar_p' if X and Y are in FRAME's toolkit menu bar, and true - into `tool_bar_p` if X and Y are in FRAME's toolkit tool bar. */ + MENU_BAR_P if X and Y are in FRAME's toolkit menu bar, and true + into TOOL_BAR_P if X and Y are in FRAME's toolkit tool bar. */ void (*toolkit_position_hook) (struct frame *, int, int, bool *, bool *); } GCALIGNED_STRUCT; commit 596d36f8cfd2c24df33668349cafbbf8a5ba1396 Author: Po Lu Date: Wed Mar 2 11:10:00 2022 +0000 Fix menu bar position reporting on Haiku as well * src/haikuterm.c (haiku_toolkit_position): New function. (haiku_create_terminal): Register new hook. diff --git a/src/haikuterm.c b/src/haikuterm.c index a765eb715d..bdba6403ac 100644 --- a/src/haikuterm.c +++ b/src/haikuterm.c @@ -100,6 +100,15 @@ haiku_coords_from_parent (struct frame *f, int *x, int *y) } } +static void +haiku_toolkit_position (struct frame *f, int x, int y, + bool *menu_bar_p, bool *tool_bar_p) +{ + if (FRAME_OUTPUT_DATA (f)->menubar) + *menu_bar_p = (x >= 0 && x < FRAME_PIXEL_WIDTH (f) + && y >= 0 && y < FRAME_MENU_BAR_HEIGHT (f)); +} + static void haiku_delete_terminal (struct terminal *terminal) { @@ -3728,6 +3737,7 @@ haiku_create_terminal (struct haiku_display_info *dpyinfo) terminal->menu_show_hook = haiku_menu_show; terminal->toggle_invisible_pointer_hook = haiku_toggle_invisible_pointer; terminal->fullscreen_hook = haiku_fullscreen; + terminal->toolkit_position_hook = haiku_toolkit_position; return terminal; } commit 68e293c81d8ef687500969461067dc774353968f Author: Po Lu Date: Wed Mar 2 19:00:21 2022 +0800 Fix reporting of imaginary key prefixes on toolkit tool and menu bars * src/keyboard.c (make_lispy_position): Set imaginary prefix if the terminal says what widget the position is on top of. * src/termhooks.h (struct terminal): New field `toolkit_position_hook'. * src/xterm.c (x_toolkit_position): New function. (x_create_terminal): Register hook. diff --git a/src/keyboard.c b/src/keyboard.c index da8c6c54d8..218f9a86c8 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -5247,6 +5247,8 @@ make_lispy_position (struct frame *f, Lisp_Object x, Lisp_Object y, Lisp_Object window_or_frame = f ? window_from_coordinates (f, mx, my, &part, true, true) : Qnil; + bool tool_bar_p = false; + bool menu_bar_p = false; /* Report mouse events on the tab bar and (on GUI frames) on the tool bar. */ @@ -5280,6 +5282,20 @@ make_lispy_position (struct frame *f, Lisp_Object x, Lisp_Object y, coordinates. FIXME! */ window_or_frame = Qnil; } + + if (FRAME_TERMINAL (f)->toolkit_position_hook) + { + FRAME_TERMINAL (f)->toolkit_position_hook (f, mx, my, &menu_bar_p, + &tool_bar_p); + + if (NILP (track_mouse) || EQ (track_mouse, Qt)) + { + if (menu_bar_p) + posn = Qmenu_bar; + else if (tool_bar_p) + posn = Qtool_bar; + } + } #endif if (f && !FRAME_WINDOW_P (f) diff --git a/src/termhooks.h b/src/termhooks.h index b7696fed4f..8fb4837ee5 100644 --- a/src/termhooks.h +++ b/src/termhooks.h @@ -831,6 +831,13 @@ struct terminal frames on the terminal when it calls this hook, so infinite recursion is prevented. */ void (*delete_terminal_hook) (struct terminal *); + + /* Called to determine whether a position is on the toolkit tool bar + or menu bar. May be NULL. It should accept five arguments + FRAME, X, Y, MENU_BAR_P, TOOL_BAR_P, and store true into + `menu_bar_p' if X and Y are in FRAME's toolkit menu bar, and true + into `tool_bar_p` if X and Y are in FRAME's toolkit tool bar. */ + void (*toolkit_position_hook) (struct frame *, int, int, bool *, bool *); } GCALIGNED_STRUCT; INLINE bool diff --git a/src/xterm.c b/src/xterm.c index 3f69300417..9960f4930d 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -854,6 +854,41 @@ record_event (char *locus, int type) #endif +#if defined USE_X_TOOLKIT || USE_GTK +static void +x_toolkit_position (struct frame *f, int x, int y, + bool *menu_bar_p, bool *tool_bar_p) +{ +#ifdef USE_GTK + GdkRectangle test_rect; + int scale; + + y += (FRAME_MENUBAR_HEIGHT (f) + + FRAME_TOOLBAR_TOP_HEIGHT (f)); + x += FRAME_TOOLBAR_LEFT_WIDTH (f); + + if (FRAME_EXTERNAL_MENU_BAR (f)) + *menu_bar_p = (x >= 0 && x < FRAME_PIXEL_WIDTH (f) + && y >= 0 && y < FRAME_MENUBAR_HEIGHT (f)); + + if (FRAME_X_OUTPUT (f)->toolbar_widget) + { + scale = xg_get_scale (f); + test_rect.x = x / scale; + test_rect.y = y / scale; + test_rect.width = 1; + test_rect.height = 1; + + *tool_bar_p = gtk_widget_intersect (FRAME_X_OUTPUT (f)->toolbar_widget, + &test_rect, NULL); + } +#else + *menu_bar_p = (x > 0 && x < FRAME_PIXEL_WIDTH (f) + && (y < 0 && y >= -FRAME_MENUBAR_HEIGHT (f))); +#endif +} +#endif + static void x_update_opaque_region (struct frame *f, XEvent *configure) { @@ -17820,6 +17855,9 @@ x_create_terminal (struct x_display_info *dpyinfo) terminal->free_pixmap = x_free_pixmap; terminal->delete_frame_hook = x_destroy_window; terminal->delete_terminal_hook = x_delete_terminal; +#if defined USE_X_TOOLKIT || defined USE_GTK + terminal->toolkit_position_hook = x_toolkit_position; +#endif /* Other hooks are NULL by default. */ return terminal; commit 225e0d6047de9576ee48ce612fcd561f818195aa (refs/remotes/origin/emacs-28) Author: Po Lu Date: Wed Mar 2 09:22:18 2022 +0100 Correct etc/NEWS entry about bitmapped fonts * etc/NEWS: Don't say that bitmap font issues are due to Pango, that's not accurate. diff --git a/etc/NEWS b/etc/NEWS index 58c7c44a2b..84041d79c2 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -43,11 +43,10 @@ recommend examining any such warnings before you decide they are false. ** The Cairo graphics library is now used by default if present. -'--with-cairo' is now the default, if the appropriate development files -are found by 'configure'. Note that building with Cairo means using -Pango instead of libXFT for font support. Since Pango 1.44 has -removed support for bitmapped fonts, this may require you to adjust -your font settings. +'--with-cairo' is now the default, if the appropriate development +files are found by 'configure'. Building with Cairo is known to cause +some problems with bitmap fonts. This may require you to adjust your +font settings, or to build with Xft support instead. Note also that 'FontBackend' settings in ".Xdefaults" or ".Xresources", or 'font-backend' frame parameter settings in your init