Warp the xcb pointer whenever pointer leaves an X11 surface
ClosedPublic

Authored by graesslin on Aug 22 2016, 5:30 PM.

Details

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.

Diff Detail

Repository
R108 KWin
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
graesslin updated this revision to Diff 6151.Aug 22 2016, 5:30 PM
graesslin retitled this revision from to Warp the xcb pointer whenever pointer leaves an X11 surface.
graesslin updated this object.
graesslin edited the test plan for this revision. (Show Details)
Restricted Application added projects: Plasma on Wayland, KWin. · View Herald TranscriptAug 22 2016, 5:30 PM
Restricted Application added subscribers: kwin, plasma-devel. · View Herald Transcript

Could one map/unmap an InputOnly window instead to trigger a (differen) leave notify event? (or would unmapping the window cause a - disturbing? - enter notify event?)

Could one map/unmap an InputOnly window instead to trigger a (differen) leave notify event? (or would unmapping the window cause a - disturbing? - enter notify event?)

I guess it wouldn't help against pointer grabs (that is context menu)

Errr.... you should get a LeaveNotify on grabs and an EnterNotify on releases anyway (but I do not really understand the tackled problem)

The problem will be fixed in Xwayland 1.19, see https://bugs.freedesktop.org/show_bug.cgi?id=96437

I would suggest to nevertheless integrate it till 1.19 is released.

graesslin updated this revision to Diff 6190.Aug 23 2016, 11:50 AM

Added a version check to only do the warping if we don't have 1.19

bshah accepted this revision.Aug 23 2016, 11:51 AM
bshah edited edge metadata.

Has been running it from start of day, and seems to fix the issue..

This revision is now accepted and ready to land.Aug 23 2016, 11:52 AM
graesslin updated this revision to Diff 6191.Aug 23 2016, 11:52 AM
graesslin edited edge metadata.

Remove the QEXPECT_FAIL from test case

This revision was automatically updated to reflect the committed changes.