From eab6c0d4afbdf069c33b86e0ab10a678fdc98789 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Mon, 7 Oct 2024 09:45:46 -0700 Subject: [PATCH] gtk: only set initial window size if its the first terminal in a window Fixes #2391 --- src/apprt/gtk/Surface.zig | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/apprt/gtk/Surface.zig b/src/apprt/gtk/Surface.zig index 87de0e749..dbe96aa2d 100644 --- a/src/apprt/gtk/Surface.zig +++ b/src/apprt/gtk/Surface.zig @@ -773,8 +773,13 @@ pub fn getSize(self: *const Surface) !apprt.SurfaceSize { } pub fn setInitialWindowSize(self: *const Surface, width: u32, height: u32) !void { - // This operation only makes sense if we're within a window view hierarchy. + // If we are within a split, do not set the size. + if (self.container.split() != null) return; + + // This operation only makes sense if we're within a window view + // hierarchy and we're the first tab in the window. const window = self.container.window() orelse return; + if (window.notebook.nPages() > 1) return; // Note: this doesn't properly take into account the window decorations. // I'm not currently sure how to do that.