xserver: Branch 'master' - 5 commits

Peter Hutterer whot at kemper.freedesktop.org
Thu Sep 25 21:04:48 PDT 2008


 Xi/extinit.c                 |   58 +++----
 Xi/xiproperty.c              |  342 ++++++++++++-------------------------------
 Xi/xiproperty.h              |    6 
 configure.ac                 |    2 
 dix/devices.c                |   18 +-
 include/Makefile.am          |    3 
 include/exevents.h           |   33 +---
 include/inputstr.h           |   25 +--
 include/xserver-properties.h |   32 ++++
 9 files changed, 191 insertions(+), 328 deletions(-)

New commits:
commit 106eb37e0214bbd864a59119b491abfc54f32629
Author: Peter Hutterer <peter.hutterer at redhat.com>
Date:   Fri Sep 26 13:05:10 2008 +0930

    Require inputproto 1.9.99.5
    
    Pull and rebuild your input drivers, while you're at it.

diff --git a/configure.ac b/configure.ac
index 60cdc14..d768546 100644
--- a/configure.ac
+++ b/configure.ac
@@ -657,7 +657,7 @@ XEXT_LIB='$(top_builddir)/Xext/libXext.la'
 XEXTXORG_LIB='$(top_builddir)/Xext/libXextbuiltin.la'
 
 dnl Core modules for most extensions, et al.
-REQUIRED_MODULES="[randrproto >= 1.2] [renderproto >= 0.9.3] [fixesproto >= 4.0] [damageproto >= 1.1] xcmiscproto [xextproto >= 7.0.3] [xproto >= 7.0.13] xtrans bigreqsproto resourceproto fontsproto [inputproto >= 1.9.99.4] [kbproto >= 1.0.3]" 
+REQUIRED_MODULES="[randrproto >= 1.2] [renderproto >= 0.9.3] [fixesproto >= 4.0] [damageproto >= 1.1] xcmiscproto [xextproto >= 7.0.3] [xproto >= 7.0.13] xtrans bigreqsproto resourceproto fontsproto [inputproto >= 1.9.99.5] [kbproto >= 1.0.3]" 
 REQUIRED_LIBS="xfont xau fontenc [pixman-1 >= 0.9.5]"
 
 dnl HAVE_DBUS is true if we actually have the D-Bus library, whereas
commit fbd09486c6e6c64db28d81caa5ef04821e49f2eb
Author: Peter Hutterer <peter.hutterer at redhat.com>
Date:   Tue Sep 23 16:55:04 2008 +0930

    Push server-known properties into xserver-properties.h.

diff --git a/Xi/xiproperty.c b/Xi/xiproperty.c
index 72efb67..1e4ed46 100644
--- a/Xi/xiproperty.c
+++ b/Xi/xiproperty.c
@@ -38,6 +38,7 @@
 #include "swaprep.h"
 
 #include "xiproperty.h"
+#include "xserver-properties.h"
 
 /**
  * Properties used or alloced from inside the server.
diff --git a/dix/devices.c b/dix/devices.c
index e6f21c9..f8ae6da 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -86,6 +86,7 @@ SOFTWARE.
 #include "exevents.h"
 #include "listdev.h" /* for CopySwapXXXClass */
 #include "xiproperty.h"
+#include "xserver-properties.h"
 
 /** @file
  * This file handles input device-related stuff.
diff --git a/include/Makefile.am b/include/Makefile.am
index 76c265e..f639048 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -53,7 +53,8 @@ sdk_HEADERS =		\
 	windowstr.h	\
 	xkbfile.h	\
 	xkbsrv.h	\
-	xkbstr.h
+	xkbstr.h        \
+	xserver-properties.h
 
 nodist_sdk_HEADERS = xorg-server.h
 endif
diff --git a/include/xserver-properties.h b/include/xserver-properties.h
new file mode 100644
index 0000000..4d602b5
--- /dev/null
+++ b/include/xserver-properties.h
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2008 Red Hat, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software")
+ * to deal in the software without restriction, including without limitation
+ * on the rights to use, copy, modify, merge, publish, distribute, sub
+ * license, and/or sell copies of the Software, and to permit persons to whom
+ * them Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTIBILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES, OR OTHER LIABILITY, WHETHER
+ * IN AN ACTION OF CONTRACT, TORT, OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+/* Properties managed by the server. */
+
+#ifndef _XSERVER_PROPERTIES_H_
+#define _XSERVER_PROPERTIES_H_
+
+/* BOOL. 0 - device disabled, 1 - device enabled */
+#define XI_PROP_ENABLED      "Device Enabled"
+
+#endif
commit a2d83b9dc8387ec7e70689db1371cf6500b2f68e
Author: Peter Hutterer <peter.hutterer at redhat.com>
Date:   Thu Sep 18 18:21:03 2008 +0930

    Xi: add "deletable" flag to properties, add DeleteProperty handler.
    
    A property can only be deleted if any of the following is true:
    - if a property is deletable and all handlers return Success.
    - if a property is non-deleteable and the all handlers return Success AND the
      delete request does not come from a client (i.e. driver or the server).
    
    A client can never delete a non-deletable property.

