diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2009-05-12 14:50:57 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2009-05-16 12:20:58 +1000 |
commit | 033a2b12fcd02fa9a2c2f20a352bec0a43074512 (patch) | |
tree | c4bde33c48bccf3710bbc8c23d2e95d8cae00e68 /dix/devices.c | |
parent | 8fb51feae222ff4f4aa1c440b6973ce7383bbc09 (diff) |
Xi: set per-device hierarchy changed flags.
Rather than have one field per hierarchy change, XI2 has two fields - one
generic one and one per-device that include the device-specific flags.
This requires some funky handling for removed devices, but oh well.
Diffstat (limited to 'dix/devices.c')
-rw-r--r-- | dix/devices.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/dix/devices.c b/dix/devices.c index dc5de0526..c59457f1d 100644 --- a/dix/devices.c +++ b/dix/devices.c @@ -296,6 +296,7 @@ EnableDevice(DeviceIntPtr dev) int listlen; EventListPtr evlist; BOOL enabled; + int flags[MAXDEVICES] = {0}; for (prev = &inputInfo.off_devices; *prev && (*prev != dev); @@ -361,7 +362,8 @@ EnableDevice(DeviceIntPtr dev) TRUE); SendDevicePresenceEvent(dev->id, DeviceEnabled); - XISendDeviceHierarchyEvent(XIDeviceEnabled); + flags[dev->id] |= XIDeviceEnabled; + XISendDeviceHierarchyEvent(flags); return TRUE; } @@ -381,6 +383,7 @@ DisableDevice(DeviceIntPtr dev) { DeviceIntPtr *prev, other; BOOL enabled; + int flags[MAXDEVICES] = {0}; for (prev = &inputInfo.devices; *prev && (*prev != dev); @@ -395,7 +398,10 @@ DisableDevice(DeviceIntPtr dev) for (other = inputInfo.devices; other; other = other->next) { if (other->u.master == dev) + { AttachDevice(NULL, other, NULL); + flags[other->id] |= XISlaveDetached; + } } } else @@ -432,7 +438,8 @@ DisableDevice(DeviceIntPtr dev) TRUE); SendDevicePresenceEvent(dev->id, DeviceDisabled); - XISendDeviceHierarchyEvent(XIDeviceDisabled); + flags[dev->id] = XIDeviceDisabled; + XISendDeviceHierarchyEvent(flags); return TRUE; } @@ -450,6 +457,7 @@ ActivateDevice(DeviceIntPtr dev) { int ret = Success; ScreenPtr pScreen = screenInfo.screens[0]; + int flags[MAXDEVICES]; if (!dev || !dev->deviceProc) return BadImplementation; @@ -464,7 +472,8 @@ ActivateDevice(DeviceIntPtr dev) pScreen->DeviceCursorInitialize(dev, pScreen); SendDevicePresenceEvent(dev->id, DeviceAdded); - XISendDeviceHierarchyEvent(XISlaveAdded); + flags[dev->id] = XISlaveAdded; + XISendDeviceHierarchyEvent(flags); return ret; } @@ -929,6 +938,7 @@ RemoveDevice(DeviceIntPtr dev) ScreenPtr screen = screenInfo.screens[0]; int deviceid; int initialized; + int flags[MAXDEVICES] = {0}; DebugF("(dix) removing device %d\n", dev->id); @@ -944,6 +954,7 @@ RemoveDevice(DeviceIntPtr dev) screen->DisplayCursor(dev, screen, NullCursor); DisableDevice(dev); + flags[dev->id] = XIDeviceDisabled; } prev = NULL; @@ -956,6 +967,7 @@ RemoveDevice(DeviceIntPtr dev) else prev->next = next; + flags[tmp->id] = (tmp->isMaster) ? XIMasterRemoved : XISlaveRemoved; CloseDevice(tmp); ret = Success; } @@ -965,6 +977,7 @@ RemoveDevice(DeviceIntPtr dev) for (tmp = inputInfo.off_devices; tmp; (prev = tmp), (tmp = next)) { next = tmp->next; if (tmp == dev) { + flags[tmp->id] = (tmp->isMaster) ? XIMasterRemoved : XISlaveRemoved; CloseDevice(tmp); if (prev == NULL) @@ -979,7 +992,7 @@ RemoveDevice(DeviceIntPtr dev) if (ret == Success && initialized) { inputInfo.numDevices--; SendDevicePresenceEvent(deviceid, DeviceRemoved); - XISendDeviceHierarchyEvent(XISlaveRemoved); + XISendDeviceHierarchyEvent(flags); } return ret; |