summaryrefslogtreecommitdiff
path: root/dix/privates.c
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2012-07-05 11:31:55 -0700
committerKeith Packard <keithp@keithp.com>2012-07-05 13:40:27 -0700
commit9e4b8b74b008dd72d1da7074bd7ecae677cefd20 (patch)
treebc5f6c178ba7b6ecf9eb5868b2d1ce65dad2708f /dix/privates.c
parent493ad833233707b0a42e5fbdd957a24fc6e52917 (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>
Diffstat (limited to 'dix/privates.c')
-rw-r--r--dix/privates.c22
1 files changed, 21 insertions, 1 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