diff --git a/Xi/xiproperty.c b/Xi/xiproperty.c
index bd130d1..72efb67 100644
--- a/Xi/xiproperty.c
+++ b/Xi/xiproperty.c
@@ -98,7 +98,9 @@ XIRegisterPropertyHandler(DeviceIntPtr         dev,
                                               Atom property,
                                               XIPropertyValuePtr prop),
                           int (*GetProperty) (DeviceIntPtr dev,
-                                              Atom property))
+                                              Atom property),
+                          int (*DeleteProperty) (DeviceIntPtr dev,
+                                                 Atom property))
 {
     XIPropertyHandlerPtr new_handler;
 
@@ -109,6 +111,7 @@ XIRegisterPropertyHandler(DeviceIntPtr         dev,
     new_handler->id = XIPropHandlerID++;
     new_handler->SetProperty = SetProperty;
     new_handler->GetProperty = GetProperty;
+    new_handler->DeleteProperty = DeleteProperty;
     new_handler->next = dev->properties.handlers;
     dev->properties.handlers = new_handler;
 
@@ -153,6 +156,7 @@ XICreateDeviceProperty (Atom property)
     prop->value.format = 0;
     prop->value.size   = 0;
     prop->value.data   = NULL;
+    prop->deletable    = TRUE;
 
     return prop;
 }
@@ -218,11 +222,29 @@ XIDeleteDeviceProperty (DeviceIntPtr device, Atom property, Bool fromClient)
 {
     XIPropertyPtr               prop, *prev;
     devicePropertyNotify        event;
+    int                         rc = Success;
 
     for (prev = &device->properties.properties; (prop = *prev); prev = &(prop->next))
         if (prop->propertyName == property)
             break;
 
+    if (fromClient && !prop->deletable)
+        return BadAccess;
+
+    /* Ask handlers if we may delete the property */
+    if (device->properties.handlers)
+    {
+        XIPropertyHandlerPtr handler = device->properties.handlers;
+        while(handler)
+        {
+            if (handler->DeleteProperty)
+                rc = handler->DeleteProperty(device, prop->propertyName);
+            if (rc != Success)
+                return (rc);
+            handler = handler->next;
+        }
+    }
+
     if (prop)
     {
         *prev = prop->next;
@@ -403,6 +425,18 @@ XIGetDeviceProperty (DeviceIntPtr dev, Atom property, XIPropertyValuePtr *value)
 }
 
 int
+XISetDevicePropertyDeletable(DeviceIntPtr dev, Atom property, Bool deletable)
+{
+    XIPropertyPtr prop = XIFetchDeviceProperty(dev, property);
+
+    if (!prop)
+        return BadAtom;
+
+    prop->deletable = deletable;
+    return Success;
+}
+
+int
 ProcXListDeviceProperties (ClientPtr client)
 {
     Atom                        *pAtoms = NULL, *temppAtoms;
diff --git a/dix/devices.c b/dix/devices.c
index fb63473..e6f21c9 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -223,7 +223,8 @@ AddInputDevice(ClientPtr client, DeviceProc deviceProc, Bool autoStart)
     XIChangeDeviceProperty(dev, XIGetKnownProperty(XI_PROP_ENABLED),
                            XA_INTEGER, 8, PropModeReplace, 1, &dev->enabled,
                            FALSE);
-    XIRegisterPropertyHandler(dev, DeviceSetProperty, NULL);
+    XISetDevicePropertyDeletable(dev, XIGetKnownProperty(XI_PROP_ENABLED), FALSE);
+    XIRegisterPropertyHandler(dev, DeviceSetProperty, NULL, NULL);
 
     return dev;
 }
diff --git a/include/exevents.h b/include/exevents.h
index c3a2ad6..4df0aee 100644
--- a/include/exevents.h
+++ b/include/exevents.h
@@ -222,13 +222,21 @@ extern int XIGetDeviceProperty(
         XIPropertyValuePtr*     /* value */
 );
 
+extern int XISetDevicePropertyDeletable(
+        DeviceIntPtr            /* dev */,
+        Atom                    /* property */,
+        Bool                    /* deletable */
+);
+
 extern long XIRegisterPropertyHandler(
         DeviceIntPtr         dev,
         int (*SetProperty) (DeviceIntPtr dev,
                             Atom property,
                             XIPropertyValuePtr prop),
         int (*GetProperty) (DeviceIntPtr dev,
-                            Atom property)
+                            Atom property),
+        int (*DeleteProperty) (DeviceIntPtr dev,
+                               Atom property)
 );
 
 extern void XIUnRegisterPropertyHandler(
diff --git a/include/inputstr.h b/include/inputstr.h
index 93b3293..65cb1b9 100644
--- a/include/inputstr.h
+++ b/include/inputstr.h
@@ -353,6 +353,7 @@ typedef struct _XIProperty
 {
     struct _XIProperty   *next;
     Atom                  propertyName;
+    BOOL                  deletable;    /* clients can delete this prop? */
     XIPropertyValueRec    value;
 } XIPropertyRec;
 
@@ -369,6 +370,8 @@ typedef struct _XIPropertyHandler
                         XIPropertyValuePtr prop);
     int (*GetProperty) (DeviceIntPtr dev,
                         Atom property);
+    int (*DeleteProperty) (DeviceIntPtr dev,
+                           Atom property);
 } XIPropertyHandler, *XIPropertyHandlerPtr;
 
 /* states for devices */
