aboutsummaryrefslogtreecommitdiffstats
path: root/src/term.c
diff options
context:
space:
mode:
authorMartin Rudalics2014-08-10 10:26:28 +0200
committerMartin Rudalics2014-08-10 10:26:28 +0200
commitc29f96fa6b074980faea5bd4bddb4c74993838b0 (patch)
tree7ad142e338513b12278c4be995843e6c84b27887 /src/term.c
parentaa4008091c9adcc23924983f45eb442f55217056 (diff)
downloademacs-c29f96fa6b074980faea5bd4bddb4c74993838b0.tar.gz
emacs-c29f96fa6b074980faea5bd4bddb4c74993838b0.zip
Fix handling of menu bar line on TTY frames (Bug#18136) (Bug#18196).
* dispnew.c (handle_window_change_signal): * keyboard.c (Fsuspend_emacs): Call change_frame_size with frame's menu bar lines subtracted from height. * frame.c (frame_inhibit_resize): Inhibit resizing of TTY frames. (adjust_frame_size): Count in menu bar when setting FrameRows. (make_terminal_frame): When setting up the frame's lines and text height don't count in the menu bar. (Fmake_terminal_frame): Call adjust_frame_size with menu bar lines subtracted from height. (do_switch_frame): Set tty's FrameRows to number of total lines of frame. (Fframe_pixel_height, Fframe_pixel_width): If no window system is used, return total number of lines and columns. * menu.c (emulate_dialog_with_menu): Use FRAME_TOTAL_LINES instead of FRAME_LINES. * term.c (OUTPUT, tty_set_terminal_modes) (tty_set_terminal_window, tty_set_scroll_region) (tty_clear_to_end, tty_write_glyphs, tty_write_glyphs_with_face) (tty_ins_del_lines, tty_menu_display, tty_menu_activate): Use FRAME_TOTAL_LINES instead of FRAME_LINES. (Fresume_tty): Use FRAME_TOTAL_LINES instead of FRAME_LINES. Call change_frame_size with frame's menu bar lines subtracted from height. * w32console.c (w32con_clear_to_end, w32con_clear_frame) (w32con_ins_del_lines): Use FRAME_TOTAL_LINES instead of FRAME_LINES.
Diffstat (limited to 'src/term.c')
-rw-r--r--src/term.c31
1 files changed, 16 insertions, 15 deletions
diff --git a/src/term.c b/src/term.c
index 8c004ccbecb..9afd3b872b0 100644
--- a/src/term.c
+++ b/src/term.c
@@ -91,7 +91,7 @@ static _Noreturn void vfatal (const char *str, va_list ap)
91 91
92#define OUTPUT(tty, a) \ 92#define OUTPUT(tty, a) \
93 emacs_tputs ((tty), a, \ 93 emacs_tputs ((tty), a, \
94 FRAME_LINES (XFRAME (selected_frame)) - curY (tty), \ 94 FRAME_TOTAL_LINES (XFRAME (selected_frame)) - curY (tty), \
95 cmputc) 95 cmputc)
96 96
97#define OUTPUT1(tty, a) emacs_tputs ((tty), a, 1, cmputc) 97#define OUTPUT1(tty, a) emacs_tputs ((tty), a, 1, cmputc)
@@ -201,7 +201,7 @@ tty_set_terminal_modes (struct terminal *terminal)
201 off the screen, so it won't be overwritten and lost. */ 201 off the screen, so it won't be overwritten and lost. */
202 int i; 202 int i;
203 current_tty = tty; 203 current_tty = tty;
204 for (i = 0; i < FRAME_LINES (XFRAME (selected_frame)); i++) 204 for (i = 0; i < FRAME_TOTAL_LINES (XFRAME (selected_frame)); i++)
205 cmputc ('\n'); 205 cmputc ('\n');
206 } 206 }
207 207
@@ -257,7 +257,7 @@ tty_set_terminal_window (struct frame *f, int size)
257{ 257{
258 struct tty_display_info *tty = FRAME_TTY (f); 258 struct tty_display_info *tty = FRAME_TTY (f);
259 259
260 tty->specified_window = size ? size : FRAME_LINES (f); 260 tty->specified_window = size ? size : FRAME_TOTAL_LINES (f);
261 if (FRAME_SCROLL_REGION_OK (f)) 261 if (FRAME_SCROLL_REGION_OK (f))
262 tty_set_scroll_region (f, 0, tty->specified_window); 262 tty_set_scroll_region (f, 0, tty->specified_window);
263} 263}
@@ -272,9 +272,9 @@ tty_set_scroll_region (struct frame *f, int start, int stop)
272 buf = tparam (tty->TS_set_scroll_region, 0, 0, start, stop - 1, 0, 0); 272 buf = tparam (tty->TS_set_scroll_region, 0, 0, start, stop - 1, 0, 0);
273 else if (tty->TS_set_scroll_region_1) 273 else if (tty->TS_set_scroll_region_1)
274 buf = tparam (tty->TS_set_scroll_region_1, 0, 0, 274 buf = tparam (tty->TS_set_scroll_region_1, 0, 0,
275 FRAME_LINES (f), start, 275 FRAME_TOTAL_LINES (f), start,
276 FRAME_LINES (f) - stop, 276 FRAME_TOTAL_LINES (f) - stop,
277 FRAME_LINES (f)); 277 FRAME_TOTAL_LINES (f));
278 else 278 else
279 buf = tparam (tty->TS_set_window, 0, 0, start, 0, stop, FRAME_COLS (f)); 279 buf = tparam (tty->TS_set_window, 0, 0, start, 0, stop, FRAME_COLS (f));
280 280
@@ -446,7 +446,7 @@ tty_clear_to_end (struct frame *f)
446 } 446 }
447 else 447 else
448 { 448 {
449 for (i = curY (tty); i < FRAME_LINES (f); i++) 449 for (i = curY (tty); i < FRAME_TOTAL_LINES (f); i++)
450 { 450 {
451 cursor_to (f, i, 0); 451 cursor_to (f, i, 0);
452 clear_end_of_line (f, FRAME_COLS (f)); 452 clear_end_of_line (f, FRAME_COLS (f));
@@ -748,7 +748,7 @@ tty_write_glyphs (struct frame *f, struct glyph *string, int len)
748 since that would scroll the whole frame on some terminals. */ 748 since that would scroll the whole frame on some terminals. */
749 749
750 if (AutoWrap (tty) 750 if (AutoWrap (tty)
751 && curY (tty) + 1 == FRAME_LINES (f) 751 && curY (tty) + 1 == FRAME_TOTAL_LINES (f)
752 && (curX (tty) + len) == FRAME_COLS (f)) 752 && (curX (tty) + len) == FRAME_COLS (f))
753 len --; 753 len --;
754 if (len <= 0) 754 if (len <= 0)
@@ -820,7 +820,7 @@ tty_write_glyphs_with_face (register struct frame *f, register struct glyph *str
820 since that would scroll the whole frame on some terminals. */ 820 since that would scroll the whole frame on some terminals. */
821 821
822 if (AutoWrap (tty) 822 if (AutoWrap (tty)
823 && curY (tty) + 1 == FRAME_LINES (f) 823 && curY (tty) + 1 == FRAME_TOTAL_LINES (f)
824 && (curX (tty) + len) == FRAME_COLS (f)) 824 && (curX (tty) + len) == FRAME_COLS (f))
825 len --; 825 len --;
826 if (len <= 0) 826 if (len <= 0)
@@ -1009,7 +1009,7 @@ tty_ins_del_lines (struct frame *f, int vpos, int n)
1009 && vpos + i >= tty->specified_window) 1009 && vpos + i >= tty->specified_window)
1010 return; 1010 return;
1011 if (!FRAME_MEMORY_BELOW_FRAME (f) 1011 if (!FRAME_MEMORY_BELOW_FRAME (f)
1012 && vpos + i >= FRAME_LINES (f)) 1012 && vpos + i >= FRAME_TOTAL_LINES (f))
1013 return; 1013 return;
1014 1014
1015 if (multi) 1015 if (multi)
@@ -1046,7 +1046,7 @@ tty_ins_del_lines (struct frame *f, int vpos, int n)
1046 && FRAME_MEMORY_BELOW_FRAME (f) 1046 && FRAME_MEMORY_BELOW_FRAME (f)
1047 && n < 0) 1047 && n < 0)
1048 { 1048 {
1049 cursor_to (f, FRAME_LINES (f) + n, 0); 1049 cursor_to (f, FRAME_TOTAL_LINES (f) + n, 0);
1050 clear_to_end (f); 1050 clear_to_end (f);
1051 } 1051 }
1052} 1052}
@@ -2405,13 +2405,14 @@ frame's terminal). */)
2405 struct frame *f = XFRAME (t->display_info.tty->top_frame); 2405 struct frame *f = XFRAME (t->display_info.tty->top_frame);
2406 int width, height; 2406 int width, height;
2407 int old_height = FRAME_COLS (f); 2407 int old_height = FRAME_COLS (f);
2408 int old_width = FRAME_LINES (f); 2408 int old_width = FRAME_TOTAL_LINES (f);
2409 2409
2410 /* Check if terminal/window size has changed while the frame 2410 /* Check if terminal/window size has changed while the frame
2411 was suspended. */ 2411 was suspended. */
2412 get_tty_size (fileno (t->display_info.tty->input), &width, &height); 2412 get_tty_size (fileno (t->display_info.tty->input), &width, &height);
2413 if (width != old_width || height != old_height) 2413 if (width != old_width || height != old_height)
2414 change_frame_size (f, width, height - FRAME_MENU_BAR_LINES (f), 0, 0, 0, 0); 2414 change_frame_size (f, width, height - FRAME_MENU_BAR_LINES (f),
2415 0, 0, 0, 0);
2415 SET_FRAME_VISIBLE (XFRAME (t->display_info.tty->top_frame), 1); 2416 SET_FRAME_VISIBLE (XFRAME (t->display_info.tty->top_frame), 1);
2416 } 2417 }
2417 2418
@@ -2894,7 +2895,7 @@ tty_menu_display (tty_menu *menu, int x, int y, int pn, int *faces,
2894 /* Don't try to display more menu items than the console can display 2895 /* Don't try to display more menu items than the console can display
2895 using the available screen lines. Exclude the echo area line, as 2896 using the available screen lines. Exclude the echo area line, as
2896 it will be overwritten by the help-echo anyway. */ 2897 it will be overwritten by the help-echo anyway. */
2897 int max_items = min (menu->count - first_item, FRAME_LINES (sf) - 1 - y); 2898 int max_items = min (menu->count - first_item, FRAME_TOTAL_LINES (sf) - 1 - y);
2898 2899
2899 menu_help_message = NULL; 2900 menu_help_message = NULL;
2900 2901
@@ -3274,7 +3275,7 @@ tty_menu_activate (tty_menu *menu, int *pane, int *selidx,
3274 { 3275 {
3275 mi_result input_status; 3276 mi_result input_status;
3276 int min_y = state[0].y; 3277 int min_y = state[0].y;
3277 int max_y = min (min_y + state[0].menu->count, FRAME_LINES (sf) - 1) - 1; 3278 int max_y = min (min_y + state[0].menu->count, FRAME_TOTAL_LINES (sf) - 1) - 1;
3278 3279
3279 input_status = read_menu_input (sf, &x, &y, min_y, max_y, &first_time); 3280 input_status = read_menu_input (sf, &x, &y, min_y, max_y, &first_time);
3280 if (input_status) 3281 if (input_status)