diff options
Diffstat (limited to 'xorg-server/dix/devices.c')
-rw-r--r-- | xorg-server/dix/devices.c | 33 |
1 files changed, 20 insertions, 13 deletions
diff --git a/xorg-server/dix/devices.c b/xorg-server/dix/devices.c index 0ccf25277..ab8a648a9 100644 --- a/xorg-server/dix/devices.c +++ b/xorg-server/dix/devices.c @@ -2406,7 +2406,6 @@ int AttachDevice(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr master) { ScreenPtr screen; - DeviceIntPtr oldmaster; if (!dev || IsMaster(dev)) return BadDevice; @@ -2425,7 +2424,6 @@ AttachDevice(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr master) free(dev->spriteInfo->sprite); } - oldmaster = GetMaster(dev, MASTER_ATTACHED); dev->master = master; /* If device is set to floating, we need to create a sprite for it, @@ -2484,16 +2482,22 @@ GetPairedDevice(DeviceIntPtr dev) /** - * Returns the right master for the type of event needed. If the event is a - * keyboard event. - * This function may be called with a master device as argument. If so, the - * returned master is either the device itself or the paired master device. - * If dev is a floating slave device, NULL is returned. + * Returns the requested master for this device. + * The return values are: + * - MASTER_ATTACHED: the master for this device or NULL for a floating + * slave. + * - MASTER_KEYBOARD: the master keyboard for this device or NULL for a + * floating slave + * - MASTER_POINTER: the master keyboard for this device or NULL for a + * floating slave + * - POINTER_OR_FLOAT: the master pointer for this device or the device for + * a floating slave + * - KEYBOARD_OR_FLOAT: the master keyboard for this device or the device for + * a floating slave * - * @type ::MASTER_KEYBOARD or ::MASTER_POINTER or ::MASTER_ATTACHED - * @return The requested master device. In the case of MASTER_ATTACHED, this - * is the directly attached master to this device, regardless of the type. - * Otherwise, it is either the master keyboard or pointer for this device. + * @param which ::MASTER_KEYBOARD or ::MASTER_POINTER, ::MASTER_ATTACHED, + * ::POINTER_OR_FLOAT or ::KEYBOARD_OR_FLOAT. + * @return The requested master device */ DeviceIntPtr GetMaster(DeviceIntPtr dev, int which) @@ -2502,12 +2506,15 @@ GetMaster(DeviceIntPtr dev, int which) if (IsMaster(dev)) master = dev; - else + else { master = dev->master; + if (!master && (which == POINTER_OR_FLOAT || which == KEYBOARD_OR_FLOAT)) + return dev; + } if (master && which != MASTER_ATTACHED) { - if (which == MASTER_KEYBOARD) + if (which == MASTER_KEYBOARD || which == KEYBOARD_OR_FLOAT) { if (master->type != MASTER_KEYBOARD) master = GetPairedDevice(master); |