clutter: Add clutter_input_device_get_dimensions()
This will be used to know the size of touchscreens and tablets by poking the backends about it. This is intended to replace code using udev nowadays. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2617>
This commit is contained in:
parent
a37bec258c
commit
c28ab9a5c1
@ -789,3 +789,25 @@ clutter_input_device_get_seat (ClutterInputDevice *device)
|
||||
|
||||
return priv->seat;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_input_device_get_dimensions:
|
||||
* @device: a #ClutterInputDevice
|
||||
* @width: (out): Return location for device width (in millimeters)
|
||||
* @height: (out): Return location for device height (in millimeters)
|
||||
*
|
||||
* Returns: %TRUE if the device reports the physical size of its input area.
|
||||
**/
|
||||
gboolean
|
||||
clutter_input_device_get_dimensions (ClutterInputDevice *device,
|
||||
unsigned int *width,
|
||||
unsigned int *height)
|
||||
{
|
||||
g_return_val_if_fail (CLUTTER_IS_INPUT_DEVICE (device), FALSE);
|
||||
g_return_val_if_fail (width != NULL && height != NULL, FALSE);
|
||||
|
||||
if (!CLUTTER_INPUT_DEVICE_GET_CLASS (device)->get_dimensions)
|
||||
return FALSE;
|
||||
|
||||
return CLUTTER_INPUT_DEVICE_GET_CLASS (device)->get_dimensions (device, width, height);
|
||||
}
|
||||
|
@ -50,6 +50,9 @@ struct _ClutterInputDeviceClass
|
||||
int (* get_pad_feature_group) (ClutterInputDevice *device,
|
||||
ClutterInputDevicePadFeature feature,
|
||||
int n_feature);
|
||||
gboolean (* get_dimensions) (ClutterInputDevice *device,
|
||||
unsigned int *width,
|
||||
unsigned int *height);
|
||||
};
|
||||
|
||||
#define CLUTTER_TYPE_INPUT_DEVICE (clutter_input_device_get_type ())
|
||||
@ -118,6 +121,11 @@ int clutter_input_device_get_pad_feature_group (ClutterInputDevice *de
|
||||
CLUTTER_EXPORT
|
||||
ClutterInputCapabilities clutter_input_device_get_capabilities (ClutterInputDevice *device);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
gboolean clutter_input_device_get_dimensions (ClutterInputDevice *device,
|
||||
unsigned int *width,
|
||||
unsigned int *height);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_INPUT_DEVICE_H__ */
|
||||
|
Loading…
Reference in New Issue
Block a user