Following up with a proposed Mutter fix for Ubuntu 24.04/Noble. The GTK fix prevents only one source of corrupt timestamps. There is also a defect in Mutter's handling of these requests: it accepts a future-dated activation and updates its active-window state, while the X server rejects the corresponding keyboard-focus change. The target appears active, but typing continues to the previous application.
An isolated raw-X11 reproducer confirms this against stock Mutter 46.2-1ubuntu0.24.04.18, without relying on a GTK application to generate the timestamp. It checks that the mismatch persists and verifies that an XTest-generated keystroke actually reaches the wrong window. The attached patch normalizes impossible future activation/focus timestamps to freshly queried X server time before changing state or sending WM_TAKE_FOCUS. Future user-time properties are ignored. Ordinary stale-request rejection and CurrentTime handling are preserved. My earlier comment suggested rejection. After testing both approaches, I recommend normalization: rejection leaves explicitly requested Firefox windows backgrounded with an attention notification, whereas normalization restores foreground activation with working keyboard focus. I have used normalization locally since September, rebasing onto .18 in October, without observing unwanted activation attributable to it across daily use with several applications. The fallback cannot authenticate a recent click; a hypothetically delayed request could foreground after the user has moved on, but I have never observed that outcome. Stock .18 reproduces wrong-window keyboard delivery; .18+focusfix2 passes the focus regression suite. I will attach the reproducer, instructions, logs and SRU draft in the next comment. Could the Noble Mutter task be reconsidered from Opinion based on this reproducer and proposed fix? The debdiff retains the tested local package version; a sponsor would need to select the final archive version. The patch, tests, and documentation were prepared with OpenAI gpt-6.1-sol ultra Codex assistance. ** Patch added: "Noble Mutter: normalize future X11 focus timestamps" https://bugs.launchpad.net/ubuntu/+source/mutter/+bug/2107678/+attachment/6015154/+files/lp2107678-noble-focusfix2.debdiff -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/2107678 Title: Wrong keyboard focus after switching window in Xorg To manage notifications about this bug go to: https://bugs.launchpad.net/gtk/+bug/2107678/+subscriptions -- ubuntu-bugs mailing list [email protected] https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
