Skip to content

Commit

Permalink
Added resizable property to window allowing for fixed sized windows w…
Browse files Browse the repository at this point in the history
…hich also forces floating in most tiling managers.
  • Loading branch information
beef331 committed Sep 16, 2024
1 parent 978c6b8 commit 7e481f6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 2 additions & 0 deletions owlkettle/bindings/gtk.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
8 changes: 7 additions & 1 deletion owlkettle/widgets.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand All @@ -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:
Expand Down

0 comments on commit 7e481f6

Please sign in to comment.