From: Alan Mackenzie <acm@muc.de> Date: Thu, 7 Jul 2022 15:38:09 +0000 (+0000) Subject: Remove obscure, obsolete code from do_switch_frame X-Git-Tag: emacs-29.0.90~1447^2~1112 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=9cd72b02b67e92e89b83791b66fe40c4b50d8357;p=emacs.git Remove obscure, obsolete code from do_switch_frame This is relevant for bug #56305, and might solve that bug. The code being removed went into Emacs between 1992 and 1994, and looks to have been a workaround for switching frames, before the command 'other-frame' had been written. Nowadays, that code has harmful effects, causing frames' focus to be redirected at random, sometimes back to the frame itself. * src/frame.c (do_switch_frame): Remove 53 lines of code. --- diff --git a/src/frame.c b/src/frame.c index 02c90ea6519..4828595b935 100644 --- a/src/frame.c +++ b/src/frame.c @@ -1477,59 +1477,6 @@ do_switch_frame (Lisp_Object frame, int track, int for_deletion, Lisp_Object nor else if (f == sf) return frame; - /* If a frame's focus has been redirected toward the currently - selected frame, we should change the redirection to point to the - newly selected frame. This means that if the focus is redirected - from a minibufferless frame to a surrogate minibuffer frame, we - can use `other-window' to switch between all the frames using - that minibuffer frame, and the focus redirection will follow us - around. */ -#if 0 - /* This is too greedy; it causes inappropriate focus redirection - that's hard to get rid of. */ - if (track) - { - Lisp_Object tail; - - for (tail = Vframe_list; CONSP (tail); tail = XCDR (tail)) - { - Lisp_Object focus; - - if (!FRAMEP (XCAR (tail))) - emacs_abort (); - - focus = FRAME_FOCUS_FRAME (XFRAME (XCAR (tail))); - - if (FRAMEP (focus) && XFRAME (focus) == SELECTED_FRAME ()) - Fredirect_frame_focus (XCAR (tail), frame); - } - } -#else /* ! 0 */ - /* Instead, apply it only to the frame we're pointing to. */ -#ifdef HAVE_WINDOW_SYSTEM - if (track && FRAME_WINDOW_P (f) && FRAME_TERMINAL (f)->get_focus_frame) - { - Lisp_Object focus, gfocus; - - gfocus = FRAME_TERMINAL (f)->get_focus_frame (f); - if (FRAMEP (gfocus)) - { - focus = FRAME_FOCUS_FRAME (XFRAME (gfocus)); - if (FRAMEP (focus) && XFRAME (focus) == SELECTED_FRAME ()) - /* Redirect frame focus also when FRAME has its minibuffer - window on the selected frame (see Bug#24500). - - Don't do that: It causes redirection problem with a - separate minibuffer frame (Bug#24803) and problems - when updating the cursor on such frames. - || (NILP (focus) - && EQ (FRAME_MINIBUF_WINDOW (f), sf->selected_window))) */ - Fredirect_frame_focus (gfocus, frame); - } - } -#endif /* HAVE_X_WINDOWS */ -#endif /* ! 0 */ - if (!for_deletion && FRAME_HAS_MINIBUF_P (sf)) resize_mini_window (XWINDOW (FRAME_MINIBUF_WINDOW (sf)), 1);