commit 22e90472681ebc7bdd28f82bbf2753a5b259e931
Author: Peter Hutterer <peter.hutterer at redhat.com>
Date:   Thu Sep 18 16:12:02 2008 +0930

    Xi: allow Set/GetProperties to return a status, and honour this status code.
    
    If a property handler now bails out, return the error code to the caller. This
    allows to be slightly more specific with the errors.

diff --git a/Xi/xiproperty.c b/Xi/xiproperty.c
index 425cd75..bd130d1 100644
--- a/Xi/xiproperty.c
+++ b/Xi/xiproperty.c
@@ -94,11 +94,11 @@ XIInitKnownProperties(void)
  */
 long
 XIRegisterPropertyHandler(DeviceIntPtr         dev,
-                          Bool (*SetProperty) (DeviceIntPtr dev,
-                                               Atom property,
-                                               XIPropertyValuePtr prop),
-                          Bool (*GetProperty) (DeviceIntPtr dev,
-                                               Atom property))
+                          int (*SetProperty) (DeviceIntPtr dev,
+                                              Atom property,
+                                              XIPropertyValuePtr prop),
+                          int (*GetProperty) (DeviceIntPtr dev,
+                                              Atom property))
 {
     XIPropertyHandlerPtr new_handler;
 
@@ -252,6 +252,7 @@ XIChangeDeviceProperty (DeviceIntPtr dev, Atom property, Atom type,
     XIPropertyValuePtr          prop_value;
     XIPropertyValueRec          new_value;
     Bool                        add = FALSE;
+    int                         rc;
 
     size_in_bytes = format >> 3;
 
@@ -325,12 +326,16 @@ XIChangeDeviceProperty (DeviceIntPtr dev, Atom property, Atom type,
             XIPropertyHandlerPtr handler = dev->properties.handlers;
             while(handler)
             {
-                if (handler->SetProperty &&
-                    !handler->SetProperty(dev, prop->propertyName, &new_value))
+                if (handler->SetProperty)
                 {
-                    if (new_value.data)
-                        xfree (new_value.data);
-                    return (BadValue);
+                    rc = handler->SetProperty(dev, prop->propertyName,
+                                              &new_value);
+                    if (rc != Success)
+                    {
+                        if (new_value.data)
+                            xfree (new_value.data);
+                        return (rc);
+                    }
                 }
                 handler = handler->next;
             }
@@ -349,7 +354,6 @@ XIChangeDeviceProperty (DeviceIntPtr dev, Atom property, Atom type,
         dev->properties.properties = prop;
     }
 
-
     if (sendevent)
     {
         event.type      = DevicePropertyNotify;
@@ -363,16 +367,17 @@ XIChangeDeviceProperty (DeviceIntPtr dev, Atom property, Atom type,
     return(Success);
 }
 
-/**
- *
- */
-_X_EXPORT XIPropertyValuePtr
-XIGetDeviceProperty (DeviceIntPtr dev, Atom property)
+int
+XIGetDeviceProperty (DeviceIntPtr dev, Atom property, XIPropertyValuePtr *value)
 {
     XIPropertyPtr   prop = XIFetchDeviceProperty (dev, property);
+    int rc;
 
     if (!prop)
-        return NULL;
+    {
+        *value = NULL;
+        return BadAtom;
+    }
 
     /* If we can, try to update the property value first */
     if (dev->properties.handlers)
@@ -381,11 +386,20 @@ XIGetDeviceProperty (DeviceIntPtr dev, Atom property)
         while(handler)
         {
             if (handler->GetProperty)
-                handler->GetProperty(dev, prop->propertyName);
+            {
+                rc = handler->GetProperty(dev, prop->propertyName);
+                if (rc != Success)
+                {
+                    *value = NULL;
+                    return rc;
+                }
+            }
             handler = handler->next;
         }
     }
-    return &prop->value;
+
+    *value = &prop->value;
+    return Success;
 }
 
 int
@@ -489,6 +503,8 @@ ProcXChangeDeviceProperty (ClientPtr client)
                                  stuff->type, (int)format,
                                  (int)mode, len, (pointer)&stuff[1], TRUE);
 
+    if (rc != Success)
+        client->errorValue = stuff->property;
     return rc;
 }
 
@@ -570,9 +586,12 @@ ProcXGetDeviceProperty (ClientPtr client)
         return(client->noClientException);
     }
 
