From: Po Lu Date: Sat, 22 Oct 2022 12:15:22 +0000 (+0800) Subject: Further fixes to menu event processing on no-toolkit builds X-Git-Tag: emacs-29.0.90~1616^2~503 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=f85bdb49923a60d3d0cc3bf66ad884555d92840c;p=emacs.git Further fixes to menu event processing on no-toolkit builds * src/xdisp.c (note_mouse_highlight): Return if a popup is activated under the no-toolkit build as well. * src/xmenu.c (pop_down_menu): Clear popup_activated_flag when not on MS-DOS. (x_menu_show): Set popup_activated_flag under X. --- diff --git a/src/xdisp.c b/src/xdisp.c index e390de6a336..1f7ac269e4e 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -34912,7 +34912,7 @@ note_mouse_highlight (struct frame *f, int x, int y) struct buffer *b; /* When a menu is active, don't highlight because this looks odd. */ -#if defined (USE_X_TOOLKIT) || (defined (USE_GTK) && !defined (HAVE_PGTK)) || defined (HAVE_NS) || defined (MSDOS) +#if defined (HAVE_X_WINDOWS) || defined (HAVE_NS) || defined (MSDOS) if (popup_activated ()) return; #endif diff --git a/src/xmenu.c b/src/xmenu.c index d9660a6910f..756842c2fef 100644 --- a/src/xmenu.c +++ b/src/xmenu.c @@ -2540,6 +2540,8 @@ pop_down_menu (void *arg) } #endif + /* Decrement the popup_activated_flag. */ + popup_activated_flag = 0; #endif /* HAVE_X_WINDOWS */ unblock_input (); @@ -2791,6 +2793,12 @@ x_menu_show (struct frame *f, int x, int y, int menuflags, } #endif +#ifdef HAVE_X_WINDOWS + /* Increment the popup flag; this prevents nested popups from being + displayed by user Lisp code in help-echo callbacks, and also + prevents mouse face from being displayed. */ + popup_activated_flag = 1; +#endif status = XMenuActivate (FRAME_X_DISPLAY (f), menu, &pane, &selidx, x, y, ButtonReleaseMask, &datap, menu_help_callback);