[mutter/wip/carlosg/device-capabilities: 2/8] clutter: Add ClutterInputDevice::capabilities property




commit 6ac3142233fa1a9ad79f37fdddf874e6b9448322
Author: Carlos Garnacho <carlosg gnome org>
Date:   Tue Mar 8 17:04:40 2022 +0100

    clutter: Add ClutterInputDevice::capabilities property
    
    This is construct-only, and assigned by the backend.

 clutter/clutter/clutter-input-device.c | 44 ++++++++++++++++++++++++++++++++++
 clutter/clutter/clutter-input-device.h |  3 +++
 2 files changed, 47 insertions(+)
---
diff --git a/clutter/clutter/clutter-input-device.c b/clutter/clutter/clutter-input-device.c
index a37886e46a..a7b39076d3 100644
--- a/clutter/clutter/clutter-input-device.c
+++ b/clutter/clutter/clutter-input-device.c
@@ -56,6 +56,7 @@ enum
   PROP_NAME,
 
   PROP_DEVICE_TYPE,
+  PROP_CAPABILITIES,
   PROP_SEAT,
   PROP_DEVICE_MODE,
 
@@ -80,6 +81,7 @@ typedef struct _ClutterInputDevicePrivate ClutterInputDevicePrivate;
 struct _ClutterInputDevicePrivate
 {
   ClutterInputDeviceType device_type;
+  ClutterInputCapabilities capabilities;
   ClutterInputMode device_mode;
 
   char *device_name;
@@ -136,6 +138,10 @@ clutter_input_device_set_property (GObject      *gobject,
       priv->device_type = g_value_get_enum (value);
       break;
 
+    case PROP_CAPABILITIES:
+      priv->capabilities = g_value_get_flags (value);
+      break;
+
     case PROP_SEAT:
       priv->seat = g_value_get_object (value);
       break;
@@ -206,6 +212,10 @@ clutter_input_device_get_property (GObject    *gobject,
       g_value_set_enum (value, priv->device_type);
       break;
 
+    case PROP_CAPABILITIES:
+      g_value_set_flags (value, priv->capabilities);
+      break;
+
     case PROP_SEAT:
       g_value_set_object (value, priv->seat);
       break;
@@ -296,6 +306,19 @@ clutter_input_device_class_init (ClutterInputDeviceClass *klass)
                        CLUTTER_PARAM_READWRITE |
                        G_PARAM_CONSTRUCT_ONLY);
 
+  /**
+   * ClutterInputDevice:capabilities:
+   *
+   * The capabilities of the device
+   */
+  obj_props[PROP_CAPABILITIES] =
+    g_param_spec_flags ("capabilities",
+                        P_("Capabilities"),
+                        P_("The capabilities of the device"),
+                        CLUTTER_TYPE_INPUT_CAPABILITIES, 0,
+                        CLUTTER_PARAM_READWRITE |
+                        G_PARAM_CONSTRUCT_ONLY);
+
   /**
    * ClutterInputDevice:seat:
    *
@@ -451,6 +474,27 @@ clutter_input_device_get_device_type (ClutterInputDevice *device)
   return priv->device_type;
 }
 
+/**
+ * clutter_input_device_get_device_type:
+ * @device: a #ClutterInputDevice
+ *
+ * Retrieves the type of @device
+ *
+ * Return value: the type of the device
+ *
+ * Since: 1.0
+ */
+ClutterInputCapabilities
+clutter_input_device_get_capabilities (ClutterInputDevice *device)
+{
+  ClutterInputDevicePrivate *priv =
+    clutter_input_device_get_instance_private (device);
+
+  g_return_val_if_fail (CLUTTER_IS_INPUT_DEVICE (device), 0);
+
+  return priv->capabilities;
+}
+
 /**
  * clutter_input_device_get_device_name:
  * @device: a #ClutterInputDevice
diff --git a/clutter/clutter/clutter-input-device.h b/clutter/clutter/clutter-input-device.h
index 1a82ac9af6..d6fd62a038 100644
--- a/clutter/clutter/clutter-input-device.h
+++ b/clutter/clutter/clutter-input-device.h
@@ -121,6 +121,9 @@ int clutter_input_device_get_pad_feature_group (ClutterInputDevice           *de
                                                 ClutterInputDevicePadFeature  feature,
                                                 int                           n_feature);
 
+CLUTTER_EXPORT
+ClutterInputCapabilities clutter_input_device_get_capabilities (ClutterInputDevice *device);
+
 G_END_DECLS
 
 #endif /* __CLUTTER_INPUT_DEVICE_H__ */


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