aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAlan Mackenzie2022-05-20 20:18:38 +0000
committerAlan Mackenzie2022-05-20 20:18:38 +0000
commitdfa3e6f424b20fe27d9041b2ce7d69811df5d8cd (patch)
tree38c5c3805d73a53f58883ca6cd25e7e3b80d7fdd /src
parentde35e9728f3d821e280b5c97c66f1ba8991cd700 (diff)
downloademacs-dfa3e6f424b20fe27d9041b2ce7d69811df5d8cd.tar.gz
emacs-dfa3e6f424b20fe27d9041b2ce7d69811df5d8cd.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/frame.c7
-rw-r--r--src/frame.h1
-rw-r--r--src/minibuf.c10
-rw-r--r--src/xdisp.c3
4 files changed, 11 insertions, 10 deletions
diff --git a/src/frame.c b/src/frame.c
index ccac18d23c2..dc8045f41e6 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -1564,6 +1564,13 @@ do_switch_frame (Lisp_Object frame, int track, int for_deletion, Lisp_Object nor
1564 if (! FRAME_MINIBUF_ONLY_P (XFRAME (selected_frame))) 1564 if (! FRAME_MINIBUF_ONLY_P (XFRAME (selected_frame)))
1565 last_nonminibuf_frame = XFRAME (selected_frame); 1565 last_nonminibuf_frame = XFRAME (selected_frame);
1566 1566
1567 /* If the selected window in the target frame is its mini-window, we move
1568 to a different window, the most recently used one, unless there is a
1569 valid active minibuffer in the mini-window. */
1570 if (EQ (f->selected_window, f->minibuffer_window)
1571 && NILP (Fminibufferp (XWINDOW (f->minibuffer_window)->contents, Qt)))
1572 Fset_frame_selected_window (frame, call1 (Qget_mru_window, frame), Qnil);
1573
1567 Fselect_window (f->selected_window, norecord); 1574 Fselect_window (f->selected_window, norecord);
1568 1575
1569 /* We want to make sure that the next event generates a frame-switch 1576 /* We want to make sure that the next event generates a frame-switch
diff --git a/src/frame.h b/src/frame.h
index 0b8cdf62ded..cc0dae8f5ab 100644
--- a/src/frame.h
+++ b/src/frame.h
@@ -123,6 +123,7 @@ struct frame
123 /* This frame's selected window. 123 /* This frame's selected window.
124 Each frame has its own window hierarchy 124 Each frame has its own window hierarchy
125 and one of the windows in it is selected within the frame. 125 and one of the windows in it is selected within the frame.
126 This window may be the mini-window of the frame, if any.
126 The selected window of the selected frame is Emacs's selected window. */ 127 The selected window of the selected frame is Emacs's selected window. */
127 Lisp_Object selected_window; 128 Lisp_Object selected_window;
128 129
diff --git a/src/minibuf.c b/src/minibuf.c
index 847e7be5ad4..0fc7f2caa15 100644
--- a/src/minibuf.c
+++ b/src/minibuf.c
@@ -197,20 +197,12 @@ move_minibuffers_onto_frame (struct frame *of, bool for_deletion)
197 return; 197 return;
198 if (FRAME_LIVE_P (f) 198 if (FRAME_LIVE_P (f)
199 && !EQ (f->minibuffer_window, of->minibuffer_window) 199 && !EQ (f->minibuffer_window, of->minibuffer_window)
200 && WINDOW_LIVE_P (f->minibuffer_window) /* F not a tootip frame */ 200 && WINDOW_LIVE_P (f->minibuffer_window) /* F not a tooltip frame */
201 && WINDOW_LIVE_P (of->minibuffer_window)) 201 && WINDOW_LIVE_P (of->minibuffer_window))
202 { 202 {
203 zip_minibuffer_stacks (f->minibuffer_window, of->minibuffer_window); 203 zip_minibuffer_stacks (f->minibuffer_window, of->minibuffer_window);
204 if (for_deletion && XFRAME (MB_frame) != of) 204 if (for_deletion && XFRAME (MB_frame) != of)
205 MB_frame = selected_frame; 205 MB_frame = selected_frame;
206 if (!for_deletion
207 && MINI_WINDOW_P (XWINDOW (FRAME_SELECTED_WINDOW (of))))
208 {
209 Lisp_Object old_frame;
210 XSETFRAME (old_frame, of);
211 Fset_frame_selected_window (old_frame,
212 Fframe_first_window (old_frame), Qnil);
213 }
214 } 206 }
215} 207}
216 208
diff --git a/src/xdisp.c b/src/xdisp.c
index 6963935666b..9740e6b590e 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -12796,8 +12796,9 @@ gui_consider_frame_title (Lisp_Object frame)
12796 mode_line_noprop_buf; then display the title. */ 12796 mode_line_noprop_buf; then display the title. */
12797 record_unwind_protect (unwind_format_mode_line, 12797 record_unwind_protect (unwind_format_mode_line,
12798 format_mode_line_unwind_data 12798 format_mode_line_unwind_data
12799 (NULL, current_buffer, Qnil, false)); 12799 (f, current_buffer, selected_window, false));
12800 12800
12801 Fselect_window (f->selected_window, Qt);
12801 set_buffer_internal_1 12802 set_buffer_internal_1
12802 (XBUFFER (XWINDOW (f->selected_window)->contents)); 12803 (XBUFFER (XWINDOW (f->selected_window)->contents));
12803 fmt = FRAME_ICONIFIED_P (f) ? Vicon_title_format : Vframe_title_format; 12804 fmt = FRAME_ICONIFIED_P (f) ? Vicon_title_format : Vframe_title_format;