From 6c3dc7aafd368b50c351fc4585dfc5d9ad41ba51 Mon Sep 17 00:00:00 2001 From: Dmitry Gutov Date: Thu, 7 May 2026 03:55:03 +0300 Subject: [PATCH] [GTK3] Improve the resize -> hide -> show scenario * src/gtkutil.c (xg_frame_set_char_size) (xg_frame_set_size_and_position): Call gtk_window_resize for child frames too, to record _GtkWindowGeometryInfo#resize_width and resize_height. They are later looked up by gtk_widget_show_all in x_make_frame_visible (bug#80662). Without this the widgets go back and forth between the remembered and actual sizes after make-visible. --- src/gtkutil.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/gtkutil.c b/src/gtkutil.c index 8c01f26ef2f..ce91d2a189b 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c @@ -1224,6 +1224,7 @@ xg_frame_set_char_size (struct frame *f, int width, int height) #ifndef HAVE_PGTK if (FRAME_PARENT_FRAME (f)) { + /* Send the resize request immediately. */ gdk_window_resize (gtk_widget_get_window (FRAME_GTK_OUTER_WIDGET (f)), outer_width, outer_height); /* Resize all inner widgets and Cairo surface right away so the @@ -1234,9 +1235,8 @@ xg_frame_set_char_size (struct frame *f, int width, int height) x_cr_update_surface_desired_size (f, width, height); #endif } - else - gtk_window_resize (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)), - outer_width, outer_height); + gtk_window_resize (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)), + outer_width, outer_height); #else if (FRAME_GTK_OUTER_WIDGET (f)) gtk_window_resize (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)), @@ -1346,6 +1346,8 @@ xg_frame_set_size_and_position (struct frame *f, int width, int height) gdk_window_move_resize (gwin, x, y, outer_width, outer_height); if (FRAME_PARENT_FRAME (f)) { + /* Record the dimensions for GTK to remember after remapping. */ + gtk_window_resize (GTK_WINDOW (gwin), outer_width, outer_height); /* Resize all inner widgets and Cairo surface right away so the next redisplay drawing isn't clipped to the old size. */ GtkAllocation alloc = {0, 0, outer_width, outer_height};