-    prop_value = XIGetDeviceProperty(dev, stuff->property);
-    if (!prop_value)
-        return BadAtom;
+    rc = XIGetDeviceProperty(dev, stuff->property, &prop_value);
+    if (rc != Success)
+    {
+        client->errorValue = stuff->property;
+        return rc;
+    }
 
     /* If the request type and actual type don't match. Return the
     property information, but not the data. */
diff --git a/dix/devices.c b/dix/devices.c
index c0df6a2..fb63473 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -101,22 +101,21 @@ DevPrivateKey UnusedClassesPrivateKey = &UnusedClassesPrivateKeyIndex;
 /**
  * DIX property handler.
  */
-static Bool
+static int
 DeviceSetProperty(DeviceIntPtr dev, Atom property, XIPropertyValuePtr prop)
 {
     if (property == XIGetKnownProperty(XI_PROP_ENABLED))
     {
         if (prop->format != 8 || prop->type != XA_INTEGER || prop->size != 1)
-            return FALSE;
+            return BadValue;
 
         if ((*((CARD8*)prop->data)) && !dev->enabled)
             EnableDevice(dev);
         else if (!(*((CARD8*)prop->data)) && dev->enabled)
             DisableDevice(dev);
-        return TRUE;
     }
 
-    return TRUE;
+    return Success;
 }
 
 
diff --git a/include/exevents.h b/include/exevents.h
index e137fef..c3a2ad6 100644
--- a/include/exevents.h
+++ b/include/exevents.h
@@ -216,19 +216,19 @@ extern int XIChangeDeviceProperty(
         Bool                    /* sendevent*/
         );
 
