graesslin created this revision. graesslin added reviewers: KWin, Plasma on Wayland, bshah. Restricted Application added subscribers: kwin, plasma-devel. Restricted Application added projects: Plasma on Wayland, KWin.
REVISION SUMMARY For Xwayland windows we observed that passing pointer focus to another window does not trigger proper leave events on X. Which results in e.g. tooltip windows to show after the pointer moved to a completely different position on a completely different surface. From an X perspective that's kind of correct: the pointer is still at the same position and the x11 api to query the cursor position is still on the last known position passed to Xwayland. Whether this problem can or should be fixed in Xwayland is not obvious. To circumvent this problem KWin warps the xcb pointer to 0/0 whever an X window loses pointer focus. That way the X window gets a proper leave through the X protocol. This created a problem though: when giving focus back to the X window it started to warp the pointer for maximized windows as KWin got pointer motion events through the X11 event filter for positions on the window decoration. These are passed into the screen edge filter which pushes the pointer back and warps our Wayland pointer. To solve this problem KWin no longer performs any actions for pointer motion in the X11 event filter if not on X11. The event filter needs to be reworked and most of it should be moved into the Platform API, if possible. TEST PLAN Reproduced situations where one could see that pointer updates don't trigger leave. E.g. going from a highlighted window to the decoration. REPOSITORY rKWIN KWin BRANCH warp-x11-pointer-on-surface-leave REVISION DETAIL https://phabricator.kde.org/D2531 AFFECTED FILES events.cpp pointer_input.cpp pointer_input.h EMAIL PREFERENCES https://phabricator.kde.org/settings/panel/emailpreferences/ To: graesslin, #kwin, #plasma_on_wayland, bshah Cc: plasma-devel, kwin, lesliezhai, ali-mohamed, hardening, jensreuterberg, abetts, sebas