[X11] Fix mouse events triggered by non-popup or non-focused window #94688
+10
−29
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.
Fix: #94615
There are several issues here:
By default, the focused property of windows created by X11 is set to true:
godot/platform/linuxbsd/x11/display_server_x11.h
Line 204 in 8e36f98
And it is only modified after a focus event occurs:
godot/platform/linuxbsd/x11/display_server_x11.cpp
Lines 4661 to 4669 in 8e36f98
godot/platform/linuxbsd/x11/display_server_x11.cpp
Lines 4708 to 4723 in 8e36f98
That leads to a situation where the focued of main window is true, and the newly created popup window also has a focused property of true, resulting in multiple windows with a true focused property.
When a mouse movement event occurs, if the event happens on the main window and the main window's focued property is true, even if the popup window's focused property is also true, the event will be handled by the main window, During the main window' event handling process, it will close the popop window.
And I am not sure whether to modify the default focused property.