-extern XIPropertyValuePtr XIGetDeviceProperty(
+extern int XIGetDeviceProperty(
         DeviceIntPtr            /* dev */,
-        Atom                    /* property */
+        Atom                    /* property */,
+        XIPropertyValuePtr*     /* value */
 );
 
-
 extern long XIRegisterPropertyHandler(
         DeviceIntPtr         dev,
-        Bool (*SetProperty) (DeviceIntPtr dev,
-                             Atom property,
-                             XIPropertyValuePtr prop),
-        Bool (*GetProperty) (DeviceIntPtr dev,
-                             Atom property)
+        int (*SetProperty) (DeviceIntPtr dev,
+                            Atom property,
+                            XIPropertyValuePtr prop),
+        int (*GetProperty) (DeviceIntPtr dev,
+                            Atom property)
 );
 
 extern void XIUnRegisterPropertyHandler(
diff --git a/include/inputstr.h b/include/inputstr.h
index 64b6985..93b3293 100644
--- a/include/inputstr.h
+++ b/include/inputstr.h
@@ -364,11 +364,11 @@ typedef struct _XIPropertyHandler
 {
     struct _XIPropertyHandler* next;
     long id;
-    Bool (*SetProperty) (DeviceIntPtr dev,
-                         Atom property,
-                         XIPropertyValuePtr prop);
-    Bool (*GetProperty) (DeviceIntPtr dev,
-                         Atom property);
+    int (*SetProperty) (DeviceIntPtr dev,
+                        Atom property,
+                        XIPropertyValuePtr prop);
+    int (*GetProperty) (DeviceIntPtr dev,
+                        Atom property);
 } XIPropertyHandler, *XIPropertyHandlerPtr;
 
 /* states for devices */
commit 1e24e7b9df3d02350c7ea18e9379e87fe4d00026
Author: Peter Hutterer <peter.hutterer at redhat.com>
Date:   Thu Sep 18 15:58:46 2008 +0930

    Xi: remove configure/query device property calls.
    
    This removes all the meta-information about device properties (pending,
    fromClient, range, valid_values, immutable).

diff --git a/Xi/extinit.c b/Xi/extinit.c
index 595e358..9d0ca78 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 df93de5..425cd75 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 11af4bc..12026e9 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);
 
diff --git a/dix/devices.c b/dix/devices.c
index 4f216bd..c0df6a2 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -205,7 +205,6 @@ AddInputDevice(ClientPtr client, DeviceProc deviceProc, Bool autoStart)
 
     /* device properties */
     dev->properties.properties = NULL;
-    dev->properties.pendingProperties = FALSE;
     dev->properties.handlers = NULL;
 
     /*  security creation/labeling check
@@ -224,7 +223,7 @@ AddInputDevice(ClientPtr client, DeviceProc deviceProc, Bool autoStart)
 
     XIChangeDeviceProperty(dev, XIGetKnownProperty(XI_PROP_ENABLED),
                            XA_INTEGER, 8, PropModeReplace, 1, &dev->enabled,
-                           FALSE, FALSE, FALSE);
+                           FALSE);
     XIRegisterPropertyHandler(dev, DeviceSetProperty, NULL);
 
     return dev;
@@ -314,7 +313,7 @@ EnableDevice(DeviceIntPtr dev)
 
     XIChangeDeviceProperty(dev, XIGetKnownProperty(XI_PROP_ENABLED),
                            XA_INTEGER, 8, PropModeReplace, 1, &dev->enabled,
-                           TRUE, FALSE, FALSE);
+                           TRUE);
 
     ev.type = DevicePresenceNotify;
     ev.time = currentTime.milliseconds;
@@ -390,7 +389,7 @@ DisableDevice(DeviceIntPtr dev)
 
     XIChangeDeviceProperty(dev, XIGetKnownProperty(XI_PROP_ENABLED),
                            XA_INTEGER, 8, PropModeReplace, 1, &dev->enabled,
-                           TRUE, FALSE, FALSE);
+                           TRUE);
 
     ev.type = DevicePresenceNotify;
     ev.time = currentTime.milliseconds;
diff --git a/include/exevents.h b/include/exevents.h
index b42a904..e137fef 100644
--- a/include/exevents.h
+++ b/include/exevents.h
@@ -213,31 +213,14 @@ extern int XIChangeDeviceProperty(
         int                     /* mode*/,
         unsigned long           /* len*/,
         pointer                 /* value*/,
-        Bool                    /* sendevent*/,
-        Bool                    /* pending*/,
-        Bool                    /* fromClient */
+        Bool                    /* sendevent*/
         );
 
-extern XIPropertyPtr XIQueryDeviceProperty(
-        DeviceIntPtr            /* dev */,
-        Atom                    /* property */
-);
-
 extern XIPropertyValuePtr XIGetDeviceProperty(
         DeviceIntPtr            /* dev */,
-        Atom                    /* property */,
-        Bool                    /* pending */
+        Atom                    /* property */
 );
 
-extern int XIConfigureDeviceProperty(
-        DeviceIntPtr            /* dev */,
-        Atom                    /* property */,
-        Bool                    /* pending */,
-        Bool                    /* range */,
-        Bool                    /* immutable */,
-        int                     /* num_values */,
-        INT32*                  /* values */
-);
 
 extern long XIRegisterPropertyHandler(
         DeviceIntPtr         dev,
diff --git a/include/inputstr.h b/include/inputstr.h
index 6bba47c..64b6985 100644
--- a/include/inputstr.h
+++ b/include/inputstr.h
@@ -353,18 +353,9 @@ typedef struct _XIProperty
 {
     struct _XIProperty   *next;
     Atom                  propertyName;
-    Bool                  is_pending;
-    Bool                  range;
-    Bool                  immutable;
-    Bool                  fromClient;       /* created by client or driver/server */
-    int                   num_valid;
-    INT32                 *valid_values;
-    XIPropertyValueRec    current,
-                          pending;
+    XIPropertyValueRec    value;
 } XIPropertyRec;
 
-
-
 typedef XIPropertyRec      *XIPropertyPtr;
 typedef XIPropertyValueRec *XIPropertyValuePtr;
 
@@ -484,7 +475,6 @@ typedef struct _DeviceIntRec {
     /* Input device property handling. */
     struct {
         XIPropertyPtr   properties;
-        Bool            pendingProperties;
         XIPropertyHandlerPtr handlers; /* NULL-terminated */
     } properties;
 } DeviceIntRec;


More information about the xorg-commit mailing list