clutter: Add ClutterInputDevice::capabilities property

This is construct-only, and assigned by the backend.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2331>
This commit is contained in:
Carlos Garnacho 2022-03-08 17:04:40 +01:00 committed by Marge Bot
parent ff6f83f05e
commit 15d4402d08
2 changed files with 45 additions and 0 deletions

View File

@ -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,25 @@ clutter_input_device_get_device_type (ClutterInputDevice *device)
return priv->device_type;
}
/**
* clutter_input_device_get_capabilities:
* @device: a #ClutterInputDevice
*
* Retrieves the capabilities of @device
*
* Return value: the capabilities of the device
*/
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

View File

@ -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__ */