input: Only release SD buttons for explicit floating/reattachment (#36146)

Grabbing an SD device temporary floats the device but we must not release
the buttons. Introduced in

    commit 9d23459415
    Author: Peter Hutterer <peter.hutterer@who-t.net>
    Date:   Fri Feb 25 11:08:19 2011 +1000

    dix: release all buttons and keys before reattaching a device (#34182)

X.Org Bug 36146 <http://bugs.freedesktop.org/show_bug.cgi?id=36146>

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
This commit is contained in:
Peter Hutterer 2011-04-15 14:06:20 +10:00
parent 73de542104
commit bf2059b07a
3 changed files with 5 additions and 3 deletions

View File

@ -355,6 +355,7 @@ detach_slave(ClientPtr client, xXIDetachSlaveInfo *c, int flags[MAXDEVICES])
goto unwind;
}
ReleaseButtonsAndKeys(dev);
AttachDevice(client, dev, NULL);
flags[dev->id] |= XISlaveDetached;
@ -406,6 +407,7 @@ attach_slave(ClientPtr client, xXIAttachSlaveInfo *c,
goto unwind;
}
ReleaseButtonsAndKeys(dev);
AttachDevice(client, dev, newmaster);
flags[dev->id] |= XISlaveAttached;

View File

@ -2365,7 +2365,7 @@ RecalculateMasterButtons(DeviceIntPtr slave)
* Generate release events for all keys/button currently down on this
* device.
*/
static void
void
ReleaseButtonsAndKeys(DeviceIntPtr dev)
{
EventListPtr eventlist = InitEventList(GetMaximumEventsNum());
@ -2434,8 +2434,6 @@ AttachDevice(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr master)
free(dev->spriteInfo->sprite);
}
ReleaseButtonsAndKeys(dev);
oldmaster = GetMaster(dev, MASTER_ATTACHED);
dev->master = master;

View File

@ -495,6 +495,8 @@ extern _X_EXPORT int GetMotionHistory(
ScreenPtr pScreen,
BOOL core);
extern void ReleaseButtonsAndKeys(DeviceIntPtr dev);
extern int AttachDevice(ClientPtr client,
DeviceIntPtr slave,
DeviceIntPtr master);