summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Xi/xichangehierarchy.c2
-rw-r--r--dix/devices.c4
-rw-r--r--include/input.h2
3 files changed, 5 insertions, 3 deletions
diff --git a/Xi/xichangehierarchy.c b/Xi/xichangehierarchy.c
index 0736a5a36..96ead6fcd 100644
--- a/Xi/xichangehierarchy.c
+++ b/Xi/xichangehierarchy.c
@@ -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;
diff --git a/dix/devices.c b/dix/devices.c
index 3f46ad6fb..7968c7357 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -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;
diff --git a/include/input.h b/include/input.h
index 86078daee..6799a53dd 100644
--- a/include/input.h
+++ b/include/input.h
@@ -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);