Mouse clicks ignored system-wide when SDL2 window blocks event loop after click
Steps: compile and run minimal.cpp (attached below), focus the window, click inside the window, then try clicking anywhere else — clicks are ignored for 10 seconds (as long as the program sleeps), cursor still moves, keyboard still works.
To be honest, I found this while playing around with faulty AI generated programs. The minimal example is AI generated, but I have tested it manually before opening this issue. The AI suggests the following root cause, but I cannot verify whether this is correct, because I don't know the internals of XFCE. Even though the following text has been written by AI, the issue is opened by me, real human, and I will respond to you in person if you have any questions.
▎ Root cause: xfwm4 sends _NET_WM_SYNC_REQUEST on click, then waits for the client's XSync counter while holding a GrabModeSync pointer grab. If the client never
▎ updates the counter (blocked thread, crashed app, etc.), the grab is never released via XAllowEvents and all mouse button events freeze system-wide.
▎
▎ Fix suggestion: add a timeout to the _NET_WM_SYNC_REQUEST wait — if the client doesn't respond within ~1–2 s, give up and call XAllowEvents anyway.
▎ ▎ Related: #625 (similar mechanism, different trigger)