summaryrefslogtreecommitdiff
path: root/src/backends/native/meta-input-device-native.c
diff options
context:
space:
mode:
authorCarlos Garnacho <carlosg@gnome.org>2020-05-06 19:06:59 +0200
committerJonas Ã…dahl <jadahl@gmail.com>2020-10-23 18:48:18 +0000
commit6cb1557d99c48209b49ea82f608b4e37147c99d8 (patch)
treeef916a8c2f9108e903ffaba3b72780284e69419a /src/backends/native/meta-input-device-native.c
parent82c6c3f303f7763d20d28682162581b4b6a24f2e (diff)
downloadmutter-6cb1557d99c48209b49ea82f608b4e37147c99d8.tar.gz
backends: Move absolute/relative device mapping to native backend
This is a bit scattered around, with the setter/getter in Clutter, and it only being only directly honored in Wayland (it goes straight through device properties in X11). Make this private native API, and out of public ClutterInputDevice API. https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1486
Diffstat (limited to 'src/backends/native/meta-input-device-native.c')
-rw-r--r--src/backends/native/meta-input-device-native.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/backends/native/meta-input-device-native.c b/src/backends/native/meta-input-device-native.c
index 0498238c1..072c80792 100644
--- a/src/backends/native/meta-input-device-native.c
+++ b/src/backends/native/meta-input-device-native.c
@@ -1472,3 +1472,38 @@ meta_input_device_native_translate_coordinates (ClutterInputDevice *device,
*x = CLAMP (x_d, MIN (min_x, max_x), MAX (min_x, max_x)) * stage_width;
*y = CLAMP (y_d, MIN (min_y, max_y), MAX (min_y, max_y)) * stage_height;
}
+
+MetaInputDeviceMapping
+meta_input_device_native_get_mapping_mode (ClutterInputDevice *device)
+{
+ MetaInputDeviceNative *device_native = META_INPUT_DEVICE_NATIVE (device);
+ ClutterInputDeviceType device_type;
+
+ g_return_val_if_fail (CLUTTER_IS_INPUT_DEVICE (device),
+ META_INPUT_DEVICE_MAPPING_ABSOLUTE);
+
+ device_type = clutter_input_device_get_device_type (device);
+ g_return_val_if_fail (device_type == CLUTTER_TABLET_DEVICE ||
+ device_type == CLUTTER_PEN_DEVICE ||
+ device_type == CLUTTER_ERASER_DEVICE,
+ META_INPUT_DEVICE_MAPPING_ABSOLUTE);
+
+ return device_native->mapping_mode;
+}
+
+void
+meta_input_device_native_set_mapping_mode (ClutterInputDevice *device,
+ MetaInputDeviceMapping mapping)
+{
+ MetaInputDeviceNative *device_native = META_INPUT_DEVICE_NATIVE (device);
+ ClutterInputDeviceType device_type;
+
+ g_return_if_fail (CLUTTER_IS_INPUT_DEVICE (device));
+
+ device_type = clutter_input_device_get_device_type (device);
+ g_return_if_fail (device_type == CLUTTER_TABLET_DEVICE ||
+ device_type == CLUTTER_PEN_DEVICE ||
+ device_type == CLUTTER_ERASER_DEVICE);
+
+ device_native->mapping_mode = mapping;
+}