summaryrefslogtreecommitdiff
path: root/Xi
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@redhat.com>2008-09-18 15:58:46 +0930
committerPeter Hutterer <peter.hutterer@redhat.com>2008-09-26 13:32:05 +0930
commit1e24e7b9df3d02350c7ea18e9379e87fe4d00026 (patch)
tree578a86f4eb88598fe246e909a6bb43ebc4667df2 /Xi
parentfeaa5fa6712c8c6f4ca97766e2ac0338253cf3b8 (diff)
Xi: remove configure/query device property calls.
This removes all the meta-information about device properties (pending, fromClient, range, valid_values, immutable).
Diffstat (limited to 'Xi')
-rw-r--r--Xi/extinit.c58
-rw-r--r--Xi/xiproperty.c282
-rw-r--r--Xi/xiproperty.h6
3 files changed, 69 insertions, 277 deletions
diff --git a/Xi/extinit.c b/Xi/extinit.c
index 595e3582f..9d0ca7869 100644
--- a/Xi/extinit.c
+++ b/Xi/extinit.c
@@ -211,22 +211,20 @@ static int (*ProcIVector[])(ClientPtr) = {
ProcXChangeDeviceControl, /* 35 */
/* XI 1.5 */
ProcXListDeviceProperties, /* 36 */
- ProcXQueryDeviceProperty, /* 37 */
- ProcXConfigureDeviceProperty, /* 38 */
- ProcXChangeDeviceProperty, /* 39 */
- ProcXDeleteDeviceProperty, /* 40 */
- ProcXGetDeviceProperty, /* 41 */
+ ProcXChangeDeviceProperty, /* 37 */
+ ProcXDeleteDeviceProperty, /* 38 */
+ ProcXGetDeviceProperty, /* 39 */
/* XI 2 */
- ProcXQueryDevicePointer, /* 42 */
- ProcXWarpDevicePointer, /* 43 */
- ProcXChangeDeviceCursor, /* 44 */
- ProcXChangeDeviceHierarchy, /* 45 */
- ProcXChangeWindowAccess, /* 46 */
- ProcXQueryWindowAccess, /* 47 */
- ProcXSetClientPointer, /* 48 */
- ProcXGetClientPointer, /* 49 */
- ProcXiSelectEvent, /* 50 */
- ProcXExtendedGrabDevice /* 51 */
+ ProcXQueryDevicePointer, /* 40 */
+ ProcXWarpDevicePointer, /* 41 */
+ ProcXChangeDeviceCursor, /* 42 */
+ ProcXChangeDeviceHierarchy, /* 43 */
+ ProcXChangeWindowAccess, /* 44 */
+ ProcXQueryWindowAccess, /* 45 */
+ ProcXSetClientPointer, /* 46 */
+ ProcXGetClientPointer, /* 47 */
+ ProcXiSelectEvent, /* 48 */
+ ProcXExtendedGrabDevice /* 49 */
};
/* For swapped clients */
@@ -268,21 +266,19 @@ static int (*SProcIVector[])(ClientPtr) = {
SProcXGetDeviceControl, /* 34 */
SProcXChangeDeviceControl, /* 35 */
SProcXListDeviceProperties, /* 36 */
- SProcXQueryDeviceProperty, /* 37 */
- SProcXConfigureDeviceProperty, /* 38 */
- SProcXChangeDeviceProperty, /* 39 */
- SProcXDeleteDeviceProperty, /* 40 */
- SProcXGetDeviceProperty, /* 41 */
- SProcXQueryDevicePointer, /* 42 */
- SProcXWarpDevicePointer, /* 43 */
- SProcXChangeDeviceCursor, /* 44 */
- SProcXChangeDeviceHierarchy, /* 45 */
- SProcXChangeWindowAccess, /* 46 */
- SProcXQueryWindowAccess, /* 47 */
- SProcXSetClientPointer, /* 48 */
- SProcXGetClientPointer, /* 49 */
- SProcXiSelectEvent, /* 50 */
- SProcXExtendedGrabDevice /* 51 */
+ SProcXChangeDeviceProperty, /* 37 */
+ SProcXDeleteDeviceProperty, /* 38 */
+ SProcXGetDeviceProperty, /* 39 */
+ SProcXQueryDevicePointer, /* 40 */
+ SProcXWarpDevicePointer, /* 41 */
+ SProcXChangeDeviceCursor, /* 42 */
+ SProcXChangeDeviceHierarchy, /* 43 */
+ SProcXChangeWindowAccess, /* 44 */
+ SProcXQueryWindowAccess, /* 45 */
+ SProcXSetClientPointer, /* 46 */
+ SProcXGetClientPointer, /* 47 */
+ SProcXiSelectEvent, /* 48 */
+ SProcXExtendedGrabDevice /* 49 */
};
/*****************************************************************
@@ -480,8 +476,6 @@ SReplyIDispatch(ClientPtr client, int len, xGrabDeviceReply * rep)
(xChangeDeviceControlReply *) rep);
else if (rep->RepType == X_ListDeviceProperties)
SRepXListDeviceProperties(client, len, (xListDevicePropertiesReply*)rep);
- else if (rep->RepType == X_QueryDeviceProperty)
- SRepXQueryDeviceProperty(client, len, (xQueryDevicePropertyReply*)rep);
else if (rep->RepType == X_GetDeviceProperty)
SRepXGetDeviceProperty(client, len, (xGetDevicePropertyReply *) rep);
else if (rep->RepType == X_QueryDevicePointer)
diff --git a/Xi/xiproperty.c b/Xi/xiproperty.c
index df93de5a6..425cd753b 100644
--- a/Xi/xiproperty.c
+++ b/Xi/xiproperty.c
@@ -138,15 +138,6 @@ XIUnRegisterPropertyHandler(DeviceIntPtr dev, long id)
xfree(curr);
}
-static void
-XIInitDevicePropertyValue (XIPropertyValuePtr property_value)
-{
- property_value->type = None;
- property_value->format = 0;
- property_value->size = 0;
- property_value->data = NULL;
-}
-
static XIPropertyPtr
XICreateDeviceProperty (Atom property)
{
@@ -156,29 +147,32 @@ XICreateDeviceProperty (Atom property)
if (!prop)
return NULL;
- prop->next = NULL;
- prop->propertyName = property;
- prop->is_pending = FALSE;
- prop->range = FALSE;
- prop->fromClient = FALSE;
- prop->immutable = FALSE;
- prop->num_valid = 0;
- prop->valid_values = NULL;
-
- XIInitDevicePropertyValue (&prop->current);
- XIInitDevicePropertyValue (&prop->pending);
+ prop->next = NULL;
+ prop->propertyName = property;
+ prop->value.type = None;
+ prop->value.format = 0;
+ prop->value.size = 0;
+ prop->value.data = NULL;
+
return prop;
}
+static XIPropertyPtr
+XIFetchDeviceProperty(DeviceIntPtr dev, Atom property)
+{
+ XIPropertyPtr prop;
+
+ for (prop = dev->properties.properties; prop; prop = prop->next)
+ if (prop->propertyName == property)
+ return prop;
+ return NULL;
+}
+
static void
XIDestroyDeviceProperty (XIPropertyPtr prop)
{
- if (prop->valid_values)
- xfree (prop->valid_values);
- if (prop->current.data)
- xfree(prop->current.data);
- if (prop->pending.data)
- xfree(prop->pending.data);
+ if (prop->value.data)
+ xfree(prop->value.data);
xfree(prop);
}
@@ -229,9 +223,6 @@ XIDeleteDeviceProperty (DeviceIntPtr device, Atom property, Bool fromClient)
if (prop->propertyName == property)
break;
- if (!prop->fromClient && fromClient)
- return BadAtom;
-
if (prop)
{
*prev = prop->next;
@@ -251,8 +242,7 @@ XIDeleteDeviceProperty (DeviceIntPtr device, Atom property, Bool fromClient)
int
XIChangeDeviceProperty (DeviceIntPtr dev, Atom property, Atom type,
int format, int mode, unsigned long len,
- pointer value, Bool sendevent, Bool pending,
- Bool fromClient)
+ pointer value, Bool sendevent)
{
XIPropertyPtr prop;
devicePropertyNotify event;
@@ -266,20 +256,16 @@ XIChangeDeviceProperty (DeviceIntPtr dev, Atom property, Atom type,
size_in_bytes = format >> 3;
/* first see if property already exists */
- prop = XIQueryDeviceProperty (dev, property);
+ prop = XIFetchDeviceProperty (dev, property);
if (!prop) /* just add to list */
{
prop = XICreateDeviceProperty (property);
if (!prop)
return(BadAlloc);
- prop->fromClient = fromClient;
add = TRUE;
mode = PropModeReplace;
}
- if (pending && prop->is_pending)
- prop_value = &prop->pending;
- else
- prop_value = &prop->current;
+ prop_value = &prop->value;
/* To append or prepend to a property the request format and type
must match those of the already defined property. The
@@ -334,12 +320,7 @@ XIChangeDeviceProperty (DeviceIntPtr dev, Atom property, Atom type,
memcpy ((char *) old_data, (char *) prop_value->data,
prop_value->size * size_in_bytes);
- /* We must set pendingProperties TRUE before we commit to the driver,
- we're in a single thread after all
- */
- if (pending && prop->is_pending)
- dev->properties.pendingProperties = TRUE;
- if (pending && dev->properties.handlers)
+ if (dev->properties.handlers)
{
XIPropertyHandlerPtr handler = dev->properties.handlers;
while(handler)
@@ -357,9 +338,7 @@ XIChangeDeviceProperty (DeviceIntPtr dev, Atom property, Atom type,
if (prop_value->data)
xfree (prop_value->data);
*prop_value = new_value;
- }
-
- else if (len == 0)
+ } else if (len == 0)
{
/* do nothing */
}
@@ -384,97 +363,29 @@ XIChangeDeviceProperty (DeviceIntPtr dev, Atom property, Atom type,
return(Success);
}
-XIPropertyPtr
-XIQueryDeviceProperty (DeviceIntPtr dev, Atom property)
-{
- XIPropertyPtr prop;
-
- for (prop = dev->properties.properties; prop; prop = prop->next)
- if (prop->propertyName == property)
- return prop;
- return NULL;
-}
-
-XIPropertyValuePtr
-XIGetDeviceProperty (DeviceIntPtr dev, Atom property, Bool pending)
+/**
+ *
+ */
+_X_EXPORT XIPropertyValuePtr
+XIGetDeviceProperty (DeviceIntPtr dev, Atom property)
{
- XIPropertyPtr prop = XIQueryDeviceProperty (dev, property);
+ XIPropertyPtr prop = XIFetchDeviceProperty (dev, property);
if (!prop)
return NULL;
- if (pending && prop->is_pending)
- return &prop->pending;
- else {
- /* If we can, try to update the property value first */
- if (dev->properties.handlers)
- {
- XIPropertyHandlerPtr handler = dev->properties.handlers;
- while(handler)
- {
- if (handler->GetProperty)
- handler->GetProperty(dev, prop->propertyName);
- handler = handler->next;
- }
- }
- return &prop->current;
- }
-}
-
-int
-XIConfigureDeviceProperty (DeviceIntPtr dev, Atom property,
- Bool pending, Bool range, Bool immutable,
- int num_values, INT32 *values)
-{
- XIPropertyPtr prop = XIQueryDeviceProperty (dev, property);
- Bool add = FALSE;
- INT32 *new_values;
- if (!prop)
+ /* If we can, try to update the property value first */
+ if (dev->properties.handlers)
{
- prop = XICreateDeviceProperty (property);
- if (!prop)
- return(BadAlloc);
- add = TRUE;
- } else if (prop->immutable && !immutable)
- return(BadAccess);
-
- /*
- * ranges must have even number of values
- */
- if (range && (num_values & 1))
- return BadMatch;
-
- new_values = xalloc (num_values * sizeof (INT32));
- if (!new_values && num_values)
- return BadAlloc;
- if (num_values)
- memcpy (new_values, values, num_values * sizeof (INT32));
-
- /*
- * Property moving from pending to non-pending
- * loses any pending values
- */
- if (prop->is_pending && !pending)
- {
- if (prop->pending.data)
- xfree (prop->pending.data);
- XIInitDevicePropertyValue (&prop->pending);
- }
-
- prop->is_pending = pending;
- prop->range = range;
- prop->immutable = immutable;
- prop->num_valid = num_values;
- if (prop->valid_values)
- xfree (prop->valid_values);
- prop->valid_values = new_values;
-
- if (add) {
- prop->next = dev->properties.properties;
- dev->properties.properties = prop;
+ XIPropertyHandlerPtr handler = dev->properties.handlers;
+ while(handler)
+ {
+ if (handler->GetProperty)
+ handler->GetProperty(dev, prop->propertyName);
+ handler = handler->next;
+ }
}
-
- return Success;
+ return &prop->value;
}
int
@@ -527,71 +438,6 @@ ProcXListDeviceProperties (ClientPtr client)
}
int
-ProcXQueryDeviceProperty (ClientPtr client)
-{
- REQUEST(xQueryDevicePropertyReq);
- xQueryDevicePropertyReply rep;
- DeviceIntPtr dev;
- XIPropertyPtr prop;
- int rc;
-
- REQUEST_SIZE_MATCH(xQueryDevicePropertyReq);
-
- rc = dixLookupDevice (&dev, stuff->deviceid, client, DixReadAccess);
-
- if (rc != Success)
- return rc;
-
- prop = XIQueryDeviceProperty (dev, stuff->property);
- if (!prop)
- return BadName;
-
- rep.repType = X_Reply;
- rep.length = prop->num_valid;
- rep.sequenceNumber = client->sequence;
- rep.pending = prop->is_pending;
- rep.range = prop->range;
- rep.immutable = prop->immutable;
- rep.fromClient = prop->fromClient;
- if (client->swapped)
- {
- int n;
- swaps (&rep.sequenceNumber, n);
- swapl (&rep.length, n);
- }
- WriteReplyToClient (client, sizeof (xQueryDevicePropertyReply), &rep);
- if (prop->num_valid)
- {
- client->pSwapReplyFunc = (ReplySwapPtr)Swap32Write;
- WriteSwappedDataToClient(client, prop->num_valid * sizeof(INT32),
- prop->valid_values);
- }
- return(client->noClientException);
-}
-
-int
-ProcXConfigureDeviceProperty (ClientPtr client)
-{
- REQUEST(xConfigureDevicePropertyReq);
- DeviceIntPtr dev;
- int num_valid;
- int rc;
-
- REQUEST_AT_LEAST_SIZE(xConfigureDevicePropertyReq);
-
- rc = dixLookupDevice (&dev, stuff->deviceid, client, DixReadAccess);
-
- if (rc != Success)
- return rc;
-
- num_valid = stuff->length - (sizeof (xConfigureDevicePropertyReq) >> 2);
- return XIConfigureDeviceProperty (dev, stuff->property,
- stuff->pending, stuff->range,
- FALSE, num_valid,
- (INT32 *) (stuff + 1));
-}
-
-int
ProcXChangeDeviceProperty (ClientPtr client)
{
REQUEST(xChangeDevicePropertyReq);
@@ -641,8 +487,7 @@ ProcXChangeDeviceProperty (ClientPtr client)
rc = XIChangeDeviceProperty(dev, stuff->property,
stuff->type, (int)format,
- (int)mode, len, (pointer)&stuff[1], TRUE,
- TRUE, TRUE);
+ (int)mode, len, (pointer)&stuff[1], TRUE);
return rc;
}
@@ -666,7 +511,6 @@ ProcXDeleteDeviceProperty (ClientPtr client)
return (BadAtom);
}
-
rc = XIDeleteDeviceProperty(dev, stuff->property, TRUE);
return rc;
}
@@ -726,10 +570,7 @@ ProcXGetDeviceProperty (ClientPtr client)
return(client->noClientException);
}
- if (prop->immutable && stuff->delete)
- return BadAccess;
-
- prop_value = XIGetDeviceProperty(dev, stuff->property, stuff->pending);
+ prop_value = XIGetDeviceProperty(dev, stuff->property);
if (!prop_value)
return BadAtom;
@@ -822,32 +663,6 @@ SProcXListDeviceProperties (ClientPtr client)
}
int
-SProcXQueryDeviceProperty (ClientPtr client)
-{
- char n;
- REQUEST(xQueryDevicePropertyReq);
-
- swaps(&stuff->length, n);
- swapl(&stuff->property, n);
-
- REQUEST_SIZE_MATCH(xQueryDevicePropertyReq);
- return (ProcXQueryDeviceProperty(client));
-}
-
-int
-SProcXConfigureDeviceProperty (ClientPtr client)
-{
- char n;
- REQUEST(xConfigureDevicePropertyReq);
-
- swaps(&stuff->length, n);
- swapl(&stuff->property, n);
-
- REQUEST_SIZE_MATCH(xConfigureDevicePropertyReq);
- return (ProcXConfigureDeviceProperty(client));
-}
-
-int
SProcXChangeDeviceProperty (ClientPtr client)
{
char n;
@@ -904,17 +719,6 @@ SRepXListDeviceProperties(ClientPtr client, int size,
}
void
-SRepXQueryDeviceProperty(ClientPtr client, int size,
- xQueryDevicePropertyReply *rep)
-{
- char n;
- swaps(&rep->sequenceNumber, n);
- swapl(&rep->length, n);
-
- WriteToClient(client, size, (char*)rep);
-}
-
-void
SRepXGetDeviceProperty(ClientPtr client, int size,
xGetDevicePropertyReply *rep)
{
diff --git a/Xi/xiproperty.h b/Xi/xiproperty.h
index 11af4bc3c..12026e9e8 100644
--- a/Xi/xiproperty.h
+++ b/Xi/xiproperty.h
@@ -27,16 +27,12 @@
#define XIPROPERTY_C
int ProcXListDeviceProperties (ClientPtr client);
-int ProcXQueryDeviceProperty (ClientPtr client);
-int ProcXConfigureDeviceProperty (ClientPtr client);
int ProcXChangeDeviceProperty (ClientPtr client);
int ProcXDeleteDeviceProperty (ClientPtr client);
int ProcXGetDeviceProperty (ClientPtr client);
/* request swapping */
int SProcXListDeviceProperties (ClientPtr client);
-int SProcXQueryDeviceProperty (ClientPtr client);
-int SProcXConfigureDeviceProperty (ClientPtr client);
int SProcXChangeDeviceProperty (ClientPtr client);
int SProcXDeleteDeviceProperty (ClientPtr client);
int SProcXGetDeviceProperty (ClientPtr client);
@@ -44,8 +40,6 @@ int SProcXGetDeviceProperty (ClientPtr client);
/* reply swapping */
void SRepXListDeviceProperties(ClientPtr client, int size,
xListDevicePropertiesReply *rep);
-void SRepXQueryDeviceProperty(ClientPtr client, int size,
- xQueryDevicePropertyReply *rep);
void SRepXGetDeviceProperty(ClientPtr client, int size,
xGetDevicePropertyReply *rep);