aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPo Lu2024-01-14 08:26:27 +0800
committerPo Lu2024-01-14 08:28:20 +0800
commitc566ee9d06caa80c120dd8631eb3dee17e152fc9 (patch)
tree321c2a6321d58e1b7a80a69f02ab555dbbc1b1a0
parentd2c3a983146b7c0fb0f8b855268effb695d0bbf5 (diff)
downloademacs-c566ee9d06caa80c120dd8631eb3dee17e152fc9.tar.gz
emacs-c566ee9d06caa80c120dd8631eb3dee17e152fc9.zip
Fix bug#65116
* src/xterm.c (xi_focus_handle_for_device): Correct typo. (x_focus_frame): Don't focus frames Emacs believes to be focused if they are frames with independent minibuffer frames. (bug#65116)
-rw-r--r--src/xterm.c34
1 files changed, 30 insertions, 4 deletions
diff --git a/src/xterm.c b/src/xterm.c
index 77d6550c8b9..fe398171754 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -13370,13 +13370,12 @@ xi_focus_handle_for_device (struct x_display_info *dpyinfo,
13370 frame's user time. */ 13370 frame's user time. */
13371 x_display_set_last_user_time (dpyinfo, event->time, 13371 x_display_set_last_user_time (dpyinfo, event->time,
13372 event->send_event, false); 13372 event->send_event, false);
13373
13374 device->focus_frame = NULL; 13373 device->focus_frame = NULL;
13375 13374
13376 /* So, unfortunately, the X Input Extension is implemented such 13375 /* So, unfortunately, the X Input Extension is implemented such
13377 that means XI_Leave events will not have their focus field 13376 that XI_Leave events will not have their focus field set if
13378 set if the core focus is transferred to another window after 13377 the core focus is transferred to another window after an
13379 an entry event that pretends to (or really does) set the 13378 entry event that pretends to (or really does) set the
13380 implicit focus. In addition, if the core focus is set, but 13379 implicit focus. In addition, if the core focus is set, but
13381 the extension focus on the client pointer is not, all 13380 the extension focus on the client pointer is not, all
13382 XI_Enter events will have their focus fields set, despite not 13381 XI_Enter events will have their focus fields set, despite not
@@ -28805,6 +28804,33 @@ x_focus_frame (struct frame *f, bool noactivate)
28805 friends being set. */ 28804 friends being set. */
28806 block_input (); 28805 block_input ();
28807 28806
28807#ifdef HAVE_GTK3
28808 /* read_minibuf assumes that calling Fx_focus_frame on a frame that
28809 is already selected won't move the focus elsewhere, and thereby
28810 disrupt any focus redirection to e.g. a minibuffer frame that
28811 might be activated between that call being made and the
28812 consequent XI_FocusIn/Out events arriving. This is true whether
28813 the focus is ultimately transferred back to the frame it was
28814 initially on or not.
28815
28816 GTK 3 moves the keyboard focus to the edit widget's window
28817 whenever it receives a FocusIn event targeting the outer window.
28818 This operation gives rise to a FocusOut event that clears
28819 device->focus_frame, which in turn prompts xi_handle_focus_change
28820 to clear the display's focus frame. The next FocusIn event
28821 destined for the same frame registers as a new focus, which
28822 cancels any focus redirection from that frame.
28823
28824 To prevent this chain of events from disrupting focus redirection
28825 when the minibuffer is activated twice in rapid succession while
28826 configured to redirect focus to a minibuffer frame, ignore frames
28827 which hold the input focus and are connected to a minibuffer
28828 window. (bug#65116)*/
28829
28830 if (f == dpyinfo->x_focus_frame && !FRAME_HAS_MINIBUF_P (f))
28831 return;
28832#endif /* HAVE_GTK3 */
28833
28808 if (FRAME_X_EMBEDDED_P (f)) 28834 if (FRAME_X_EMBEDDED_P (f))
28809 /* For Xembedded frames, normally the embedder forwards key 28835 /* For Xembedded frames, normally the embedder forwards key
28810 events. See XEmbed Protocol Specification at 28836 events. See XEmbed Protocol Specification at