[gtk+/wip/wayland-tablet: 44/60] GdkDeviceTool: Add GdkAxisFlags info to tablet tools



commit 45ed5478e405fea5e7d3c764ecd5e60064e8d774
Author: Stephen Chandler Paul <thatslyude gmail com>
Date:   Mon Jun 22 17:19:16 2015 +0200

    GdkDeviceTool: Add GdkAxisFlags info to tablet tools
    
    Different tools may have different sets of axes, we should store that
    info somewhere.

 gdk/gdkdevice.c                |   17 ++++++++++++++++-
 gdk/gdkdeviceprivate.h         |    4 +++-
 gdk/x11/gdkdevicemanager-xi2.c |    2 +-
 3 files changed, 20 insertions(+), 3 deletions(-)
---
diff --git a/gdk/gdkdevice.c b/gdk/gdkdevice.c
index bd1240d..58c5d24 100644
--- a/gdk/gdkdevice.c
+++ b/gdk/gdkdevice.c
@@ -2031,6 +2031,7 @@ enum {
   TOOL_PROP_0,
   TOOL_PROP_SERIAL,
   TOOL_PROP_TOOL_TYPE,
+  TOOL_PROP_AXES,
   N_TOOL_PROPS
 };
 
@@ -2052,6 +2053,9 @@ gdk_device_tool_set_property (GObject      *object,
     case TOOL_PROP_TOOL_TYPE:
       tool->type = g_value_get_enum (value);
       break;
+    case TOOL_PROP_AXES:
+      tool->tool_axes = g_value_get_flags (value);
+      break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
@@ -2074,6 +2078,9 @@ gdk_device_tool_get_property (GObject    *object,
     case TOOL_PROP_TOOL_TYPE:
       g_value_set_enum (value, tool->type);
       break;
+    case TOOL_PROP_AXES:
+      g_value_set_flags (value, tool->tool_axes);
+      break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
@@ -2101,6 +2108,12 @@ gdk_device_tool_class_init (GdkDeviceToolClass *klass)
                                                        GDK_DEVICE_TOOL_TYPE_UNKNOWN,
                                                        G_PARAM_READWRITE |
                                                        G_PARAM_CONSTRUCT_ONLY);
+  tool_props[TOOL_PROP_AXES] = g_param_spec_flags ("axes",
+                                                   "Axes",
+                                                   "Tool axes",
+                                                   GDK_TYPE_AXIS_FLAGS, 0,
+                                                   G_PARAM_READWRITE |
+                                                   G_PARAM_CONSTRUCT_ONLY);
 
   g_object_class_install_properties (object_class, N_TOOL_PROPS, tool_props);
 }
@@ -2112,11 +2125,13 @@ gdk_device_tool_init (GdkDeviceTool *tool)
 
 GdkDeviceTool *
 gdk_device_tool_new (guint64           serial,
-                     GdkDeviceToolType type)
+                     GdkDeviceToolType type,
+                     GdkAxisFlags      tool_axes)
 {
   return g_object_new (GDK_TYPE_DEVICE_TOOL,
                        "serial", serial,
                        "tool-type", type,
+                       "axes", tool_axes,
                        NULL);
 }
 
diff --git a/gdk/gdkdeviceprivate.h b/gdk/gdkdeviceprivate.h
index 6a0221f..d0007ea 100644
--- a/gdk/gdkdeviceprivate.h
+++ b/gdk/gdkdeviceprivate.h
@@ -38,6 +38,7 @@ struct _GdkDeviceTool
   GObject parent_instance;
   guint64 serial;
   GdkDeviceToolType type;
+  GdkAxisFlags tool_axes;
 };
 
 struct _GdkDeviceToolClass
@@ -200,7 +201,8 @@ void  gdk_device_set_seat  (GdkDevice *device,
 
 /* Device tools */
 GdkDeviceTool *gdk_device_tool_new    (guint64            serial,
-                                       GdkDeviceToolType  type);
+                                       GdkDeviceToolType  type,
+                                       GdkAxisFlags       tool_axes);
 void           gdk_device_update_tool (GdkDevice     *device,
                                        GdkDeviceTool *tool);
 
diff --git a/gdk/x11/gdkdevicemanager-xi2.c b/gdk/x11/gdkdevicemanager-xi2.c
index 71d014d..310e24e 100644
--- a/gdk/x11/gdkdevicemanager-xi2.c
+++ b/gdk/x11/gdkdevicemanager-xi2.c
@@ -1023,7 +1023,7 @@ handle_property_change (GdkX11DeviceManagerXI2 *device_manager,
           if (!tool && serial_id > 0)
             {
               tool = gdk_device_tool_new (serial_id,
-                                          GDK_DEVICE_TOOL_TYPE_UNKNOWN);
+                                          GDK_DEVICE_TOOL_TYPE_UNKNOWN, 0);
               gdk_seat_default_add_tool (GDK_SEAT_DEFAULT (seat), tool);
             }
         }


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