[mutter/wip/carlosg/capabilities-and-dimensions: 8/11] clutter: Add clutter_input_device_get_dimensions()




commit 6a12ffbb384066d7d925b191792966751dd628c0
Author: Carlos Garnacho <carlosg gnome org>
Date:   Tue Sep 6 12:58:27 2022 +0200

    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.

 clutter/clutter/clutter-input-device.c | 14 ++++++++++++++
 clutter/clutter/clutter-input-device.h |  8 ++++++++
 2 files changed, 22 insertions(+)
---
diff --git a/clutter/clutter/clutter-input-device.c b/clutter/clutter/clutter-input-device.c
index 2d38bed3b1..3254cf9c33 100644
--- a/clutter/clutter/clutter-input-device.c
+++ b/clutter/clutter/clutter-input-device.c
@@ -789,3 +789,17 @@ clutter_input_device_get_seat (ClutterInputDevice *device)
 
   return priv->seat;
 }
+
+gboolean
+clutter_input_device_get_dimensions (ClutterInputDevice *device,
+                                     int                *width,
+                                     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);
+}
diff --git a/clutter/clutter/clutter-input-device.h b/clutter/clutter/clutter-input-device.h
index dcfc624d7a..7d51125e1e 100644
--- a/clutter/clutter/clutter-input-device.h
+++ b/clutter/clutter/clutter-input-device.h
@@ -50,6 +50,9 @@ struct _ClutterInputDeviceClass
   int (* get_pad_feature_group) (ClutterInputDevice           *device,
                                  ClutterInputDevicePadFeature  feature,
                                  int                           n_feature);
+  gboolean (* get_dimensions) (ClutterInputDevice *device,
+                               int                *width,
+                               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,
+                                              int                *width,
+                                              int                *height);
+
 G_END_DECLS
 
 #endif /* __CLUTTER_INPUT_DEVICE_H__ */


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