From 1575afe8df522a49184217632b2eb4f3d234942c Mon Sep 17 00:00:00 2001 From: Martin Rudalics Date: Mon, 24 Jan 2022 10:33:15 +0100 Subject: [PATCH] Orderly inhibit frame resizing when activating tool or tab bar (Bug#52986) * src/xdisp.c (redisplay_tab_bar, redisplay_tool_bar): If we do not display a tool or tab bar in these functions, still set f->tool/tab_bar_redisplayed and f->tool/tab_bar_resized. This avoids that when one of these are initially turned off, a later activation resizes the frame despite of the fact that 'frame-inhibit-implied-resize' should prevent it (Bug#52986). --- src/xdisp.c | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/src/xdisp.c b/src/xdisp.c index af46d4da604..9c0764be690 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -13928,6 +13928,8 @@ redisplay_tab_bar (struct frame *f) struct it it; struct glyph_row *row; + f->tab_bar_redisplayed = true; + /* If frame hasn't a tab-bar window or if it is zero-height, don't do anything. This means you must start with tab-bar-lines non-zero to get the auto-sizing effect. Or in other words, you @@ -13935,9 +13937,16 @@ redisplay_tab_bar (struct frame *f) if (!WINDOWP (f->tab_bar_window) || (w = XWINDOW (f->tab_bar_window), WINDOW_TOTAL_LINES (w) == 0)) - return false; + { + /* Even if we do not display a tab bar initially, still pretend + that we have resized it. This avoids that a later activation + of the tab bar resizes the frame, despite of the fact that the + setting of 'frame-inhibit-implied-resize' should inhibit it + (Bug#52986). */ + f->tab_bar_resized = true; - f->tab_bar_redisplayed = true; + return false; + } /* Set up an iterator for the tab-bar window. */ init_iterator (&it, w, -1, -1, w->desired_matrix->rows, TAB_BAR_FACE_ID); @@ -14847,6 +14856,8 @@ redisplay_tool_bar (struct frame *f) struct it it; struct glyph_row *row; + f->tool_bar_redisplayed = true; + /* If frame hasn't a tool-bar window or if it is zero-height, don't do anything. This means you must start with tool-bar-lines non-zero to get the auto-sizing effect. Or in other words, you @@ -14854,9 +14865,16 @@ redisplay_tool_bar (struct frame *f) if (!WINDOWP (f->tool_bar_window) || (w = XWINDOW (f->tool_bar_window), WINDOW_TOTAL_LINES (w) == 0)) - return false; + { + /* Even if we do not display a tool bar initially, still pretend + that we have resized it already. This avoids that a later + activation of the tool bar resizes the frame, despite of the + fact that a setting of 'frame-inhibit-implied-resize' should + inhibit it (Bug#52986). */ + f->tool_bar_resized = true; - f->tool_bar_redisplayed = true; + return false; + } /* Set up an iterator for the tool-bar window. */ init_iterator (&it, w, -1, -1, w->desired_matrix->rows, TOOL_BAR_FACE_ID); -- 2.39.2