[PATCH xserver v3 2/2] xwayland: Disable RR ConstrainCursorHarder()

Olivier Fourdan ofourdan at redhat.com
Tue Feb 7 14:31:23 UTC 2017


RRScreenInit() will install its own ConstrainCursorHarder() handler that
will apply pointer constraints depending on the RR config, including the
current rotation.

In the case of Xwayland, the output size is already swapped when
rotated, so the default ConstrainCursorHarder() will set the wrong
limits on the pointer.

Disable the ConstrainCursorHarder() handler set by RRScreenInit() to
avoid the issue.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=99663
Signed-off-by: Olivier Fourdan <ofourdan at redhat.com>
---
 v3: Split the patch in two as there two issues. The second issue being
     the pointer events not being reported when a rotation is applied
     this is because of the RR ConstrainCursorHarder() handler that we
     should not need in Xwayland.

 hw/xwayland/xwayland-output.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/hw/xwayland/xwayland-output.c b/hw/xwayland/xwayland-output.c
index bdf270a..613662b 100644
--- a/hw/xwayland/xwayland-output.c
+++ b/hw/xwayland/xwayland-output.c
@@ -339,14 +339,22 @@ xwl_randr_set_config(ScreenPtr pScreen,
 Bool
 xwl_screen_init_output(struct xwl_screen *xwl_screen)
 {
+    ScreenPtr pScreen = xwl_screen->screen;
+    ConstrainCursorHarderProcPtr ConstrainCursorHarder;
     rrScrPrivPtr rp;
 
-    if (!RRScreenInit(xwl_screen->screen))
+    /* Save current ConstrainCursorHarder handler, if any */
+    ConstrainCursorHarder = pScreen->ConstrainCursorHarder;
+
+    if (!RRScreenInit(pScreen))
         return FALSE;
 
-    RRScreenSetSizeRange(xwl_screen->screen, 320, 200, 8192, 8192);
+    /* Restore previous ConstrainCursorHarder handler */
+    pScreen->ConstrainCursorHarder = ConstrainCursorHarder;
+
+    RRScreenSetSizeRange(pScreen, 320, 200, 8192, 8192);
 
-    rp = rrGetScrPriv(xwl_screen->screen);
+    rp = rrGetScrPriv(pScreen);
     rp->rrGetInfo = xwl_randr_get_info;
     rp->rrSetConfig = xwl_randr_set_config;
 
-- 
2.9.3



More information about the xorg-devel mailing list