summaryrefslogtreecommitdiff
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 11:31:55 -0700
commit6893f9d0a6c7d673ddd7239a4423f633cd3d9b51 (patch)
treed6fa027f9fe0dbc0f64e97176cc2e88b2b6dcd90
parent4da966941812a1ff3f4b1bfc2ca15f15c5b1e020 (diff)
privates: Allow device privates to be allocated after server startscreen-specific-privates
This will permit midispcur to allocate its privates for hotplug outputs Signed-off-by: Keith Packard <keithp@keithp.com>
-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