mirror of
https://github.com/brl/mutter.git
synced 2024-11-25 17:40:40 -05:00
backends/native: Move away from ClutterInputDevice coords
Use a new set in MetaInputDeviceNative, this coexists with ClutterInputDevice coords for the time being. This API will eventually be only accessed from the input thread. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403>
This commit is contained in:
parent
cb7794c19c
commit
7d78768809
@ -1495,3 +1495,23 @@ meta_input_device_native_set_mapping_mode (ClutterInputDevice *device,
|
|||||||
|
|
||||||
device_native->mapping_mode = mapping;
|
device_native->mapping_mode = mapping;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
meta_input_device_native_set_coords (MetaInputDeviceNative *device_native,
|
||||||
|
float x,
|
||||||
|
float y)
|
||||||
|
{
|
||||||
|
device_native->pointer_x = x;
|
||||||
|
device_native->pointer_y = y;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
meta_input_device_native_get_coords (MetaInputDeviceNative *device_native,
|
||||||
|
float *x,
|
||||||
|
float *y)
|
||||||
|
{
|
||||||
|
if (x)
|
||||||
|
*x = device_native->pointer_x;
|
||||||
|
if (y)
|
||||||
|
*y = device_native->pointer_y;
|
||||||
|
}
|
||||||
|
@ -76,6 +76,10 @@ struct _MetaInputDeviceNative
|
|||||||
double output_ratio; /* w:h */
|
double output_ratio; /* w:h */
|
||||||
MetaInputDeviceMapping mapping_mode;
|
MetaInputDeviceMapping mapping_mode;
|
||||||
|
|
||||||
|
/* Pointer position */
|
||||||
|
float pointer_x;
|
||||||
|
float pointer_y;
|
||||||
|
|
||||||
/* Keyboard a11y */
|
/* Keyboard a11y */
|
||||||
ClutterKeyboardA11yFlags a11y_flags;
|
ClutterKeyboardA11yFlags a11y_flags;
|
||||||
GList *slow_keys_list;
|
GList *slow_keys_list;
|
||||||
@ -137,4 +141,11 @@ 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_set_coords (MetaInputDeviceNative *device_native,
|
||||||
|
float x,
|
||||||
|
float y);
|
||||||
|
void meta_input_device_native_get_coords (MetaInputDeviceNative *device_native,
|
||||||
|
float *x,
|
||||||
|
float *y);
|
||||||
|
|
||||||
#endif /* META_INPUT_DEVICE_NATIVE_H */
|
#endif /* META_INPUT_DEVICE_NATIVE_H */
|
||||||
|
@ -425,10 +425,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_set_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_set_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)
|
||||||
@ -574,16 +578,15 @@ meta_seat_native_notify_button (MetaSeatNative *seat,
|
|||||||
|
|
||||||
if (clutter_input_device_get_device_type (input_device) == CLUTTER_TABLET_DEVICE)
|
if (clutter_input_device_get_device_type (input_device) == CLUTTER_TABLET_DEVICE)
|
||||||
{
|
{
|
||||||
graphene_point_t point;
|
meta_input_device_native_get_coords (device_evdev,
|
||||||
|
&event->button.x,
|
||||||
clutter_input_device_get_coords (input_device, NULL, &point);
|
&event->button.y);
|
||||||
event->button.x = point.x;
|
|
||||||
event->button.y = point.y;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
event->button.x = seat->pointer_x;
|
meta_input_device_native_get_coords (META_INPUT_DEVICE_NATIVE (seat->core_pointer),
|
||||||
event->button.y = seat->pointer_y;
|
&event->button.x,
|
||||||
|
&event->button.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
clutter_event_set_device (event, seat->core_pointer);
|
clutter_event_set_device (event, seat->core_pointer);
|
||||||
@ -878,14 +881,11 @@ constrain_all_screen_monitors (ClutterInputDevice *device,
|
|||||||
float *x,
|
float *x,
|
||||||
float *y)
|
float *y)
|
||||||
{
|
{
|
||||||
graphene_point_t current;
|
|
||||||
float cx, cy;
|
float cx, cy;
|
||||||
GList *logical_monitors, *l;
|
GList *logical_monitors, *l;
|
||||||
|
|
||||||
clutter_input_device_get_coords (device, NULL, ¤t);
|
meta_input_device_native_get_coords (META_INPUT_DEVICE_NATIVE (device),
|
||||||
|
&cx, &cy);
|
||||||
cx = current.x;
|
|
||||||
cy = current.y;
|
|
||||||
|
|
||||||
/* if we're trying to escape, clamp to the CRTC we're coming from */
|
/* if we're trying to escape, clamp to the CRTC we're coming from */
|
||||||
|
|
||||||
@ -1098,8 +1098,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,
|
||||||
@ -1127,20 +1127,19 @@ notify_pinch_gesture_event (ClutterInputDevice *input_device,
|
|||||||
MetaInputDeviceNative *device_evdev;
|
MetaInputDeviceNative *device_evdev;
|
||||||
MetaSeatNative *seat;
|
MetaSeatNative *seat;
|
||||||
ClutterEvent *event = NULL;
|
ClutterEvent *event = NULL;
|
||||||
graphene_point_t pos;
|
|
||||||
|
|
||||||
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);
|
||||||
|
|
||||||
event = clutter_event_new (CLUTTER_TOUCHPAD_PINCH);
|
event = clutter_event_new (CLUTTER_TOUCHPAD_PINCH);
|
||||||
|
|
||||||
clutter_input_device_get_coords (seat->core_pointer, NULL, &pos);
|
meta_input_device_native_get_coords (META_INPUT_DEVICE_NATIVE (seat->core_pointer),
|
||||||
|
&event->touchpad_pinch.x,
|
||||||
|
&event->touchpad_pinch.y);
|
||||||
|
|
||||||
meta_event_native_set_time_usec (event, time_us);
|
meta_event_native_set_time_usec (event, time_us);
|
||||||
event->touchpad_pinch.phase = phase;
|
event->touchpad_pinch.phase = phase;
|
||||||
event->touchpad_pinch.time = us2ms (time_us);
|
event->touchpad_pinch.time = us2ms (time_us);
|
||||||
event->touchpad_pinch.x = pos.x;
|
|
||||||
event->touchpad_pinch.y = pos.y;
|
|
||||||
event->touchpad_pinch.dx = dx;
|
event->touchpad_pinch.dx = dx;
|
||||||
event->touchpad_pinch.dy = dy;
|
event->touchpad_pinch.dy = dy;
|
||||||
event->touchpad_pinch.angle_delta = angle_delta;
|
event->touchpad_pinch.angle_delta = angle_delta;
|
||||||
@ -1166,7 +1165,6 @@ notify_swipe_gesture_event (ClutterInputDevice *input_device,
|
|||||||
MetaInputDeviceNative *device_evdev;
|
MetaInputDeviceNative *device_evdev;
|
||||||
MetaSeatNative *seat;
|
MetaSeatNative *seat;
|
||||||
ClutterEvent *event = NULL;
|
ClutterEvent *event = NULL;
|
||||||
graphene_point_t pos;
|
|
||||||
|
|
||||||
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);
|
||||||
@ -1177,9 +1175,9 @@ notify_swipe_gesture_event (ClutterInputDevice *input_device,
|
|||||||
event->touchpad_swipe.phase = phase;
|
event->touchpad_swipe.phase = phase;
|
||||||
event->touchpad_swipe.time = us2ms (time_us);
|
event->touchpad_swipe.time = us2ms (time_us);
|
||||||
|
|
||||||
clutter_input_device_get_coords (seat->core_pointer, NULL, &pos);
|
meta_input_device_native_get_coords (META_INPUT_DEVICE_NATIVE (seat->core_pointer),
|
||||||
event->touchpad_swipe.x = pos.x;
|
&event->touchpad_swipe.x,
|
||||||
event->touchpad_swipe.y = pos.y;
|
&event->touchpad_swipe.y);
|
||||||
event->touchpad_swipe.dx = dx;
|
event->touchpad_swipe.dx = dx;
|
||||||
event->touchpad_swipe.dy = dy;
|
event->touchpad_swipe.dy = dy;
|
||||||
event->touchpad_swipe.n_fingers = n_fingers;
|
event->touchpad_swipe.n_fingers = n_fingers;
|
||||||
@ -2501,7 +2499,7 @@ meta_seat_native_constructed (GObject *object)
|
|||||||
CLUTTER_INPUT_MODE_LOGICAL);
|
CLUTTER_INPUT_MODE_LOGICAL);
|
||||||
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_set_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;
|
||||||
|
|
||||||
@ -2840,6 +2838,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)
|
||||||
@ -2867,8 +2866,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)
|
||||||
|
Loading…
Reference in New Issue
Block a user