diff --git a/src/gtkutil.c b/src/gtkutil.c index 6308c38f16..fec6056bb0 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c @@ -940,9 +940,8 @@ xg_frame_resized (struct frame *f, int pixelwidth, int pixelheight) } } -/* Resize the outer window of frame F after changing the height. - COLUMNS/ROWS is the size the edit area shall have after the resize. */ - +/** Resize the outer window of frame F. WIDTH and HEIGHT are the new + pixel sizes of F's text area. */ void xg_frame_set_char_size (struct frame *f, int width, int height) { @@ -953,6 +952,7 @@ xg_frame_set_char_size (struct frame *f, int width, int height) int totalheight = pixelheight + FRAME_TOOLBAR_HEIGHT (f) + FRAME_MENUBAR_HEIGHT (f); int totalwidth = pixelwidth + FRAME_TOOLBAR_WIDTH (f); + bool was_visible = false; if (FRAME_PIXEL_HEIGHT (f) == 0) return; @@ -995,12 +995,35 @@ xg_frame_set_char_size (struct frame *f, int width, int height) gtk_window_resize (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)), totalwidth, gheight); } + else if (FRAME_PARENT_FRAME (f) && FRAME_VISIBLE_P (f) + && x_gtk_hide_child_frame_during_resize) + { + was_visible = true; + + if (totalwidth != gwidth || totalheight != gheight) + { + frame_size_history_add + (f, Qxg_frame_set_char_size_3, width, height, + list2i (totalwidth, totalheight)); + block_input (); + gtk_widget_hide (FRAME_GTK_OUTER_WIDGET (f)); + unblock_input (); + + gtk_window_resize (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)), + totalwidth, totalheight); + + block_input (); + gtk_widget_show_all (FRAME_GTK_OUTER_WIDGET (f)); + unblock_input (); + + fullscreen = Qnil; + } + } else { frame_size_history_add (f, Qxg_frame_set_char_size_3, width, height, list2i (totalwidth, totalheight)); - gtk_window_resize (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)), totalwidth, totalheight); fullscreen = Qnil; @@ -1016,7 +1039,7 @@ xg_frame_set_char_size (struct frame *f, int width, int height) size as fast as possible. For unmapped windows, we can set rows/cols. When the frame is mapped again we will (hopefully) get the correct size. */ - if (FRAME_VISIBLE_P (f)) + if (FRAME_VISIBLE_P (f) && !was_visible) { /* Must call this to flush out events */ (void)gtk_events_pending (); diff --git a/src/xterm.c b/src/xterm.c index 21d99f0c7b..95109baf46 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -13747,4 +13747,9 @@ syms_of_xterm (void) consuming frame position adjustments. In newer versions of GTK, Emacs always uses gtk_window_move and ignores the value of this variable. */); x_gtk_use_window_move = true; + + DEFVAR_BOOL ("x-gtk-hide-child-frame-during-resize", x_gtk_hide_child_frame_during_resize, + doc: /* Non-nil means hide child frame during resize. +Set this only if your window manager refuses to resize child frames. */); + x_gtk_hide_child_frame_during_resize = false; }