Bug 104426

Summary: Xwayland: XWarpPointer does not move the pointer if src_w == root window
Product: Wayland Reporter: Lukáš Krejčí <lskrejci>
Component: XWaylandAssignee: Wayland bug list <wayland-bugs>
Status: RESOLVED FIXED QA Contact: Xorg Project Team <xorg-team>
Severity: normal    
Priority: medium CC: jan.public, kparal
Version: unspecified   
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
See Also: https://bugs.freedesktop.org/show_bug.cgi?id=101970
https://bugs.freedesktop.org/show_bug.cgi?id=84644
Whiteboard:
i915 platform: i915 features:
Attachments: pointer warp test program

Description Lukáš Krejčí 2018-01-01 00:54:09 UTC
Created attachment 136466 [details]
pointer warp test program

Distribution: Arch Linux

xorg-server-xwayland 1.19.6-2
gnome-shell 3.26.2+9+ga3736d3a3-1
mutter 3.26.2+31+gbf91e2b4c-1
libxfixes 5.0.3-1
gcc 7.2.1-2

When XWarpPointer is called with the src_w parameter set to DefaultRootWindow(display), like e.g. Wine calls it, the function does not move the pointer to the desired position under rootless XWayland. This is because PointInWindowIsVisible (https://cgit.freedesktop.org/xorg/xserver/tree/dix/events.c?h=server-1.19-branch&id=ebfb06b11955a6c32500b7086be912ab96b753a7#n3578) returns false due to the fact that the borderClip property of the root window is initialized to RegionNull(&window->borderClip):

borderClip = {extents = {x1 = 0, y1 = 0, x2 = 0, y2 = 0}, data = 0x56386383b280 <RegionEmptyData>}
RegionEmptyData = {size = 0, numRects = 0}

How to reproduce:
1. Download the attached test program source
2. $ gcc -std=c11 -lX11 -lXfixes pointer_warp_test.c -o pointer_warp_test
3. start gnome-shell for Wayland
4. run the compiled binary $ ./pointer_warp_test
5. press tab while the pointer is inside the window
6. move the pointer and observe its behavior
- the smaller square represents the position of the real pointer as the application sees it
- the larger square represents the application cursor
7. the test program exhibits the correct behavior if the application cursor exactly follows mouse movements
   and the real cursor stays near the middle, as it is continually warped there; the real cursor, however, does not stay
   in the middle because it is not warped at all

The issue can also be reproduced in the Windows version of OpenArena under Wine. Wine has to have virtual desktop emulation disabled (winecfg -> Graphics tab -> Emulate a virtual desktop) in order for the the issue to be present.
Comment 1 Lukáš Krejčí 2018-05-23 12:16:56 UTC
Fixed in xorg-server 1.20 by commit f065721e6fa6e9057cca4eadaf145a4dc22a08d2 ("dix: assume warping on the RootWindow always happens on visible coords").

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.