Recover minimized window correctly on gui input

Godot Version



I have made a “minimize” button on my application, when clicked it minimizes the window to the taskbar. When I bring the application window back up, no matter where I click, it just minimizes it again. The correct usage would be the minimize buttont minimizes the window and when the window/application is brought back up again, it acts normal… A lot of forums show to use OS instead of DisplayServer but from what I can see OS doesn’t offer window settings anymore. Hopefully someone can help me with this, thanks.

func _on_gui_input(event):
	if event is InputEventMouseButton:
		if event.button_index == MOUSE_BUTTON_LEFT:
			if types == TYPES.close:
			elif types == TYPES.maximize:
			elif types == TYPES.minimize:

This looks like it is related to Buttons that miss mouse up events consume unrelated clicks afterwards · Issue #89917 · godotengine/godot · GitHub which will get fixed by Fix a special case for button masks by Sauermann · Pull Request #89926 · godotengine/godot · GitHub.

1 Like

Just an FYI, this has solved my issue, whether it is the best fix or not it seems to work.

var is_minimized = false

func _on_gui_input(event):
	if event is InputEventMouseButton and event.pressed and event.button_index == MOUSE_BUTTON_LEFT:
		if is_minimized:
			is_minimized = false
			is_minimized = true