From 769e7df675107da99bc6e803295f343ae8d28c7b Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sat, 30 Sep 2023 21:41:17 -0700 Subject: [PATCH] apprt/gtk: implement default window size --- src/apprt/gtk/Surface.zig | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/apprt/gtk/Surface.zig b/src/apprt/gtk/Surface.zig index b66c053e9..2638eca9d 100644 --- a/src/apprt/gtk/Surface.zig +++ b/src/apprt/gtk/Surface.zig @@ -325,6 +325,16 @@ pub fn getSize(self: *const Surface) !apprt.SurfaceSize { return self.size; } +pub fn setInitialWindowSize(self: *const Surface, width: u32, height: u32) !void { + // Note: this doesn't properly take into account the window decorations. + // I'm not currently sure how to do that. + c.gtk_window_set_default_size( + @ptrCast(self.window.window), + @intCast(width), + @intCast(height), + ); +} + pub fn setSizeLimits(self: *Surface, min: apprt.SurfaceSize, max_: ?apprt.SurfaceSize) !void { _ = self; _ = min;