clutter: Drop clutter_input_device_get_coords() method

This is not device state anymore. It uses ClutterSeat API underneath,
so let callers do that instead.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403>
This commit is contained in:
Carlos Garnacho 2020-11-18 15:49:02 +01:00 committed by Marge Bot
parent efc1592d4d
commit c6849a66e8
12 changed files with 24 additions and 48 deletions

View File

@ -682,37 +682,6 @@ clutter_input_device_get_device_type (ClutterInputDevice *device)
return device->device_type; return device->device_type;
} }
/**
* clutter_input_device_get_coords:
* @device: a #ClutterInputDevice
* @sequence: (allow-none): a #ClutterEventSequence, or %NULL if
* the device is not touch-based
* @point: (out caller-allocates): return location for the pointer
* or touch point
*
* Retrieves the latest coordinates of a pointer or touch point of
* @device.
*
* Return value: %FALSE if the device's sequence hasn't been found,
* and %TRUE otherwise.
*
* Since: 1.12
*/
gboolean
clutter_input_device_get_coords (ClutterInputDevice *device,
ClutterEventSequence *sequence,
graphene_point_t *point)
{
ClutterSeat *seat;
g_return_val_if_fail (CLUTTER_IS_INPUT_DEVICE (device), FALSE);
g_return_val_if_fail (point != NULL, FALSE);
seat = clutter_input_device_get_seat (device);
return clutter_seat_query_state (seat, device, sequence, point, NULL);
}
/* /*
* clutter_input_device_update: * clutter_input_device_update:
* @device: a #ClutterInputDevice * @device: a #ClutterInputDevice
@ -750,7 +719,8 @@ clutter_input_device_update (ClutterInputDevice *device,
} }
else else
{ {
clutter_input_device_get_coords (device, sequence, &point); clutter_seat_query_state (clutter_input_device_get_seat (device),
device, NULL, &point, NULL);
time_ms = CLUTTER_CURRENT_TIME; time_ms = CLUTTER_CURRENT_TIME;
} }

View File

@ -83,10 +83,6 @@ GType clutter_input_device_get_type (void) G_GNUC_CONST;
CLUTTER_EXPORT CLUTTER_EXPORT
ClutterInputDeviceType clutter_input_device_get_device_type (ClutterInputDevice *device); ClutterInputDeviceType clutter_input_device_get_device_type (ClutterInputDevice *device);
CLUTTER_EXPORT
gboolean clutter_input_device_get_coords (ClutterInputDevice *device,
ClutterEventSequence *sequence,
graphene_point_t *point);
CLUTTER_EXPORT CLUTTER_EXPORT
ClutterModifierType clutter_input_device_get_modifier_state (ClutterInputDevice *device); ClutterModifierType clutter_input_device_get_modifier_state (ClutterInputDevice *device);
CLUTTER_EXPORT CLUTTER_EXPORT

View File

@ -909,7 +909,8 @@ clutter_stage_find_updated_devices (ClutterStage *stage)
case CLUTTER_PEN_DEVICE: case CLUTTER_PEN_DEVICE:
case CLUTTER_ERASER_DEVICE: case CLUTTER_ERASER_DEVICE:
case CLUTTER_CURSOR_DEVICE: case CLUTTER_CURSOR_DEVICE:
if (!clutter_input_device_get_coords (dev, NULL, &point)) if (!clutter_seat_query_state (seat, dev, NULL,
&point, NULL))
continue; continue;
view = clutter_stage_get_view_at (stage, point.x, point.y); view = clutter_stage_get_view_at (stage, point.x, point.y);

View File

@ -324,7 +324,7 @@ meta_backend_monitors_changed (MetaBackend *backend)
meta_backend_sync_screen_size (backend); meta_backend_sync_screen_size (backend);
if (clutter_input_device_get_coords (device, NULL, &point)) if (clutter_seat_query_state (seat, device, NULL, &point, NULL))
{ {
/* If we're outside all monitors, warp the pointer back inside */ /* If we're outside all monitors, warp the pointer back inside */
if ((!meta_monitor_manager_get_logical_monitor_at (monitor_manager, if ((!meta_monitor_manager_get_logical_monitor_at (monitor_manager,

View File

@ -448,7 +448,8 @@ meta_cursor_renderer_update_position (MetaCursorRenderer *renderer)
MetaCursorRendererPrivate *priv = meta_cursor_renderer_get_instance_private (renderer); MetaCursorRendererPrivate *priv = meta_cursor_renderer_get_instance_private (renderer);
graphene_point_t pos; graphene_point_t pos;
clutter_input_device_get_coords (priv->device, NULL, &pos); clutter_seat_query_state (clutter_input_device_get_seat (priv->device),
priv->device, NULL, &pos, NULL);
priv->current_x = pos.x; priv->current_x = pos.x;
priv->current_y = pos.y; priv->current_y = pos.y;

View File

@ -515,7 +515,8 @@ meta_barrier_manager_native_process (MetaBarrierManagerNative *manager,
MetaBarrierEventData barrier_event_data; MetaBarrierEventData barrier_event_data;
MetaBarrierImplNative *barrier_impl; MetaBarrierImplNative *barrier_impl;
if (!clutter_input_device_get_coords (device, NULL, &prev_pos)) if (!clutter_seat_query_state (clutter_input_device_get_seat (device),
device, NULL, &prev_pos, NULL))
return; return;
g_mutex_lock (&manager->mutex); g_mutex_lock (&manager->mutex);

View File

@ -609,7 +609,8 @@ meta_pointer_constraint_impl_native_ensure_constrained (MetaPointerConstraintImp
constraint_impl_native = META_POINTER_CONSTRAINT_IMPL_NATIVE (constraint_impl); constraint_impl_native = META_POINTER_CONSTRAINT_IMPL_NATIVE (constraint_impl);
region = cairo_region_reference (constraint_impl_native->region); region = cairo_region_reference (constraint_impl_native->region);
clutter_input_device_get_coords (device, NULL, &point); clutter_seat_query_state (clutter_input_device_get_seat (device),
device, NULL, &point, NULL);
x = point.x; x = point.x;
y = point.y; y = point.y;

View File

@ -63,7 +63,7 @@ meta_pointer_lock_wayland_create_constraint (MetaPointerConfinementWayland *conf
cairo_region_t *region; cairo_region_t *region;
float sx, sy, x, y; float sx, sy, x, y;
clutter_input_device_get_coords (pointer, NULL, &point); clutter_seat_query_state (seat, pointer, NULL, &point, NULL);
wayland_constraint = wayland_constraint =
meta_pointer_confinement_wayland_get_wayland_pointer_constraint (confinement); meta_pointer_confinement_wayland_get_wayland_pointer_constraint (confinement);
surface = meta_wayland_pointer_constraint_get_surface (wayland_constraint); surface = meta_wayland_pointer_constraint_get_surface (wayland_constraint);

View File

@ -198,7 +198,8 @@ meta_wayland_cursor_surface_is_on_logical_monitor (MetaWaylandSurfaceRole *role,
meta_rectangle_to_graphene_rect (&logical_monitor->rect); meta_rectangle_to_graphene_rect (&logical_monitor->rect);
device = meta_cursor_renderer_get_input_device (priv->cursor_renderer); device = meta_cursor_renderer_get_input_device (priv->cursor_renderer);
clutter_input_device_get_coords (device, NULL, &point); clutter_seat_query_state (clutter_input_device_get_seat (device),
device, NULL, &point, NULL);
return graphene_rect_contains_point (&logical_monitor_rect, &point); return graphene_rect_contains_point (&logical_monitor_rect, &point);
} }

View File

@ -641,7 +641,8 @@ meta_wayland_data_device_start_drag (MetaWaylandDataDevice *data
0, 0); 0, 0);
clutter_actor_add_child (drag_grab->feedback_actor, drag_surface_actor); clutter_actor_add_child (drag_grab->feedback_actor, drag_surface_actor);
clutter_input_device_get_coords (seat->pointer->device, NULL, &pos); clutter_seat_query_state (clutter_input_device_get_seat (seat->pointer->device),
seat->pointer->device, NULL, &pos, NULL);
meta_feedback_actor_set_position (META_FEEDBACK_ACTOR (drag_grab->feedback_actor), meta_feedback_actor_set_position (META_FEEDBACK_ACTOR (drag_grab->feedback_actor),
pos.x, pos.y); pos.x, pos.y);
} }

View File

@ -949,7 +949,8 @@ meta_wayland_pointer_set_focus (MetaWaylandPointer *pointer,
G_CALLBACK (focus_surface_destroyed), G_CALLBACK (focus_surface_destroyed),
pointer); pointer);
clutter_input_device_get_coords (pointer->device, NULL, &pos); clutter_seat_query_state (clutter_input_device_get_seat (pointer->device),
pointer->device, NULL, &pos, NULL);
focus_window = meta_wayland_surface_get_window (pointer->focus_surface); focus_window = meta_wayland_surface_get_window (pointer->focus_surface);
if (focus_window) if (focus_window)
@ -1061,7 +1062,8 @@ meta_wayland_pointer_get_relative_coordinates (MetaWaylandPointer *pointer,
float xf = 0.0f, yf = 0.0f; float xf = 0.0f, yf = 0.0f;
graphene_point_t pos; graphene_point_t pos;
clutter_input_device_get_coords (pointer->device, NULL, &pos); clutter_seat_query_state (clutter_input_device_get_seat (pointer->device),
pointer->device, NULL, &pos, NULL);
meta_wayland_surface_get_relative_coordinates (surface, pos.x, pos.y, &xf, &yf); meta_wayland_surface_get_relative_coordinates (surface, pos.x, pos.y, &xf, &yf);
*sx = wl_fixed_from_double (xf); *sx = wl_fixed_from_double (xf);

View File

@ -546,7 +546,8 @@ meta_x11_drag_dest_update (MetaWaylandDataDevice *data_device,
MetaWaylandSeat *seat = compositor->seat; MetaWaylandSeat *seat = compositor->seat;
graphene_point_t pos; graphene_point_t pos;
clutter_input_device_get_coords (seat->pointer->device, NULL, &pos); clutter_seat_query_state (clutter_input_device_get_seat (seat->pointer->device),
seat->pointer->device, NULL, &pos, NULL);
xdnd_send_position (dnd, dnd->dnd_dest, xdnd_send_position (dnd, dnd->dnd_dest,
clutter_get_current_event_time (), clutter_get_current_event_time (),
pos.x, pos.y); pos.x, pos.y);
@ -834,7 +835,8 @@ meta_xwayland_dnd_handle_client_message (MetaWaylandCompositor *compositor,
dnd->client_message_timestamp = event->data.l[3]; dnd->client_message_timestamp = event->data.l[3];
motion = clutter_event_new (CLUTTER_MOTION); motion = clutter_event_new (CLUTTER_MOTION);
clutter_input_device_get_coords (seat->pointer->device, NULL, &pos); clutter_seat_query_state (clutter_input_device_get_seat (seat->pointer->device),
seat->pointer->device, NULL, &pos, NULL);
clutter_event_set_coords (motion, pos.x, pos.y); clutter_event_set_coords (motion, pos.x, pos.y);
clutter_event_set_device (motion, seat->pointer->device); clutter_event_set_device (motion, seat->pointer->device);
clutter_event_set_source_device (motion, seat->pointer->device); clutter_event_set_source_device (motion, seat->pointer->device);