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
This commit is contained in:
Carlos Garnacho 2020-06-05 23:43:54 +02:00
parent 1555ecad11
commit aae4a6065c
3 changed files with 28 additions and 6 deletions

View File

@ -1511,3 +1511,12 @@ meta_input_device_native_set_mapping_mode (ClutterInputDevice *device,
device_native->mapping_mode = mapping; device_native->mapping_mode = mapping;
g_object_notify (G_OBJECT (device), "mapping-mode"); 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;
}

View File

@ -76,6 +76,10 @@ struct _MetaInputDeviceNative
double output_ratio; /* w:h */ double output_ratio; /* w:h */
MetaInputDeviceMapping mapping_mode; MetaInputDeviceMapping mapping_mode;
/* Pointer position */
double pointer_x;
double pointer_y;
/* Keyboard a11y */ /* Keyboard a11y */
ClutterKeyboardA11yFlags a11y_flags; ClutterKeyboardA11yFlags a11y_flags;
GList *slow_keys_list; 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); 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 */ #endif /* META_INPUT_DEVICE_NATIVE_H */

View File

@ -422,10 +422,14 @@ new_absolute_motion_event (MetaSeatNative *seat,
clutter_event_set_device_tool (event, device_evdev->last_tool); clutter_event_set_device_tool (event, device_evdev->last_tool);
clutter_event_set_device (event, input_device); clutter_event_set_device (event, input_device);
meta_input_device_native_update_coords (META_INPUT_DEVICE_NATIVE (input_device),
x, y);
} }
else else
{ {
clutter_event_set_device (event, seat->core_pointer); 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) 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); device_evdev = META_INPUT_DEVICE_NATIVE (input_device);
seat = meta_input_device_native_get_seat (device_evdev); seat = meta_input_device_native_get_seat (device_evdev);
x = input_device->current_x + dx; x = device_evdev->pointer_x + dx;
y = input_device->current_y + dy; y = device_evdev->pointer_y + dy;
meta_seat_native_filter_relative_motion (seat, meta_seat_native_filter_relative_motion (seat,
input_device, input_device,
@ -2466,7 +2470,7 @@ meta_seat_native_constructed (GObject *object)
CLUTTER_INPUT_MODE_MASTER); CLUTTER_INPUT_MODE_MASTER);
seat->pointer_x = INITIAL_POINTER_X; seat->pointer_x = INITIAL_POINTER_X;
seat->pointer_y = INITIAL_POINTER_Y; seat->pointer_y = INITIAL_POINTER_Y;
_clutter_input_device_set_coords (device, NULL, meta_input_device_native_update_coords (META_INPUT_DEVICE_NATIVE (device),
seat->pointer_x, seat->pointer_y); seat->pointer_x, seat->pointer_y);
seat->core_pointer = device; seat->core_pointer = device;
@ -2769,6 +2773,7 @@ meta_seat_native_query_state (ClutterSeat *seat,
graphene_point_t *coords, graphene_point_t *coords,
ClutterModifierType *modifiers) ClutterModifierType *modifiers)
{ {
MetaInputDeviceNative *device_native = META_INPUT_DEVICE_NATIVE (device);
MetaSeatNative *seat_native = META_SEAT_NATIVE (seat); MetaSeatNative *seat_native = META_SEAT_NATIVE (seat);
if (sequence) if (sequence)
@ -2796,8 +2801,8 @@ meta_seat_native_query_state (ClutterSeat *seat,
{ {
if (coords) if (coords)
{ {
coords->x = device->current_x; coords->x = device_native->pointer_x;
coords->y = device->current_y; coords->y = device_native->pointer_y;
} }
if (modifiers) if (modifiers)