Public bug reported:

[Impact]

With focus-mode set to 'sloppy' or 'mouse' ("focus follows mouse"), activating
a window with the keyboard (Alt-Tab, Super+number, etc.) no longer works: the
selected window is focused for a moment, then focus immediately returns to the
window under the mouse pointer, without any pointer motion. This makes
keyboard window switching effectively unusable for focus-follows-mouse users,
especially on multi-monitor setups where the pointer usually rests on a
different monitor than the window being switched to.

This is a regression introduced during the GNOME 50 development cycle
(bisected upstream to commit 8c0b25b) and is present in the mutter 50.1
shipped in Ubuntu 26.04 LTS. It worked correctly in earlier releases.

Upstream reports:
- https://gitlab.gnome.org/GNOME/mutter/-/issues/4479
  ("Windows are wrongly activated from hover when switching focus with 
keyboard")
- https://gitlab.gnome.org/GNOME/mutter/-/issues/4793
  ("Activate Window on Hover deactivates windows focused via keyboard 
shortcuts",
  reported against 50.1)

Fixed upstream by merge request:
- https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/5036
  ("Fix alt-tab with sloppy/mouse focus", merged 2026-05-05)

The fix consists of three commits, all present on the gnome-50 branch and
first released in mutter 50.2 (also in 50.3 and 50.4):
- 9c29dcab383e tests/test-runner: Add (un)map_overlay command
- da22413a0653 display: Keep track of pointer window
- 3b39c482599f display: Explicitly handle stickyness of mouse focus

The 50.1-0ubuntu2.3 upload currently in resolute-proposed does not include
these commits. Please cherry-pick them (or rebase resolute to a 50.x point
release under the GNOME MRE).

[Test Plan]

1. On a Wayland session, enable focus follows mouse:
   gsettings set org.gnome.desktop.wm.preferences focus-mode 'sloppy'
2. Open two windows, both visible (easiest with two monitors, one window on 
each).
3. Place the mouse pointer over window A and leave it there.
4. Without moving the mouse, press Alt-Tab to switch to window B.

Broken (50.1): window B is focused for a fraction of a second, then window A
(under the pointer) immediately regains focus.
Expected/fixed: window B keeps focus until the mouse is actually moved.
The fix also adds an automated test
(src/tests/stacking/sloppy-focus-switch-with-keyboard.metatest).

[Where problems could occur]

The change is confined to sloppy/mouse focus-mode handling in
src/core/display.c and src/core/window.c (tracking the window under the
pointer and only letting it take focus on real pointer motion). Users of the
default 'click' focus mode are unaffected. A regression would most likely
show up as incorrect focus behaviour for focus-follows-mouse users, e.g.
hover focus not triggering after keyboard switching.

[Additional information]

I verified the fix locally: the three commits apply cleanly on top of the
50.1-0ubuntu2.2 source package (small offsets only, no fuzz), and a rebuilt
libmutter-18-0 resolves the problem — keyboard focus switching behaves
correctly again with focus-mode 'sloppy'.

ProblemType: Bug
DistroRelease: Ubuntu 26.04
Package: mutter-common 50.1-0ubuntu2.2
Description: Ubuntu 26.04.1 LTS
Uname: Linux 7.0.0-30-generic x86_64
Session: GNOME Shell 50.1, Wayland

** Affects: mutter (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2166173

Title:
  Sloppy/mouse focus steals focus back from window activated with Alt-
  Tab (fixed upstream in mutter 50.2, please backport)

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/mutter/+bug/2166173/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to