Wayland + Focus on Hover Causes Alt-`/Alt-Tab to work incorrectly
Affected version
- Fedora 34
- gnome-shell-40.6-1
- mutter-40.6-1
- libwayland-server-1.19.0
This issue appears in Wayland only!
Bug summary
This issue only seems to appear if the focus policy is set to 'Focus on Hover'. When this policy is set, if the mouse is hovered over the currently selected window, using either Alt-Tab or Alt-` to switch windows, focus has a tendency to revert back to the original window.
Steps to reproduce
- Set your focus policy to 'Focus on Hover'
- Make sure you are using gnome on wayland, as this behavior cannot be reproduced on Xorg
- Open two applications. They can be two windows from the same application (for testing Alt-`) or two different applications (for testing Alt-Tab)
- It is better if the windows do not overlap
- Make sure your mouse is hovering over the currently focused window
- Make sure your mouse will NOT be hovering over the other window
- Quickly press Alt-` or Alt-tab
- The focus will briefly switch to the new window (it will even come to the foreground), but then the focus will jump back to the original window that the mouse is hovering over.
Note, that this doesn't happen all the time, but it does happen a majority of the time for me. I can reproduce this on multiple computers, some running Fedora, some running Manjaro with varying versions of gnome-shell. I recall seeing this issue in earlier gnome 3.3X.Y versions too, and reverted back to using Xorg, where the problem didn't manifest.
I have found that holding down Alt-Tab/Alt-` for a longer period tends to cause focus to switch to the new window correctly more often, although, sometimes after 5-10 seconds, focus will suddenly jump back to the window the mouse is hovering over, even without having touched the mouse (trackpad).
What happened
The focus is jumping back to the window under the mouse rather than staying on the new window that has been switched to.
What did you expect to happen
I expected focus to be moved to the new window, and not jump back to the previous window that the mouse is hovering over.
Relevant logs, screenshots, screencasts etc.
Attached is a screencast showing the issue. Note I am pressing Alt-` to switch between two terminal windows. You can briefly see the other window gaining focus, but then the focus jumps back to the original window underneath my mouse.