From: Juri Linkov Date: Sat, 21 Sep 2019 22:15:57 +0000 (+0300) Subject: Take into account FRAME_TAB_BAR height in more places. X-Git-Tag: emacs-27.0.90~1328^2~7 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=ab2f42cad5259db6626f0da1eb01421c5214c799;p=emacs.git Take into account FRAME_TAB_BAR height in more places. * src/dispnew.c (handle_window_change_signal, init_display_interactive): * src/frame.c (make_terminal_frame, Fmake_terminal_frame): * src/keyboard.c (Fsuspend_emacs): * src/term.c (Fresume_tty): * src/xterm.c (x_check_fullscreen): Subtract FRAME_TAB_BAR_LINES. * src/xterm.c (x_new_font): Set FRAME_TAB_BAR_HEIGHT. (x_new_font, x_check_fullscreen, x_set_window_size_1) (x_set_window_size, x_wm_set_size_hint): Add FRAME_TABBAR_HEIGHT. --- diff --git a/src/dispnew.c b/src/dispnew.c index 3e1dad14067..7e89a855bbb 100644 --- a/src/dispnew.c +++ b/src/dispnew.c @@ -5675,7 +5675,7 @@ handle_window_change_signal (int sig) structures now. Let that be done later outside of the signal handler. */ change_frame_size (XFRAME (frame), width, - height - FRAME_MENU_BAR_LINES (XFRAME (frame)), + height - FRAME_MENU_BAR_LINES (XFRAME (frame)) - FRAME_TAB_BAR_LINES (XFRAME (frame)), 0, 1, 0, 0); } } @@ -6355,7 +6355,7 @@ init_display_interactive (void) change_frame_size (XFRAME (selected_frame), FrameCols (t->display_info.tty), FrameRows (t->display_info.tty) - - FRAME_MENU_BAR_LINES (f), 0, 0, 1, 0); + - FRAME_MENU_BAR_LINES (f) - FRAME_TAB_BAR_LINES (f), 0, 0, 1, 0); /* Delete the initial terminal. */ if (--initial_terminal->reference_count == 0 diff --git a/src/frame.c b/src/frame.c index ae0b60a58d5..5caa3f46714 100644 --- a/src/frame.c +++ b/src/frame.c @@ -1190,9 +1190,11 @@ make_terminal_frame (struct terminal *terminal) #endif FRAME_MENU_BAR_LINES (f) = NILP (Vmenu_bar_mode) ? 0 : 1; - FRAME_LINES (f) = FRAME_LINES (f) - FRAME_MENU_BAR_LINES (f); + FRAME_TAB_BAR_LINES (f) = NILP (Vtab_bar_mode) ? 0 : 1; + FRAME_LINES (f) = FRAME_LINES (f) - FRAME_MENU_BAR_LINES (f) - FRAME_TAB_BAR_LINES (f); FRAME_MENU_BAR_HEIGHT (f) = FRAME_MENU_BAR_LINES (f) * FRAME_LINE_HEIGHT (f); - FRAME_TEXT_HEIGHT (f) = FRAME_TEXT_HEIGHT (f) - FRAME_MENU_BAR_HEIGHT (f); + FRAME_TAB_BAR_HEIGHT (f) = FRAME_TAB_BAR_LINES (f) * FRAME_LINE_HEIGHT (f); + FRAME_TEXT_HEIGHT (f) = FRAME_TEXT_HEIGHT (f) - FRAME_MENU_BAR_HEIGHT (f) - FRAME_TAB_BAR_HEIGHT (f); /* Set the top frame to the newly created frame. */ if (FRAMEP (FRAME_TTY (f)->top_frame) @@ -1314,7 +1316,7 @@ affects all frames on the same terminal device. */) { int width, height; get_tty_size (fileno (FRAME_TTY (f)->input), &width, &height); - adjust_frame_size (f, width, height - FRAME_MENU_BAR_LINES (f), + adjust_frame_size (f, width, height - FRAME_MENU_BAR_LINES (f) - FRAME_TAB_BAR_LINES (f), 5, 0, Qterminal_frame); } diff --git a/src/keyboard.c b/src/keyboard.c index 44f6421ef52..51040f067df 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -10711,7 +10711,7 @@ On such systems, Emacs starts a subshell instead of suspending. */) get_tty_size (fileno (CURTTY ()->input), &width, &height); if (width != old_width || height != old_height) change_frame_size (SELECTED_FRAME (), width, - height - FRAME_MENU_BAR_LINES (SELECTED_FRAME ()), + height - FRAME_MENU_BAR_LINES (SELECTED_FRAME ()) - FRAME_TAB_BAR_LINES (SELECTED_FRAME ()), 0, 0, 0, 0); run_hook (intern ("suspend-resume-hook")); diff --git a/src/term.c b/src/term.c index a88d47f9238..6f9ac099907 100644 --- a/src/term.c +++ b/src/term.c @@ -2342,7 +2342,7 @@ frame's terminal). */) was suspended. */ get_tty_size (fileno (t->display_info.tty->input), &width, &height); if (width != old_width || height != old_height) - change_frame_size (f, width, height - FRAME_MENU_BAR_LINES (f), + change_frame_size (f, width, height - FRAME_MENU_BAR_LINES (f) - FRAME_TAB_BAR_LINES (f), 0, 0, 0, 0); SET_FRAME_VISIBLE (XFRAME (t->display_info.tty->top_frame), 1); } diff --git a/src/xterm.c b/src/xterm.c index 9e5ff793e77..e98e590df71 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -10176,6 +10176,7 @@ x_new_font (struct frame *f, Lisp_Object font_object, int fontset) int unit, font_ascent, font_descent; #ifndef USE_X_TOOLKIT int old_menu_bar_height = FRAME_MENU_BAR_HEIGHT (f); + int old_tab_bar_height = FRAME_TAB_BAR_HEIGHT (f); Lisp_Object fullscreen; #endif @@ -10195,6 +10196,7 @@ x_new_font (struct frame *f, Lisp_Object font_object, int fontset) #ifndef USE_X_TOOLKIT FRAME_MENU_BAR_HEIGHT (f) = FRAME_MENU_BAR_LINES (f) * FRAME_LINE_HEIGHT (f); + FRAME_TAB_BAR_HEIGHT (f) = FRAME_TAB_BAR_LINES (f) * FRAME_LINE_HEIGHT (f); #endif /* Compute character columns occupied by scrollbar. @@ -10219,18 +10221,19 @@ x_new_font (struct frame *f, Lisp_Object font_object, int fontset) FRAME_LINES (f) * FRAME_LINE_HEIGHT (f), 3, false, Qfont); #ifndef USE_X_TOOLKIT - if (FRAME_MENU_BAR_HEIGHT (f) != old_menu_bar_height + if ((FRAME_MENU_BAR_HEIGHT (f) != old_menu_bar_height + || FRAME_TAB_BAR_HEIGHT (f) != old_tab_bar_height) && !f->after_make_frame && (EQ (frame_inhibit_implied_resize, Qt) || (CONSP (frame_inhibit_implied_resize) && NILP (Fmemq (Qfont, frame_inhibit_implied_resize)))) && (NILP (fullscreen = get_frame_param (f, Qfullscreen)) || EQ (fullscreen, Qfullwidth))) - /* If the menu bar height changes, try to keep text height + /* If the menu/tab bar height changes, try to keep text height constant. */ adjust_frame_size - (f, -1, FRAME_TEXT_HEIGHT (f) + FRAME_MENU_BAR_HEIGHT (f) - - old_menu_bar_height, 1, false, Qfont); + (f, -1, FRAME_TEXT_HEIGHT (f) + FRAME_MENU_BAR_HEIGHT (f) + FRAME_TAB_BAR_HEIGHT (f) + - old_menu_bar_height - old_tab_bar_height, 1, false, Qfont); #endif /* USE_X_TOOLKIT */ } } @@ -11165,7 +11168,7 @@ x_check_fullscreen (struct frame *f) case FULLSCREEN_WIDTH: lval = Qfullwidth; width = x_display_pixel_width (dpyinfo); - height = height + FRAME_MENUBAR_HEIGHT (f); + height = height + FRAME_MENUBAR_HEIGHT (f) + FRAME_TABBAR_HEIGHT (f); break; case FULLSCREEN_HEIGHT: lval = Qfullheight; @@ -11187,7 +11190,7 @@ x_check_fullscreen (struct frame *f) x_wait_for_event (f, ConfigureNotify); else { - change_frame_size (f, width, height - FRAME_MENUBAR_HEIGHT (f), + change_frame_size (f, width, height - FRAME_MENUBAR_HEIGHT (f) - FRAME_TABBAR_HEIGHT (f), false, true, false, true); x_sync (f); } @@ -11363,10 +11366,10 @@ x_set_window_size_1 (struct frame *f, bool change_gravity, { frame_size_history_add (f, Qx_set_window_size_1, width, height, - list2i (old_height, pixelheight + FRAME_MENUBAR_HEIGHT (f))); + list2i (old_height, pixelheight + FRAME_MENUBAR_HEIGHT (f) + FRAME_TABBAR_HEIGHT (f))); XResizeWindow (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f), - old_width, pixelheight + FRAME_MENUBAR_HEIGHT (f)); + old_width, pixelheight + FRAME_MENUBAR_HEIGHT (f) + FRAME_TABBAR_HEIGHT (f)); } else if (EQ (fullscreen, Qfullheight) && height == FRAME_TEXT_HEIGHT (f)) { @@ -11382,15 +11385,12 @@ x_set_window_size_1 (struct frame *f, bool change_gravity, { frame_size_history_add (f, Qx_set_window_size_3, width, height, - list3i (pixelwidth + FRAME_TOOLBAR_WIDTH (f) - + FRAME_TABBAR_WIDTH (f), - (pixelheight + FRAME_TOOLBAR_HEIGHT (f) - + FRAME_TABBAR_HEIGHT (f) - + FRAME_MENUBAR_HEIGHT (f)), - FRAME_MENUBAR_HEIGHT (f))); + list3i (pixelwidth + FRAME_TOOLBAR_WIDTH (f) + FRAME_TABBAR_WIDTH (f), + (pixelheight + FRAME_TOOLBAR_HEIGHT (f) + FRAME_TABBAR_HEIGHT (f) + FRAME_MENUBAR_HEIGHT (f)), + FRAME_MENUBAR_HEIGHT (f) + FRAME_TABBAR_HEIGHT (f))); XResizeWindow (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f), - pixelwidth, pixelheight + FRAME_MENUBAR_HEIGHT (f)); + pixelwidth, pixelheight + FRAME_MENUBAR_HEIGHT (f) + FRAME_TABBAR_HEIGHT (f)); fullscreen = Qnil; } @@ -11467,7 +11467,7 @@ x_set_window_size (struct frame *f, bool change_gravity, #ifdef USE_X_TOOLKIT /* The menu bar is not part of text lines. The tool bar is however. */ - pixelh -= FRAME_MENUBAR_HEIGHT (f); + pixelh -= FRAME_MENUBAR_HEIGHT (f) + FRAME_TABBAR_HEIGHT (f); #endif text_width = FRAME_PIXEL_TO_TEXT_WIDTH (f, FRAME_PIXEL_WIDTH (f)); text_height = FRAME_PIXEL_TO_TEXT_HEIGHT (f, pixelh); @@ -12085,6 +12085,7 @@ x_free_frame_resources (struct frame *f) XDestroyWindow (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f)); free_frame_menubar (f); + free_frame_tab_bar (f); if (f->shell_position) xfree (f->shell_position); @@ -12263,7 +12264,7 @@ x_wm_set_size_hint (struct frame *f, long flags, bool user_position) size_hints.flags |= PBaseSize; size_hints.base_width = base_width; - size_hints.base_height = base_height + FRAME_MENUBAR_HEIGHT (f); + size_hints.base_height = base_height + FRAME_MENUBAR_HEIGHT (f) + FRAME_TABBAR_HEIGHT (f); size_hints.min_width = base_width; size_hints.min_height = base_height; }