Bug 43635

Summary: XIFloatingSlave pointer not rotated properly
Product: xorg Reporter: Anisse Astier <anisse>
Component: Server/Input/CoreAssignee: Peter Hutterer <peter.hutterer>
Status: RESOLVED FIXED QA Contact: Xorg Project Team <xorg-team>
Severity: major    
Priority: high CC: chase.douglas, jeremyhu
Version: 7.6 (2010.12)   
Hardware: All   
OS: Linux (All)   
Whiteboard: 2011BRB_Reviewed
i915 platform: i915 features:
Bug Depends on:    
Bug Blocks: 40982    

Description Anisse Astier 2011-12-08 08:42:49 UTC
When setting an input pointer as a floating slave (xinput float <deviceid>), and then rotating the screen with RandR (xrandr -o left), the device coordinate boundaries are not swapped accordingly.

Which means that if I have a 1366x768 screen, the device will be locked at 768 in width after rotating, having an effective reach of 768x768, leaving 459264 sad pixels that cannot be clicked or hovered anymore.

If I reattach the device with a master and float it again, it's properly rotated. But I have to do that everytime I rotate the screen.

I tested and reproduced this with xserver 1.11 and xinput test-xi2.
Comment 1 Jeremy Huddleston Sequoia 2012-01-02 12:55:02 UTC
It sounds like RandR needs to be hit upside the head by Peter.  It should be 
easy enough to adjust the floating pointer bounds in RandR, so let's try to fix 
this for 1.12.
Comment 2 Peter Hutterer 2012-01-08 21:19:36 UTC
http://patchwork.freedesktop.org/patch/8672/
Comment 3 Anisse Astier 2012-01-09 07:02:49 UTC
I've tested the patch on xserver 1.7 (a bit modified, see below), it works as intended. Thanks a lot!


Index: xorg-server-1.7.7/dix/events.c
===================================================================
--- xorg-server-1.7.7.orig/dix/events.c	2012-01-09 11:26:35.000000000 +0100
+++ xorg-server-1.7.7/dix/events.c	2012-01-09 11:48:17.000000000 +0100
@@ -1355,7 +1355,7 @@
 
     for (pDev = inputInfo.devices; pDev; pDev = pDev->next)
     {
-        if (!DevHasCursor(pDev))
+        if (!(GetMaster(pDev, MASTER_KEYBOARD) == NULL) && !DevHasCursor(pDev))
             continue;
 
         /* GrabDevice doesn't have a confineTo field, so we don't need to



I can now throw away the fugly code I had written to workaround this bug:

void attach_and_float(Display *display, XIDeviceInfo *master, XIDeviceInfo *slave)
{
        XIDetachSlaveInfo detach = {
                .type = XIDetachSlave,
                .deviceid = slave->deviceid,
        };
        XIAttachSlaveInfo reattach = {
                .type = XIAttachSlave,
                .deviceid = slave->deviceid,
                .new_master= master->deviceid,
        };
        XIChangeHierarchy(display, (XIAnyHierarchyChangeInfo*)&reattach, 1);
        XIChangeHierarchy(display, (XIAnyHierarchyChangeInfo*)&detach, 1);
}
Comment 4 Jeremy Huddleston Sequoia 2012-01-09 09:04:37 UTC
Reopening.  This should not be closed until it is actually in a release.
Comment 5 Jeremy Huddleston Sequoia 2012-01-09 09:05:11 UTC
Correction, I meant until it is actually on a release branch.
Comment 6 Peter Hutterer 2012-01-15 16:56:22 UTC
commit 35bd77e9d0701daae87d681900d749604fc6471f
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Mon Jan 9 15:04:10 2012 +1000

    dix: Update pointer limits for floating devices too (#43635)
Comment 7 Jeremy Huddleston Sequoia 2012-01-18 10:58:56 UTC
This is also on server-1.11-branch

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.