]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix setting a tty's top frame when switching frames
authorGerd Möllmann <gerd@gnu.org>
Thu, 23 Jan 2025 06:51:55 +0000 (07:51 +0100)
committerEshel Yaron <me@eshelyaron.com>
Thu, 23 Jan 2025 10:29:33 +0000 (11:29 +0100)
* src/frame.c (do_switch_frame): Compare root frames correctly.

(cherry picked from commit b1ec006e9f9196c1f993e0373b20a5ffb548bb4f)

src/frame.c

index a3d95b7538257eb57dacb2cac4819f5bb2185be4..61d6959683e4879ef5de0e2bebda02be8487df6a 100644 (file)
@@ -1773,15 +1773,19 @@ do_switch_frame (Lisp_Object frame, int track, int for_deletion, Lisp_Object nor
       struct tty_display_info *tty = FRAME_TTY (f);
       Lisp_Object top_frame = tty->top_frame;
 
-      /* Don't mark the frame garbaged if we are switching to the frame
-        that is already the top frame of that TTY.  */
-      if (!EQ (frame, top_frame) && root_frame (f) != XFRAME (top_frame))
+      /* Switching to a frame on a different root frame is special.  The
+        old root frame has to be marked invisible, and the new root
+        frame has to be made visible.  */
+      if (!EQ (frame, top_frame)
+         && (!FRAMEP (top_frame)
+             || root_frame (f) != root_frame (XFRAME (top_frame))))
        {
          struct frame *new_root = root_frame (f);
          SET_FRAME_VISIBLE (new_root, true);
          SET_FRAME_VISIBLE (f, true);
 
-         /* Mark previously displayed frame as no longer visible.  */
+         /* Mark previously displayed root frame as no longer
+            visible.  */
          if (FRAMEP (top_frame))
            {
              struct frame *top = XFRAME (top_frame);
@@ -1792,7 +1796,7 @@ do_switch_frame (Lisp_Object frame, int track, int for_deletion, Lisp_Object nor
 
          tty->top_frame = frame;
 
-         /* FIXME: Why is it correct to set FrameCols/Rows?  */
+         /* FIXME: Why is it correct to set FrameCols/Rows here?  */
          if (!FRAME_PARENT_FRAME (f))
            {
              /* If the new TTY frame changed dimensions, we need to