Closed pkdawson closed 1 year ago
Finally found the problem!
Missing a mouse up event means pressrc
will never again be decremented to 0, so the mouse capture is never properly released. Ideally this should be patched upstream, but I'm not exactly sure what the fix should be, and I still don't have an MRP.
For now, I'll figure out a workaround.
The upstream fix has not been merged yet (everyone is busy working on the 4.0 release), so I'll release the workaround for now instead.
Fix merged, the workaround can be retired for Godot 4.1.0
If a window is created as the mouse leaves the frame of the main window, and the “mouse button up” event isn’t received, then the main window will stop responding to all inputs.
Workaround
Drag the new window back into the main window. You may need to repeat this once or twice (drag it out, then back in).
Notes
This bug is easy to reproduce (depending on the input handling code), but it’s been frustratingly difficult to find the root cause, so I’m documenting it here.
All I know is that in this situation, the main window stops receiving window messages at all, and it’s not caused by
WS_EX_NOACTIVATE
orMA_NOACTIVATEANDEAT
. Destroying the new window usually fixes it, at least temporarily.I’ve been unable to make an MRP. I’m not entirely convinced it’s a Godot bug, but I also don’t know how my code or ImGui could break the main window like that.
TODO: Examine the following scenario
Reproduce the issue, then ctrl+tab to a window within the main window. This fixes the main window. Then click the new window, which breaks it again. This can be repeated. Ctrl+tab to the new window does not break it.