Bug 429930

Summary: Mouse scroll doesn't work when Alt+Tab to XWayland windows
Product: [Frameworks and Libraries] kwayland Reporter: Andrey <butirsky>
Component: serverAssignee: Martin Flöser <mgraesslin>
Status: RESOLVED FIXED    
Severity: major CC: bhush94, kwin-bugs-null, nate
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
URL: https://invent.kde.org/plasma/kwayland-server/-/merge_requests/68
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: WAYLAND_DEBUG=1
WAYLAND_DEBUG=1 startplasma-wayland

Description Andrey 2020-12-02 15:11:28 UTC
SUMMARY
Different X apps in Wayland session start behave strange when Alt+Tab to them - mostly, mouse scroll doesn't work properly.
To make it work, Esc or any other key press is enough.
It seems Alt release event doesn't occur on Alt+Tab switch to XWayland windows.

Sample apps suffered: FF, Qt Creator.

STEPS TO REPRODUCE
switch with Alt+Tab from any Wayland window to FF X window and try to mouse scroll there

OBSERVED RESULT
Scrolling doesn't work.
Instead, if browsing history is present for the tab, it will go back/forth by pages in the history on mouse wheel rotation.

EXPECTED RESULT
Scrolling works as usual.

SOFTWARE/OS VERSIONS
compiled from master
Comment 1 Andrey 2020-12-02 15:44:17 UTC
Created attachment 133813 [details]
WAYLAND_DEBUG=1

Here is konsole run with WAYLAND_DEBUG=1 log and then switching to FF window, unsuccessful scroll there, then Esc and successful scroll after.
Comment 2 Andrey 2020-12-02 16:16:56 UTC
Created attachment 133814 [details]
WAYLAND_DEBUG=1 startplasma-wayland
Comment 4 Bug Janitor Service 2020-12-04 16:36:47 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwayland-server/-/merge_requests/141
Comment 5 David Edmundson 2020-12-14 21:18:04 UTC
Git commit f67daa0711584058a8fefda76e898fe58d53ace7 by David Edmundson, on behalf of Andrey Butirsky.
Committed on 14/12/2020 at 17:09.
Pushed by davidedmundson into branch 'master'.

keyboard_interface: Always update modifiers cache

We send modifiers to the active client when they change, and when we
focus an existing client we send the cached state.

For this reason it's important we always update our internal store of
modifiers regardless of whether a surface is currently active.

Unit test is adopted accordingly.

M  +7    -4    autotests/client/test_wayland_seat.cpp
M  +5    -3    src/server/keyboard_interface.cpp

https://invent.kde.org/plasma/kwayland-server/commit/f67daa0711584058a8fefda76e898fe58d53ace7