From 8c8fc8058d52c5d7b00a809f81352a7cfcd6b2bc Mon Sep 17 00:00:00 2001 From: under Date: Wed, 20 Mar 2024 11:11:16 -0700 Subject: [PATCH] Use _gui_input for header drag Before this, if you moved a window's header to overlap the game window's header, dragging the window again would drag the window and the game window. --- RetroWindowsGUI/Window.tscn | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/RetroWindowsGUI/Window.tscn b/RetroWindowsGUI/Window.tscn index 03c9777..016ee65 100644 --- a/RetroWindowsGUI/Window.tscn +++ b/RetroWindowsGUI/Window.tscn @@ -38,6 +38,14 @@ func getwinmosposi() -> Vector2i: return DisplayServer.window_get_position() + Vector2i(floori(mospos.x), floori(mospos.y)) func _input(event: InputEvent): + if event is InputEventMouseButton: + if event.button_index == MOUSE_BUTTON_LEFT: + if event.is_released(): + dragging = false + elif dragging and event is InputEventMouseMotion: + DisplayServer.window_set_position(begwinpos + getwinmosposi() - begwinmosposi) + +func _gui_input(event: InputEvent): if event is InputEventMouseButton: if event.button_index == MOUSE_BUTTON_LEFT: if event.double_click: @@ -51,11 +59,6 @@ func _input(event: InputEvent): dragging = true begwinmosposi = getwinmosposi() begwinpos = DisplayServer.window_get_position() - elif event.is_released(): - dragging = false - elif dragging and event is InputEventMouseMotion: - DisplayServer.window_set_position(begwinpos + getwinmosposi() - begwinmosposi) - " [sub_resource type="GDScript" id="GDScript_2514r"]