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
/* 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;
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);
- }
}
}
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;