diff --git a/src/backends/native/meta-input-device-native.c b/src/backends/native/meta-input-device-native.c index 74345fe6d..c8ef38e7a 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 cbc33ce0d..fa5b3260e 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 1c1fe6230..90cdb53b1 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_MASTER); 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)