From: Po Lu Date: Fri, 13 May 2022 07:30:22 +0000 (+0800) Subject: Fix extraneous quit events processing GTK native input inside popups X-Git-Tag: emacs-29.0.90~1910^2~743 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=85ac627ef4096a2d303f1d37c45da05dea1b7781;p=emacs.git Fix extraneous quit events processing GTK native input inside popups * src/gtkutil.c (xg_widget_key_press_event_cb): Return immediately if a popup is active. * src/xterm.c (x_filter_event): Clear `xg_pending_quit_event' if a popup is active. --- diff --git a/src/gtkutil.c b/src/gtkutil.c index a2ab01d02c5..11ccbbd6683 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c @@ -6395,6 +6395,9 @@ xg_widget_key_press_event_cb (GtkWidget *widget, GdkEvent *event, if (!f) return true; + if (popup_activated ()) + return true; + #ifdef HAVE_XINPUT2 pending_keystroke_time = FRAME_DISPLAY_INFO (f)->pending_keystroke_time; diff --git a/src/xterm.c b/src/xterm.c index 7a570de921f..170f65d06f6 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -14014,6 +14014,13 @@ x_filter_event (struct x_display_info *dpyinfo, XEvent *event) result = xg_filter_key (f1, event); unblock_input (); + /* Clear `xg_pending_quit_event' so we don't end up reacting to quit + events sent outside the main event loop (i.e. those sent from + inside a popup menu event loop). */ + + if (popup_activated ()) + xg_pending_quit_event.kind = NO_EVENT; + if (result && f1) /* There will probably be a GDK event generated soon, so exercise the wire to make pselect return. */