From 6cb1557d99c48209b49ea82f608b4e37147c99d8 Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Wed, 6 May 2020 19:06:59 +0200 Subject: 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 --- src/backends/native/meta-input-device-native.c | 35 ++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'src/backends/native/meta-input-device-native.c') 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; +} -- cgit v1.2.1