Peter Hutterer wrote: > patches welcome :) Here y'r. :)
>From e25f0f7c38c9f5d5cfab4a20fe42ee5cbf38d012 Mon Sep 17 00:00:00 2001 From: Simon Thum <simon.t...@gmx.de> Date: Fri, 23 Jan 2009 11:39:56 +0100 Subject: [PATCH] xinput: create well-known atoms on demand, rather than preinit them
--- Xi/extinit.c | 1 - Xi/xiproperty.c | 32 ++++++++++++-------------------- Xi/xiproperty.h | 2 -- 3 files changed, 12 insertions(+), 23 deletions(-) diff --git a/Xi/extinit.c b/Xi/extinit.c index 62ec958..a7a21ec 100644 --- a/Xi/extinit.c +++ b/Xi/extinit.c @@ -1143,7 +1143,6 @@ XInputExtensionInit(void) IEventBase = extEntry->eventBase; AllExtensionVersions[IReqCode - 128] = thisversion; MakeDeviceTypeAtoms(); - XIInitKnownProperties(); RT_INPUTCLIENT = CreateNewResourceType((DeleteType) InputClientGone); RegisterResourceName(RT_INPUTCLIENT, "INPUTCLIENT"); FixExtensionEvents(extEntry); diff --git a/Xi/xiproperty.c b/Xi/xiproperty.c index 53b2f6a..db32735 100644 --- a/Xi/xiproperty.c +++ b/Xi/xiproperty.c @@ -60,7 +60,7 @@ static struct dev_properties static long XIPropHandlerID = 1; /** - * Return the type assigned to the specified atom or 0 if the atom isn't known + * Return the atom assigned to the specified string or 0 if the atom isn't known * to the DIX. */ Atom @@ -69,8 +69,18 @@ XIGetKnownProperty(char *name) int i; for (i = 0; i < (sizeof(dev_properties)/sizeof(struct dev_properties)); i++) { - if (strcmp(name, dev_properties[i].name) == 0) + if (strcmp(name, dev_properties[i].name) == 0){ + if (dev_properties[i].type == None){ + dev_properties[i].type = + MakeAtom(dev_properties[i].name, + strlen(dev_properties[i].name), + TRUE); + // Here we should probably die on failure. + // For now, leave it to the caller + } + return dev_properties[i].type; + } } return 0; @@ -195,24 +205,6 @@ XIPropToFloat(XIPropertyValuePtr val, int *nelem_return, float **buf_return) return Success; } -/** - * Init those properties that are allocated by the server and most likely used - * by the DIX or the DDX. - */ -void -XIInitKnownProperties(void) -{ - int i; - for (i = 0; i < (sizeof(dev_properties)/sizeof(struct dev_properties)); i++) - { - dev_properties[i].type = - MakeAtom(dev_properties[i].name, - strlen(dev_properties[i].name), - TRUE); - } -} - - /* Registers a new property handler on the given device and returns a unique * identifier for this handler. This identifier is required to unregister the * property handler again. diff --git a/Xi/xiproperty.h b/Xi/xiproperty.h index 12026e9..bf562b1 100644 --- a/Xi/xiproperty.h +++ b/Xi/xiproperty.h @@ -43,6 +43,4 @@ void SRepXListDeviceProperties(ClientPtr client, int size, void SRepXGetDeviceProperty(ClientPtr client, int size, xGetDevicePropertyReply *rep); -void XIInitKnownProperties(void); - #endif /* XIPROPERTY_C */ -- 1.6.0.6
_______________________________________________ xorg mailing list xorg@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/xorg