Files
norepro 800223a043 Release X11 pressed events on true focus loss
There are two "focus lost" signals in the Godot X11 display server:

1. `FocusOut` - native X11 signal

2. `NOTIFICATION_APPLICATION_FOCUS_OUT` - Godot signal after 250ms of
no other window getting focus.

When focus is lost, the intent is to clear any input pressed events so
that, when focus returns, we have a clean slate.

The bug is that the pressed events are (attempted to be) cleared on the
first signal, X11's `FocusOut`. This is always a no-op because it
returns early if the application still has focus. Godot's X11 server
only sets that flag after the second signal, not the first.

Move the pressed event clearing from the first signal handler to the
second. This makes clearing pressed events do what it says.

This does not affect Wayland because it does not have the 250ms grace
period.

Simple repro is to load any 3D scene, hold 'W' and, while 'W' is held,
click on any non-Godot window. Release 'W', click back to Godot, and
hold RMB. It will zoom forward as if 'W' is still pressed.

After the fix, the same test has RMB look around as expected when no
other keys are pressed.

Fixes #118897
2026-05-08 00:41:20 -07:00
..