Restore the Fselect_window call in gui_consider_frame_title.

This fixes bug #55412.  The call to Fselect_window was removed on 2021-03-21
in the commit "Prevent open minibuffers getting lost when their frame gets
deleted".  This call is actually needed to determine current elements of the
pertinent window and frame when these are used in the frame title.

* src/frame.c (do_switch_frame): When the selected window in the target frame
is the mini-window, switch away from this window unless there is a valid
minibuffer there.

* src/frame.h (struct frame): Add an incidental comment about the element
selected_window.

* src/minibuf.c (move_minibuffers_onto_frame): No longer set the selected
window of the source frame.  This action is now performed later, on returning
to that frame, in do_switch_frame when needed (see above).

* src/xdisp.c (gui_consider_frame_title): Replace the Fselect_window call and
associated ancillary settings.
This commit is contained in:
Alan Mackenzie 2022-05-20 20:18:38 +00:00
parent de35e9728f
commit dfa3e6f424
4 changed files with 11 additions and 10 deletions

View file

@ -1564,6 +1564,13 @@ do_switch_frame (Lisp_Object frame, int track, int for_deletion, Lisp_Object nor
if (! FRAME_MINIBUF_ONLY_P (XFRAME (selected_frame)))
last_nonminibuf_frame = XFRAME (selected_frame);
/* If the selected window in the target frame is its mini-window, we move
to a different window, the most recently used one, unless there is a
valid active minibuffer in the mini-window. */
if (EQ (f->selected_window, f->minibuffer_window)
&& NILP (Fminibufferp (XWINDOW (f->minibuffer_window)->contents, Qt)))
Fset_frame_selected_window (frame, call1 (Qget_mru_window, frame), Qnil);
Fselect_window (f->selected_window, norecord);
/* We want to make sure that the next event generates a frame-switch

View file

@ -123,6 +123,7 @@ struct frame
/* This frame's selected window.
Each frame has its own window hierarchy
and one of the windows in it is selected within the frame.
This window may be the mini-window of the frame, if any.
The selected window of the selected frame is Emacs's selected window. */
Lisp_Object selected_window;

View file

@ -197,20 +197,12 @@ move_minibuffers_onto_frame (struct frame *of, bool for_deletion)
return;
if (FRAME_LIVE_P (f)
&& !EQ (f->minibuffer_window, of->minibuffer_window)
&& WINDOW_LIVE_P (f->minibuffer_window) /* F not a tootip frame */
&& WINDOW_LIVE_P (f->minibuffer_window) /* F not a tooltip frame */
&& WINDOW_LIVE_P (of->minibuffer_window))
{
zip_minibuffer_stacks (f->minibuffer_window, of->minibuffer_window);
if (for_deletion && XFRAME (MB_frame) != of)
MB_frame = selected_frame;
if (!for_deletion
&& MINI_WINDOW_P (XWINDOW (FRAME_SELECTED_WINDOW (of))))
{
Lisp_Object old_frame;
XSETFRAME (old_frame, of);
Fset_frame_selected_window (old_frame,
Fframe_first_window (old_frame), Qnil);
}
}
}

View file

@ -12796,8 +12796,9 @@ gui_consider_frame_title (Lisp_Object frame)
mode_line_noprop_buf; then display the title. */
record_unwind_protect (unwind_format_mode_line,
format_mode_line_unwind_data
(NULL, current_buffer, Qnil, false));
(f, current_buffer, selected_window, false));
Fselect_window (f->selected_window, Qt);
set_buffer_internal_1
(XBUFFER (XWINDOW (f->selected_window)->contents));
fmt = FRAME_ICONIFIED_P (f) ? Vicon_title_format : Vframe_title_format;