diff options
| author | Chong Yidong | 2012-06-19 14:49:50 +0800 |
|---|---|---|
| committer | Chong Yidong | 2012-06-19 14:49:50 +0800 |
| commit | c6bf30222430f41fbb696e296f0f63f465eefc35 (patch) | |
| tree | 257eb724e088a7e5e321170ce078cc0e3efc5f6e /src/frame.c | |
| parent | 4e2cc2f31f8e516901bc3cacf98def678cd45dc9 (diff) | |
| download | emacs-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.c | 36 |
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. |
| 631 | This function takes one argument, an alist specifying frame parameters. | 631 | This function takes one argument, an alist specifying frame parameters. |
| 632 | 632 | ||
| 633 | You can create multiple frames on a single text-only terminal, but | 633 | You can create multiple frames on a single text terminal, but only one |
| 634 | only one of them (the selected terminal frame) is actually displayed. | 634 | of them (the selected terminal frame) is actually displayed. |
| 635 | 635 | ||
| 636 | In practice, generally you don't need to specify any parameters, | 636 | In practice, generally you don't need to specify any parameters, |
| 637 | except when you want to create a new frame on another terminal. | 637 | except 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 | |||
| 865 | this function is called. If you are using a window system, the | 865 | this function is called. If you are using a window system, the |
| 866 | previously selected frame may be restored as the selected frame | 866 | previously selected frame may be restored as the selected frame |
| 867 | when returning to the command loop, because it still may have | 867 | when returning to the command loop, because it still may have |
| 868 | the window system's input focus. On a text-only terminal, the | 868 | the window system's input focus. On a text terminal, the next |
| 869 | next redisplay will display FRAME. | 869 | redisplay will display FRAME. |
| 870 | 870 | ||
| 871 | This function returns FRAME, or nil if FRAME has been deleted. */) | 871 | This 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\". | |||
| 1730 | Normally you may not make FRAME invisible if all other frames are invisible, | 1740 | Normally you may not make FRAME invisible if all other frames are invisible, |
| 1731 | but if the second optional argument FORCE is non-nil, you may do so. | 1741 | but if the second optional argument FORCE is non-nil, you may do so. |
| 1732 | 1742 | ||
| 1733 | This function has no effect on text-only terminal frames. Such frames | 1743 | This function has no effect on text terminal frames. Such frames are |
| 1734 | are always considered visible, whether or not they are currently being | 1744 | always considered visible, whether or not they are currently being |
| 1735 | displayed in the terminal. */) | 1745 | displayed 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'. | |||
| 1816 | On graphical displays, invisible frames are not updated and are | 1820 | On graphical displays, invisible frames are not updated and are |
| 1817 | usually not displayed at all, even in a window system's \"taskbar\". | 1821 | usually not displayed at all, even in a window system's \"taskbar\". |
| 1818 | 1822 | ||
| 1819 | If FRAME is a text-only terminal frame, this always returns t. | 1823 | If FRAME is a text terminal frame, this always returns t. |
| 1820 | Such frames are always considered visible, whether or not they are | 1824 | Such frames are always considered visible, whether or not they are |
| 1821 | currently being displayed on the terminal. */) | 1825 | currently 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). | |||
| 2493 | In a graphical version with no toolkit, it includes both the tool bar | 2497 | In a graphical version with no toolkit, it includes both the tool bar |
| 2494 | and menu bar. | 2498 | and menu bar. |
| 2495 | 2499 | ||
| 2496 | For a text-only terminal, it includes the menu bar. In this case, the | 2500 | For a text terminal, it includes the menu bar. In this case, the |
| 2497 | result is really in characters rather than pixels (i.e., is identical | 2501 | result is really in characters rather than pixels (i.e., is identical |
| 2498 | to `frame-height'). */) | 2502 | to `frame-height'). */) |
| 2499 | (Lisp_Object frame) | 2503 | (Lisp_Object frame) |