[mutter/wip/tablet-protocol-v2: 17/48] clutter: Add ::n-rings and ::n-strips property to ClutterInputDevice



commit 263082e49f3dedae3f5e0125066cf6f884988b43
Author: Carlos Garnacho <carlosg gnome org>
Date:   Tue May 10 17:00:38 2016 +0200

    clutter: Add ::n-rings and ::n-strips property to ClutterInputDevice
    
    This will only be practical for pads (and maybe generic buttonsets in
    the future?), we just need to know the number as the events will also
    contain a number as the identificator.

 clutter/clutter/clutter-device-manager-private.h |    3 +
 clutter/clutter/clutter-input-device.c           |   49 ++++++++++++++++++++++
 clutter/clutter/clutter-input-device.h           |    5 ++
 3 files changed, 57 insertions(+), 0 deletions(-)
---
diff --git a/clutter/clutter/clutter-device-manager-private.h 
b/clutter/clutter/clutter-device-manager-private.h
index 6af3295..965154a 100644
--- a/clutter/clutter/clutter-device-manager-private.h
+++ b/clutter/clutter/clutter-device-manager-private.h
@@ -134,6 +134,9 @@ struct _ClutterInputDevice
 
   GPtrArray *tools;
 
+  gint n_rings;
+  gint n_strips;
+
   guint has_cursor : 1;
   guint is_enabled : 1;
 };
diff --git a/clutter/clutter/clutter-input-device.c b/clutter/clutter/clutter-input-device.c
index 216644a..bda5adb 100644
--- a/clutter/clutter/clutter-input-device.c
+++ b/clutter/clutter/clutter-input-device.c
@@ -70,6 +70,9 @@ enum
   PROP_VENDOR_ID,
   PROP_PRODUCT_ID,
 
+  PROP_N_STRIPS,
+  PROP_N_RINGS,
+
   PROP_LAST
 };
 
@@ -195,6 +198,14 @@ clutter_input_device_set_property (GObject      *gobject,
       self->product_id = g_value_dup_string (value);
       break;
 
+    case PROP_N_RINGS:
+      self->n_rings = g_value_get_int (value);
+      break;
+
+    case PROP_N_STRIPS:
+      self->n_strips = g_value_get_int (value);
+      break;
+
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
       break;
@@ -255,6 +266,14 @@ clutter_input_device_get_property (GObject    *gobject,
       g_value_set_string (value, self->product_id);
       break;
 
+    case PROP_N_RINGS:
+      g_value_set_int (value, self->n_rings);
+      break;
+
+    case PROP_N_STRIPS:
+      g_value_set_int (value, self->n_strips);
+      break;
+
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
       break;
@@ -432,6 +451,20 @@ clutter_input_device_class_init (ClutterInputDeviceClass *klass)
                          NULL,
                          CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
 
+  obj_props[PROP_N_RINGS] =
+    g_param_spec_int ("n-rings",
+                      P_("Number of rings"),
+                      P_("Number of rings (circular sliders) in this device"),
+                      0, G_MAXINT, 0,
+                      CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
+
+  obj_props[PROP_N_STRIPS] =
+    g_param_spec_int ("n-strips",
+                      P_("Number of strips"),
+                      P_("Number of strips (linear sliders) in this device"),
+                      0, G_MAXINT, 0,
+                      CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
+
   gobject_class->dispose = clutter_input_device_dispose;
   gobject_class->set_property = clutter_input_device_set_property;
   gobject_class->get_property = clutter_input_device_get_property;
@@ -2066,3 +2099,19 @@ clutter_input_device_update_from_tool (ClutterInputDevice     *device,
   if (device_class->update_from_tool)
     device_class->update_from_tool (device, tool);
 }
+
+gint
+clutter_input_device_get_n_rings (ClutterInputDevice *device)
+{
+  g_return_val_if_fail (CLUTTER_IS_INPUT_DEVICE (device), 0);
+
+  return device->n_rings;
+}
+
+gint
+clutter_input_device_get_n_strips (ClutterInputDevice *device)
+{
+  g_return_val_if_fail (CLUTTER_IS_INPUT_DEVICE (device), 0);
+
+  return device->n_strips;
+}
diff --git a/clutter/clutter/clutter-input-device.h b/clutter/clutter/clutter-input-device.h
index 621f44d..1e2a81f 100644
--- a/clutter/clutter/clutter-input-device.h
+++ b/clutter/clutter/clutter-input-device.h
@@ -140,6 +140,11 @@ const gchar *           clutter_input_device_get_vendor_id      (ClutterInputDev
 CLUTTER_AVAILABLE_IN_1_22
 const gchar *           clutter_input_device_get_product_id     (ClutterInputDevice *device);
 
+CLUTTER_AVAILABLE_IN_ALL
+gint                    clutter_input_device_get_n_rings        (ClutterInputDevice *device);
+CLUTTER_AVAILABLE_IN_ALL
+gint                    clutter_input_device_get_n_strips       (ClutterInputDevice *device);
+
 G_END_DECLS
 
 #endif /* __CLUTTER_INPUT_DEVICE_H__ */


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