From 7e481f6ed96675d0eeccef07f9ec697204688afa Mon Sep 17 00:00:00 2001 From: Jason Beetham Date: Sun, 15 Sep 2024 21:48:16 -0600 Subject: [PATCH] Added resizable property to window allowing for fixed sized windows which also forces floating in most tiling managers. --- owlkettle/bindings/gtk.nim | 2 ++ owlkettle/widgets.nim | 8 +++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/owlkettle/bindings/gtk.nim b/owlkettle/bindings/gtk.nim index ca44a95..a59afdd 100644 --- a/owlkettle/bindings/gtk.nim +++ b/owlkettle/bindings/gtk.nim @@ -707,6 +707,8 @@ proc gtk_window_new*(windowType: GtkWindowType): GtkWidget proc gtk_window_set_title*(window: GtkWidget, title: cstring) proc gtk_window_set_titlebar*(window, titlebar: GtkWidget) proc gtk_window_set_default_size*(window: GtkWidget, width, height: cint) +proc gtk_window_set_resizable*(window: GtkWidget, resizable: bool) +proc gtk_window_get_resizable*(window: GtkWidget): bool proc gtk_window_set_transient_for*(window, parent: GtkWidget) proc gtk_window_set_modal*(window: GtkWidget, modal: cbool) proc gtk_window_set_focus*(window, focus: GtkWidget) diff --git a/owlkettle/widgets.nim b/owlkettle/widgets.nim index d32c74d..1c48aed 100644 --- a/owlkettle/widgets.nim +++ b/owlkettle/widgets.nim @@ -121,6 +121,7 @@ renderable BaseWindow of BaseWidget: defaultSize: tuple[width, height: int] = (800, 600) ## Initial size of the window fullscreened: bool iconName: string + resizable: bool proc close() ## Called when the window is closed @@ -148,6 +149,11 @@ renderable BaseWindow of BaseWidget: property: gtk_window_set_icon_name(state.internalWidget, state.iconName.cstring) + hooks resizable: + property: + gtk_window_set_resizable(state.internalWidget, state.resizable) + + renderable Window of BaseWindow: title: string titlebar: Widget ## Custom widget set as the titlebar of the window @@ -156,7 +162,7 @@ renderable Window of BaseWindow: hooks: beforeBuild: state.internalWidget = gtk_window_new(GTK_WINDOW_TOPLEVEL) - + hooks title: property: if state.titlebar.isNil: