From d47c6ed9358350b1c8453dbb9300241b3bcbff48 Mon Sep 17 00:00:00 2001 From: under Date: Wed, 20 Mar 2024 13:42:53 -0700 Subject: [PATCH] Change maximizing logic Before this, maximizing a window functioned by reparenting it to a margincontainer. Now, maximizing a window is a matter of setting its anchors and offsets. It will require more code but the reparenting strategy was causing problems because maximized windows were always displayed below windowed ones. This could technically be solved by modifying z-indexes of windows individually but this seems like a less annoying solution than that in the long run. --- RetroWindowsGUI/DesktopWindow.gd | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/RetroWindowsGUI/DesktopWindow.gd b/RetroWindowsGUI/DesktopWindow.gd index 5cf792f..43ee0e6 100755 --- a/RetroWindowsGUI/DesktopWindow.gd +++ b/RetroWindowsGUI/DesktopWindow.gd @@ -21,13 +21,13 @@ func _input(event: InputEvent): # toggle maximized func toggle_maximized(): - if get_parent() == maximized_windows: + if anchors_preset == Control.PRESET_FULL_RECT: + set_anchors_and_offsets_preset(Control.PRESET_TOP_LEFT) position = windowed_rect.position size = windowed_rect.size - reparent(desktop) else: windowed_rect = get_global_rect() - reparent(maximized_windows) + set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT) func close(): visible = false