emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

emacs-28 dfa3e6f424: Restore the Fselect_window call in gui_consider_fra


From: Alan Mackenzie
Subject: emacs-28 dfa3e6f424: Restore the Fselect_window call in gui_consider_frame_title.
Date: Fri, 20 May 2022 16:23:18 -0400 (EDT)

branch: emacs-28
commit dfa3e6f424b20fe27d9041b2ce7d69811df5d8cd
Author: Alan Mackenzie <acm@muc.de>
Commit: Alan Mackenzie <acm@muc.de>

    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.
---
 src/frame.c   |  7 +++++++
 src/frame.h   |  1 +
 src/minibuf.c | 10 +---------
 src/xdisp.c   |  3 ++-
 4 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/src/frame.c b/src/frame.c
index ccac18d23c..dc8045f41e 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
   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
diff --git a/src/frame.h b/src/frame.h
index 0b8cdf62de..cc0dae8f5a 100644
--- a/src/frame.h
+++ b/src/frame.h
@@ -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;
 
diff --git a/src/minibuf.c b/src/minibuf.c
index 847e7be5ad..0fc7f2caa1 100644
--- a/src/minibuf.c
+++ b/src/minibuf.c
@@ -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);
-       }
     }
 }
 
diff --git a/src/xdisp.c b/src/xdisp.c
index 6963935666..9740e6b590 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -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;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]