[gnome-settings-daemon] common: Add "type" field to the PropertyHelper struct



commit 4727bf459a8ac9d67b2f7bf3ceb4685c8fbcd116
Author: Jason Gerecke <killertofu gmail com>
Date:   Tue Jan 17 15:08:07 2012 -0800

    common: Add "type" field to the PropertyHelper struct
    
    This patch adds a "type" field to the PropertyHelper struct and
    changes the device_set_property function to make use of this
    type information. While most X properties have the type XA_INTEGER,
    other types exist as well (notably the "FLOAT" type used by the
    "Coordinate Transformation Matrix" property).
    
    https://bugzilla.gnome.org/show_bug.cgi?id=657423

 plugins/common/gsd-input-helper.c   |    6 +++---
 plugins/common/gsd-input-helper.h   |    1 +
 plugins/wacom/gsd-wacom-manager.c   |    7 +++++++
 plugins/xrandr/gsd-xrandr-manager.c |    3 +++
 4 files changed, 14 insertions(+), 3 deletions(-)
---
diff --git a/plugins/common/gsd-input-helper.c b/plugins/common/gsd-input-helper.c
index 3653ef1..4c14657 100644
--- a/plugins/common/gsd-input-helper.c
+++ b/plugins/common/gsd-input-helper.c
@@ -56,11 +56,11 @@ device_set_property (XDevice        *xdevice,
 
         rc = XGetDeviceProperty (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()),
                                  xdevice, prop, 0, property->nitems, False,
-                                 XA_INTEGER, &realtype, &realformat, &nitems,
+                                 AnyPropertyType, &realtype, &realformat, &nitems,
                                  &bytes_after, &data);
 
         if (rc != Success ||
-            realtype != XA_INTEGER ||
+            realtype != property->type ||
             realformat != property->format ||
             nitems < property->nitems) {
                 gdk_error_trap_pop_ignored ();
@@ -80,7 +80,7 @@ device_set_property (XDevice        *xdevice,
         }
 
         XChangeDeviceProperty (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()),
-                               xdevice, prop, XA_INTEGER, realformat,
+                               xdevice, prop, realtype, realformat,
                                PropModeReplace, data, nitems);
 
         if (gdk_error_trap_pop ()) {
diff --git a/plugins/common/gsd-input-helper.h b/plugins/common/gsd-input-helper.h
index 3a774ea..dfde51f 100644
--- a/plugins/common/gsd-input-helper.h
+++ b/plugins/common/gsd-input-helper.h
@@ -44,6 +44,7 @@ typedef struct {
         const char *name;       /* property name */
         gint nitems;            /* number of items in data */
         gint format;            /* CARD8 or CARD32 sized-items */
+        gint type;              /* Atom representing data type */
         union {
                 const gchar *c; /* 8 bit data */
                 const gint *i;  /* 32 bit data */
diff --git a/plugins/wacom/gsd-wacom-manager.c b/plugins/wacom/gsd-wacom-manager.c
index 8c16139..b7b89da 100644
--- a/plugins/wacom/gsd-wacom-manager.c
+++ b/plugins/wacom/gsd-wacom-manager.c
@@ -34,6 +34,7 @@
 #include <glib.h>
 #include <gtk/gtk.h>
 #include <gdk/gdkx.h>
+#include <X11/Xatom.h>
 
 #include "gsd-enums.h"
 #include "gsd-input-helper.h"
@@ -151,6 +152,7 @@ set_rotation (GsdWacomDevice *device,
                 .name = "Wacom Rotation",
                 .nitems = 1,
                 .format = 8,
+                .type   = XA_INTEGER,
                 .data.c = &rot,
         };
 
@@ -164,6 +166,7 @@ set_pressurecurve (GsdWacomDevice *device,
         PropertyHelper property = {
                 .name = "Wacom Pressurecurve",
                 .nitems = 4,
+                .type   = XA_INTEGER,
                 .format = 32,
         };
         gsize nvalues;
@@ -188,6 +191,7 @@ set_area (GsdWacomDevice  *device,
         PropertyHelper property = {
                 .name = "Wacom Tablet Area",
                 .nitems = 4,
+                .type   = XA_INTEGER,
                 .format = 32,
         };
         gsize nvalues;
@@ -259,6 +263,7 @@ set_touch (GsdWacomDevice *device,
                 .name = "Wacom Enable Touch",
                 .nitems = 1,
                 .format = 8,
+                .type   = XA_INTEGER,
                 .data.c = &data,
         };
 
@@ -278,6 +283,7 @@ set_tpcbutton (GsdWacomDevice *device,
                 .name = "Wacom Hover Click",
                 .nitems = 1,
                 .format = 8,
+                .type   = XA_INTEGER,
                 .data.c = &data,
         };
 
@@ -292,6 +298,7 @@ set_pressurethreshold (GsdWacomDevice *device,
                 .name = "Wacom Pressure Threshold",
                 .nitems = 1,
                 .format = 32,
+                .type   = XA_INTEGER,
                 .data.i = &threshold,
         };
 
diff --git a/plugins/xrandr/gsd-xrandr-manager.c b/plugins/xrandr/gsd-xrandr-manager.c
index 26a7e02..d02c1ab 100644
--- a/plugins/xrandr/gsd-xrandr-manager.c
+++ b/plugins/xrandr/gsd-xrandr-manager.c
@@ -39,6 +39,7 @@
 #include <gdk/gdkx.h>
 #include <gtk/gtk.h>
 #include <libupower-glib/upower.h>
+#include <X11/Xatom.h>
 
 #define GNOME_DESKTOP_USE_UNSTABLE_API
 
@@ -1525,6 +1526,7 @@ rotate_touchscreens (GsdXrandrManager *mgr,
                                 .name = "Evdev Axes Swap",
                                 .nitems = 1,
                                 .format = 8,
+                                .type   = XA_INTEGER,
                                 .data.c = &c,
                         };
 
@@ -1544,6 +1546,7 @@ rotate_touchscreens (GsdXrandrManager *mgr,
                                         .name = "Evdev Axis Inversion",
                                         .nitems = 2,
                                         .format = 8,
+                                        .type   = XA_INTEGER,
                                         .data.c = axis,
                                 };
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]