aboutsummaryrefslogtreecommitdiffstats
path: root/src/frame.c
diff options
context:
space:
mode:
authorChong Yidong2012-06-19 14:49:50 +0800
committerChong Yidong2012-06-19 14:49:50 +0800
commitc6bf30222430f41fbb696e296f0f63f465eefc35 (patch)
tree257eb724e088a7e5e321170ce078cc0e3efc5f6e /src/frame.c
parent4e2cc2f31f8e516901bc3cacf98def678cd45dc9 (diff)
downloademacs-c6bf30222430f41fbb696e296f0f63f465eefc35.tar.gz
emacs-c6bf30222430f41fbb696e296f0f63f465eefc35.zip
Preserve tty top-frames under various window-changing operations.
* subr.el (with-selected-window): Preserve the selected window's terminal's top-frame. * window.el (save-selected-window): Likewise. * frame.c (delete_frame): When selecting a frame on a different text terminal, do not alter the terminal's top-frame. * term.c (Ftty_top_frame): New function. * xdisp.c (format_mode_line_unwind_data): Record the target frame's selected window and its terminal's top-frame. (unwind_format_mode_line): Restore them. (x_consider_frame_title, display_mode_line, Fformat_mode_line): Callers changed. (x_consider_frame_title): Do not condition on HAVE_WINDOW_SYSTEM, since tty frames can be explicitly named. (prepare_menu_bars): Likewise. Fixes: debbugs:4702
Diffstat (limited to 'src/frame.c')
-rw-r--r--src/frame.c36
1 files changed, 20 insertions, 16 deletions
diff --git a/src/frame.c b/src/frame.c
index 39d26ded5a6..fc52b07923d 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -630,8 +630,8 @@ DEFUN ("make-terminal-frame", Fmake_terminal_frame, Smake_terminal_frame,
630 doc: /* Create an additional terminal frame, possibly on another terminal. 630 doc: /* Create an additional terminal frame, possibly on another terminal.
631This function takes one argument, an alist specifying frame parameters. 631This function takes one argument, an alist specifying frame parameters.
632 632
633You can create multiple frames on a single text-only terminal, but 633You can create multiple frames on a single text terminal, but only one
634only one of them (the selected terminal frame) is actually displayed. 634of them (the selected terminal frame) is actually displayed.
635 635
636In practice, generally you don't need to specify any parameters, 636In practice, generally you don't need to specify any parameters,
637except when you want to create a new frame on another terminal. 637except when you want to create a new frame on another terminal.
@@ -865,8 +865,8 @@ something to select a different frame, or until the next time
865this function is called. If you are using a window system, the 865this function is called. If you are using a window system, the
866previously selected frame may be restored as the selected frame 866previously selected frame may be restored as the selected frame
867when returning to the command loop, because it still may have 867when returning to the command loop, because it still may have
868the window system's input focus. On a text-only terminal, the 868the window system's input focus. On a text terminal, the next
869next redisplay will display FRAME. 869redisplay will display FRAME.
870 870
871This function returns FRAME, or nil if FRAME has been deleted. */) 871This function returns FRAME, or nil if FRAME has been deleted. */)
872 (Lisp_Object frame, Lisp_Object norecord) 872 (Lisp_Object frame, Lisp_Object norecord)
@@ -1254,7 +1254,17 @@ delete_frame (Lisp_Object frame, Lisp_Object force)
1254 FOR_EACH_FRAME (tail, frame1) 1254 FOR_EACH_FRAME (tail, frame1)
1255 { 1255 {
1256 if (! EQ (frame, frame1) && FRAME_LIVE_P (XFRAME (frame1))) 1256 if (! EQ (frame, frame1) && FRAME_LIVE_P (XFRAME (frame1)))
1257 break; 1257 {
1258 /* Do not change a text terminal's top-frame. */
1259 struct frame *f1 = XFRAME (frame1);
1260 if (FRAME_TERMCAP_P (f1) || FRAME_MSDOS_P (f1))
1261 {
1262 Lisp_Object top_frame = FRAME_TTY (f1)->top_frame;
1263 if (!EQ (top_frame, frame))
1264 frame1 = top_frame;
1265 }
1266 break;
1267 }
1258 } 1268 }
1259 } 1269 }
1260#ifdef NS_IMPL_COCOA 1270#ifdef NS_IMPL_COCOA
@@ -1730,8 +1740,8 @@ usually not displayed at all, even in a window system's \"taskbar\".
1730Normally you may not make FRAME invisible if all other frames are invisible, 1740Normally you may not make FRAME invisible if all other frames are invisible,
1731but if the second optional argument FORCE is non-nil, you may do so. 1741but if the second optional argument FORCE is non-nil, you may do so.
1732 1742
1733This function has no effect on text-only terminal frames. Such frames 1743This function has no effect on text terminal frames. Such frames are
1734are always considered visible, whether or not they are currently being 1744always considered visible, whether or not they are currently being
1735displayed in the terminal. */) 1745displayed in the terminal. */)
1736 (Lisp_Object frame, Lisp_Object force) 1746 (Lisp_Object frame, Lisp_Object force)
1737{ 1747{
@@ -1743,12 +1753,6 @@ displayed in the terminal. */)
1743 if (NILP (force) && !other_visible_frames (XFRAME (frame))) 1753 if (NILP (force) && !other_visible_frames (XFRAME (frame)))
1744 error ("Attempt to make invisible the sole visible or iconified frame"); 1754 error ("Attempt to make invisible the sole visible or iconified frame");
1745 1755
1746#if 0 /* This isn't logically necessary, and it can do GC. */
1747 /* Don't let the frame remain selected. */
1748 if (EQ (frame, selected_frame))
1749 do_switch_frame (next_frame (frame, Qt), 0, 0, Qnil)
1750#endif
1751
1752 /* Don't allow minibuf_window to remain on a deleted frame. */ 1756 /* Don't allow minibuf_window to remain on a deleted frame. */
1753 if (EQ (XFRAME (frame)->minibuffer_window, minibuf_window)) 1757 if (EQ (XFRAME (frame)->minibuffer_window, minibuf_window))
1754 { 1758 {
@@ -1816,7 +1820,7 @@ Return nil if FRAME was made invisible, via `make-frame-invisible'.
1816On graphical displays, invisible frames are not updated and are 1820On graphical displays, invisible frames are not updated and are
1817usually not displayed at all, even in a window system's \"taskbar\". 1821usually not displayed at all, even in a window system's \"taskbar\".
1818 1822
1819If FRAME is a text-only terminal frame, this always returns t. 1823If FRAME is a text terminal frame, this always returns t.
1820Such frames are always considered visible, whether or not they are 1824Such frames are always considered visible, whether or not they are
1821currently being displayed on the terminal. */) 1825currently being displayed on the terminal. */)
1822 (Lisp_Object frame) 1826 (Lisp_Object frame)
@@ -1872,7 +1876,7 @@ doesn't support multiple overlapping frames, this function selects FRAME. */)
1872 f = XFRAME (frame); 1876 f = XFRAME (frame);
1873 1877
1874 if (FRAME_TERMCAP_P (f)) 1878 if (FRAME_TERMCAP_P (f))
1875 /* On a text-only terminal select FRAME. */ 1879 /* On a text terminal select FRAME. */
1876 Fselect_frame (frame, Qnil); 1880 Fselect_frame (frame, Qnil);
1877 else 1881 else
1878 /* Do like the documentation says. */ 1882 /* Do like the documentation says. */
@@ -2493,7 +2497,7 @@ not the menu bar).
2493In a graphical version with no toolkit, it includes both the tool bar 2497In a graphical version with no toolkit, it includes both the tool bar
2494and menu bar. 2498and menu bar.
2495 2499
2496For a text-only terminal, it includes the menu bar. In this case, the 2500For a text terminal, it includes the menu bar. In this case, the
2497result is really in characters rather than pixels (i.e., is identical 2501result is really in characters rather than pixels (i.e., is identical
2498to `frame-height'). */) 2502to `frame-height'). */)
2499 (Lisp_Object frame) 2503 (Lisp_Object frame)