[mutter/wip/carlosg/input-thread: 32/95] backends/native: Move away from ClutterInputDevice coords
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wip/carlosg/input-thread: 32/95] backends/native: Move away from ClutterInputDevice coords
- Date: Fri, 25 Sep 2020 17:27:08 +0000 (UTC)
commit 7a60ab0fd08a064b1a621023c5e480e295241915
Author: Carlos Garnacho <carlosg gnome org>
Date: Fri Jun 5 23:43:54 2020 +0200
backends/native: Move away from ClutterInputDevice coords
Use a new set in MetaInputDeviceNative for the time being.
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
src/backends/native/meta-input-device-native.c | 9 +++++++++
src/backends/native/meta-input-device-native.h | 8 ++++++++
src/backends/native/meta-seat-native.c | 17 +++++++++++------
3 files changed, 28 insertions(+), 6 deletions(-)
---
diff --git a/src/backends/native/meta-input-device-native.c b/src/backends/native/meta-input-device-native.c
index 1f50ac7f09..b6208ff1ac 100644
--- a/src/backends/native/meta-input-device-native.c
+++ b/src/backends/native/meta-input-device-native.c
@@ -1511,3 +1511,12 @@ meta_input_device_native_set_mapping_mode (ClutterInputDevice *device,
device_native->mapping_mode = mapping;
g_object_notify (G_OBJECT (device), "mapping-mode");
}
+
+void
+meta_input_device_native_update_coords (MetaInputDeviceNative *device_native,
+ double x,
+ double y)
+{
+ device_native->pointer_x = x;
+ device_native->pointer_y = y;
+}
diff --git a/src/backends/native/meta-input-device-native.h b/src/backends/native/meta-input-device-native.h
index cbc33ce0d1..fa5b3260e4 100644
--- a/src/backends/native/meta-input-device-native.h
+++ b/src/backends/native/meta-input-device-native.h
@@ -76,6 +76,10 @@ struct _MetaInputDeviceNative
double output_ratio; /* w:h */
MetaInputDeviceMapping mapping_mode;
+ /* Pointer position */
+ double pointer_x;
+ double pointer_y;
+
/* Keyboard a11y */
ClutterKeyboardA11yFlags a11y_flags;
GList *slow_keys_list;
@@ -137,4 +141,8 @@ void meta_input_device_native_a11y_maybe_notify_toggle_keys
struct libinput_device * meta_input_device_native_get_libinput_device (ClutterInputDevice *device);
+void meta_input_device_native_update_coords (MetaInputDeviceNative *device_native,
+ double x,
+ double y);
+
#endif /* META_INPUT_DEVICE_NATIVE_H */
diff --git a/src/backends/native/meta-seat-native.c b/src/backends/native/meta-seat-native.c
index 2617efb379..dad98b06e2 100644
--- a/src/backends/native/meta-seat-native.c
+++ b/src/backends/native/meta-seat-native.c
@@ -422,10 +422,14 @@ new_absolute_motion_event (MetaSeatNative *seat,
clutter_event_set_device_tool (event, device_evdev->last_tool);
clutter_event_set_device (event, input_device);
+ meta_input_device_native_update_coords (META_INPUT_DEVICE_NATIVE (input_device),
+ x, y);
}
else
{
clutter_event_set_device (event, seat->core_pointer);
+ meta_input_device_native_update_coords (META_INPUT_DEVICE_NATIVE (seat->core_pointer),
+ x, y);
}
if (clutter_input_device_get_device_type (input_device) != CLUTTER_TABLET_DEVICE)
@@ -1096,8 +1100,8 @@ notify_relative_tool_motion (ClutterInputDevice *input_device,
device_evdev = META_INPUT_DEVICE_NATIVE (input_device);
seat = meta_input_device_native_get_seat (device_evdev);
- x = input_device->current_x + dx;
- y = input_device->current_y + dy;
+ x = device_evdev->pointer_x + dx;
+ y = device_evdev->pointer_y + dy;
meta_seat_native_filter_relative_motion (seat,
input_device,
@@ -2466,8 +2470,8 @@ meta_seat_native_constructed (GObject *object)
CLUTTER_INPUT_MODE_LOGICAL);
seat->pointer_x = INITIAL_POINTER_X;
seat->pointer_y = INITIAL_POINTER_Y;
- _clutter_input_device_set_coords (device, NULL,
- seat->pointer_x, seat->pointer_y);
+ meta_input_device_native_update_coords (META_INPUT_DEVICE_NATIVE (device),
+ seat->pointer_x, seat->pointer_y);
seat->core_pointer = device;
device = meta_input_device_native_new_virtual (
@@ -2769,6 +2773,7 @@ meta_seat_native_query_state (ClutterSeat *seat,
graphene_point_t *coords,
ClutterModifierType *modifiers)
{
+ MetaInputDeviceNative *device_native = META_INPUT_DEVICE_NATIVE (device);
MetaSeatNative *seat_native = META_SEAT_NATIVE (seat);
if (sequence)
@@ -2796,8 +2801,8 @@ meta_seat_native_query_state (ClutterSeat *seat,
{
if (coords)
{
- coords->x = device->current_x;
- coords->y = device->current_y;
+ coords->x = device_native->pointer_x;
+ coords->y = device_native->pointer_y;
}
if (modifiers)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]