X11: Fix minimization of maximized windows#110990
Merged
Repiteo merged 1 commit intogodotengine:masterfrom Oct 10, 2025
Merged
Conversation
Calinou
approved these changes
Oct 8, 2025
Member
Calinou
left a comment
There was a problem hiding this comment.
Tested locally, it works as expected (I could reproduce both issues mentioned on master). Code looks good to me.
Testing project: test_minimize.zip
Operating System: Fedora Linux 42
KDE Plasma Version: 6.4.5
KDE Frameworks Version: 6.18.0
Qt Version: 6.9.2
Kernel Version: 6.16.9-200.fc42.x86_64 (64-bit)
Graphics Platform: X11
bruvzg
approved these changes
Oct 10, 2025
Member
bruvzg
left a comment
There was a problem hiding this comment.
Code looks good and seems to be working as expected.
Contributor
|
Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Currently, when a maximized window is minimized by...
get_window().modestill returnsWINDOW_MODE_MAXIMIZED.Unminimizing the window by clicking the window button on task bar does not work for the first time, i.e., you have to click the button twice to see the window.
The first case is simple: "minimized" currently has less priority than other modes. Maximized and minimized are independent states for window managers and are not mutually exclusive. So reordering the checks solves the problem.
godot/platform/linuxbsd/x11/display_server_x11.cpp
Lines 3101 to 3121 in b4472f4
The second case is more or less messed up I think. I reverted some of the modifications in:
This one confuses window states stored in
WindowData(minimized, maximized, fullscreen, etc.) with window modes. The former models states in window managers, while the latter is a Godot concept. It's a wrong fix for the issue it trys to solve, the problem still exists in another form.This one is trying to fix the problem of initial window state not being honoured. But it's done by changing window states in
MapNotify, i.e., whenever the window appears on the screen. This includes when the window is unminimized. This is the root cause of the problem.The minimize / maximize states should use
_NET_WM_STATE:XChangePropertybeforeXMapWindow.PropertyNotify. We don't need to remember the window's state before minimization ourselves. After the user manually cancels minimization, the window manager will update the_NET_WM_STATEto the correct state, be it maximized or fullscreen.I also removed the minimization state update logic in
NoExposeandVisibilityNotify. These two events are not related to window states at all. The former can only be received duringXCopyAreaorXCopyPlanecalls which Godot does not use. The latter is about the window being obscured by other windows instead of the "visibility" in Godot term.p.s. The fullscreen state may also have similar problems that have accumulated over the years. I took a quick look and it seems to be more complex, with mixed old and new code. Let's fix the problems one step at a time.