summaryrefslogtreecommitdiff
path: root/Xi
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2009-08-11 16:27:40 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2009-08-17 13:25:35 +1000
commit2851f04cb2f6e5c30267f733d867c86d4e69a485 (patch)
tree561a48049c8767749c7f67133fee59d2501e0142 /Xi
parentc1d901d723c3bee523736eacc15b44a7dff484fe (diff)
dix: rework DeviceChangedEvents a bit.
DCEs are now processed when sent throught the master device, not when sent through the slave device. This includes a removal of some un-used (or partly used) fields in the DCE itself to something more self-explanatory. TODO: if a device has events queued and its attachment is changed, the DCE is silently dropped now. Instead, it should be generated as soon as the first event after the attachment is sent. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'Xi')
-rw-r--r--Xi/exevents.c26
1 files changed, 17 insertions, 9 deletions
diff --git a/Xi/exevents.c b/Xi/exevents.c
index 22126492a..2377d054e 100644
--- a/Xi/exevents.c
+++ b/Xi/exevents.c
@@ -699,23 +699,31 @@ XISendDeviceChangedEvent(DeviceIntPtr device, DeviceIntPtr master, DeviceChanged
static void
ChangeMasterDeviceClasses(DeviceIntPtr device, DeviceChangedEvent *dce)
{
- DeviceIntPtr master = device->u.master;
+ DeviceIntPtr slave;
+ int rc;
- if (IsMaster(device))
+ /* For now, we don't have devices that change physically. */
+ if (!IsMaster(device))
return;
- if (!master) /* if device was set floating between SIGIO and now */
- return;
+ rc = dixLookupDevice(&slave, dce->sourceid, serverClient, DixReadAccess);
+
+ if (rc != Success)
+ return; /* Device has disappeared */
+
+ if (!slave->u.master)
+ return; /* set floating since the event */
+ if (slave->u.master->id != dce->masterid)
+ return; /* not our slave anymore, don't care */
- master = GetMaster(device,
- (dce->flags & DEVCHANGE_POINTER_EVENT) ? MASTER_POINTER : MASTER_KEYBOARD);
+ /* FIXME: we probably need to send a DCE for the new slave now */
- master->public.devicePrivate = device->public.devicePrivate;
+ device->public.devicePrivate = slave->public.devicePrivate;
/* FIXME: the classes may have changed since we generated the event. */
- DeepCopyDeviceClasses(device, master, dce);
- XISendDeviceChangedEvent(device, master, dce);
+ DeepCopyDeviceClasses(slave, device, dce);
+ XISendDeviceChangedEvent(slave, device, dce);
}
/**