diff options
author | Keith Packard <keithp@keithp.com> | 2012-07-05 11:31:55 -0700 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2012-07-05 13:40:27 -0700 |
commit | 9e4b8b74b008dd72d1da7074bd7ecae677cefd20 (patch) | |
tree | bc5f6c178ba7b6ecf9eb5868b2d1ce65dad2708f | |
parent | 493ad833233707b0a42e5fbdd957a24fc6e52917 (diff) |
privates: Allow device privates to be allocated after server start
This will permit midispcur to allocate its privates for hotplug outputs
Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
-rw-r--r-- | dix/privates.c | 22 | ||||
-rw-r--r-- | include/privates.h | 2 |
2 files changed, 22 insertions, 2 deletions
diff --git a/dix/privates.c b/dix/privates.c index e353108f8..b58085ffd 100644 --- a/dix/privates.c +++ b/dix/privates.c @@ -62,6 +62,7 @@ from The Open Group. #include "inputstr.h" #include "scrnintstr.h" #include "extnsionst.h" +#include "inputstr.h" static DevPrivateSetRec global_keys[PRIVATE_LAST]; @@ -91,9 +92,9 @@ static const char *key_names[PRIVATE_LAST] = { [PRIVATE_SCREEN] = "SCREEN", [PRIVATE_EXTENSION] = "EXTENSION", [PRIVATE_COLORMAP] = "COLORMAP", + [PRIVATE_DEVICE] = "DEVICE", /* These cannot have any objects before all relevant keys are registered */ - [PRIVATE_DEVICE] = "DEVICE", [PRIVATE_CLIENT] = "CLIENT", [PRIVATE_PROPERTY] = "PROPERTY", [PRIVATE_SELECTION] = "SELECTION", @@ -265,11 +266,30 @@ fixupDefaultColormaps(FixupFunc fixup, unsigned bytes) return TRUE; } +static Bool +fixupDeviceList(DeviceIntPtr device, FixupFunc fixup, unsigned bytes) +{ + while (device) { + if (!fixup(&device->devPrivates, global_keys[PRIVATE_DEVICE].offset, bytes)) + return FALSE; + device = device->next; + } + return TRUE; +} + +static Bool +fixupDevices(FixupFunc fixup, unsigned bytes) +{ + return (fixupDeviceList(inputInfo.devices, fixup, bytes) && + fixupDeviceList(inputInfo.off_devices, fixup, bytes)); +} + static Bool (*const allocated_early[PRIVATE_LAST]) (FixupFunc, unsigned) = { [PRIVATE_SCREEN] = fixupScreens, [PRIVATE_CLIENT] = fixupServerClient, [PRIVATE_EXTENSION] = fixupExtensions, [PRIVATE_COLORMAP] = fixupDefaultColormaps, + [PRIVATE_DEVICE] = fixupDevices, }; static void diff --git a/include/privates.h b/include/privates.h index a0874f697..2c8864b8a 100644 --- a/include/privates.h +++ b/include/privates.h @@ -33,9 +33,9 @@ typedef enum { PRIVATE_SCREEN, PRIVATE_EXTENSION, PRIVATE_COLORMAP, + PRIVATE_DEVICE, /* These cannot have any objects before all relevant keys are registered */ - PRIVATE_DEVICE, PRIVATE_CLIENT, PRIVATE_PROPERTY, PRIVATE_SELECTION, |