wayland: Change MetaWaylandDragDest::motion vmethod signature

Stop taking a ClutterEvent and pass the essentials here (x/y/evtime),
we don't have a ClutterEvent handy in all places that we call this
API, and it feels awkward to create one just for calling this vmethod.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3153>
This commit is contained in:
Carlos Garnacho 2021-12-02 00:06:11 +01:00
parent e648ef7980
commit 9e96b523ea
4 changed files with 28 additions and 21 deletions

View File

@ -357,9 +357,16 @@ drag_grab_motion (MetaWaylandPointerGrab *grab,
const ClutterEvent *event) const ClutterEvent *event)
{ {
MetaWaylandDragGrab *drag_grab = (MetaWaylandDragGrab*) grab; MetaWaylandDragGrab *drag_grab = (MetaWaylandDragGrab*) grab;
graphene_point_t point;
uint32_t time_ms;
if (drag_grab->drag_focus) if (drag_grab->drag_focus)
meta_wayland_surface_drag_dest_motion (drag_grab->drag_focus, event); {
clutter_event_get_coords (event, &point.x, &point.y);
time_ms = clutter_event_get_time (event);
meta_wayland_surface_drag_dest_motion (drag_grab->drag_focus,
point.x, point.y, time_ms);
}
if (drag_grab->drag_surface) if (drag_grab->drag_surface)
meta_feedback_actor_update (META_FEEDBACK_ACTOR (drag_grab->feedback_actor), meta_feedback_actor_update (META_FEEDBACK_ACTOR (drag_grab->feedback_actor),
@ -826,7 +833,9 @@ meta_wayland_drag_dest_focus_out (MetaWaylandDataDevice *data_device,
static void static void
meta_wayland_drag_dest_motion (MetaWaylandDataDevice *data_device, meta_wayland_drag_dest_motion (MetaWaylandDataDevice *data_device,
MetaWaylandSurface *surface, MetaWaylandSurface *surface,
const ClutterEvent *event) float x,
float y,
uint32_t time_ms)
{ {
MetaWaylandDragGrab *grab = data_device->current_grab; MetaWaylandDragGrab *grab = data_device->current_grab;
wl_fixed_t sx, sy; wl_fixed_t sx, sy;
@ -838,7 +847,7 @@ meta_wayland_drag_dest_motion (MetaWaylandDataDevice *data_device,
grab->drag_focus, grab->drag_focus,
&sx, &sy); &sx, &sy);
wl_data_device_send_motion (grab->drag_focus_data_device, wl_data_device_send_motion (grab->drag_focus_data_device,
clutter_event_get_time (event), time_ms,
sx, sy); sx, sy);
} }

View File

@ -1656,12 +1656,14 @@ meta_wayland_surface_drag_dest_focus_in (MetaWaylandSurface *surface,
void void
meta_wayland_surface_drag_dest_motion (MetaWaylandSurface *surface, meta_wayland_surface_drag_dest_motion (MetaWaylandSurface *surface,
const ClutterEvent *event) float x,
float y,
uint32_t time_ms)
{ {
MetaWaylandCompositor *compositor = surface->compositor; MetaWaylandCompositor *compositor = surface->compositor;
MetaWaylandDataDevice *data_device = &compositor->seat->data_device; MetaWaylandDataDevice *data_device = &compositor->seat->data_device;
surface->dnd.funcs->motion (data_device, surface, event); surface->dnd.funcs->motion (data_device, surface, x, y, time_ms);
} }
void void

View File

@ -147,7 +147,9 @@ struct _MetaWaylandDragDestFuncs
MetaWaylandSurface *surface); MetaWaylandSurface *surface);
void (* motion) (MetaWaylandDataDevice *data_device, void (* motion) (MetaWaylandDataDevice *data_device,
MetaWaylandSurface *surface, MetaWaylandSurface *surface,
const ClutterEvent *event); float x,
float y,
uint32_t time_ms);
void (* drop) (MetaWaylandDataDevice *data_device, void (* drop) (MetaWaylandDataDevice *data_device,
MetaWaylandSurface *surface); MetaWaylandSurface *surface);
void (* update) (MetaWaylandDataDevice *data_device, void (* update) (MetaWaylandDataDevice *data_device,
@ -315,7 +317,9 @@ void meta_wayland_surface_delete (MetaWaylandSurface *surface);
void meta_wayland_surface_drag_dest_focus_in (MetaWaylandSurface *surface, void meta_wayland_surface_drag_dest_focus_in (MetaWaylandSurface *surface,
MetaWaylandDataOffer *offer); MetaWaylandDataOffer *offer);
void meta_wayland_surface_drag_dest_motion (MetaWaylandSurface *surface, void meta_wayland_surface_drag_dest_motion (MetaWaylandSurface *surface,
const ClutterEvent *event); float x,
float y,
uint32_t time_ms);
void meta_wayland_surface_drag_dest_focus_out (MetaWaylandSurface *surface); void meta_wayland_surface_drag_dest_focus_out (MetaWaylandSurface *surface);
void meta_wayland_surface_drag_dest_drop (MetaWaylandSurface *surface); void meta_wayland_surface_drag_dest_drop (MetaWaylandSurface *surface);
void meta_wayland_surface_drag_dest_update (MetaWaylandSurface *surface); void meta_wayland_surface_drag_dest_update (MetaWaylandSurface *surface);

View File

@ -636,17 +636,15 @@ meta_x11_drag_dest_focus_out (MetaWaylandDataDevice *data_device,
static void static void
meta_x11_drag_dest_motion (MetaWaylandDataDevice *data_device, meta_x11_drag_dest_motion (MetaWaylandDataDevice *data_device,
MetaWaylandSurface *surface, MetaWaylandSurface *surface,
const ClutterEvent *event) float x,
float y,
uint32_t time_ms)
{ {
MetaWaylandSeat *seat = meta_wayland_data_device_get_seat (data_device); MetaWaylandSeat *seat = meta_wayland_data_device_get_seat (data_device);
MetaWaylandCompositor *compositor = meta_wayland_seat_get_compositor (seat); MetaWaylandCompositor *compositor = meta_wayland_seat_get_compositor (seat);
MetaXWaylandDnd *dnd = compositor->xwayland_manager.dnd; MetaXWaylandDnd *dnd = compositor->xwayland_manager.dnd;
guint32 time;
gfloat x, y;
time = clutter_event_get_time (event); xdnd_send_position (dnd, dnd->dnd_dest, time_ms, x, y);
clutter_event_get_coords (event, &x, &y);
xdnd_send_position (dnd, dnd->dnd_dest, time, x, y);
} }
static void static void
@ -975,28 +973,22 @@ meta_xwayland_dnd_handle_client_message (MetaWaylandCompositor *compositor,
} }
else if (event->message_type == xdnd_atoms[ATOM_DND_POSITION]) else if (event->message_type == xdnd_atoms[ATOM_DND_POSITION])
{ {
ClutterEvent *motion;
graphene_point_t pos; graphene_point_t pos;
uint32_t action = 0; uint32_t action = 0;
dnd->client_message_timestamp = event->data.l[3]; dnd->client_message_timestamp = event->data.l[3];
motion = clutter_event_new (CLUTTER_MOTION);
clutter_seat_query_state (clutter_input_device_get_seat (seat->pointer->device), clutter_seat_query_state (clutter_input_device_get_seat (seat->pointer->device),
seat->pointer->device, NULL, &pos, NULL); seat->pointer->device, NULL, &pos, NULL);
clutter_event_set_coords (motion, pos.x, pos.y);
clutter_event_set_device (motion, seat->pointer->device);
clutter_event_set_source_device (motion, seat->pointer->device);
clutter_event_set_time (motion, dnd->last_motion_time);
action = atom_to_action ((Atom) event->data.l[4]); action = atom_to_action ((Atom) event->data.l[4]);
meta_wayland_data_source_set_user_action (dnd->source, action); meta_wayland_data_source_set_user_action (dnd->source, action);
meta_wayland_surface_drag_dest_motion (drag_focus, motion); meta_wayland_surface_drag_dest_motion (drag_focus, pos.x, pos.y,
dnd->last_motion_time);
xdnd_send_status (dnd, (Window) event->data.l[0], xdnd_send_status (dnd, (Window) event->data.l[0],
meta_wayland_data_source_get_current_action (dnd->source)); meta_wayland_data_source_get_current_action (dnd->source));
clutter_event_free (motion);
return TRUE; return TRUE;
} }
else if (event->message_type == xdnd_atoms[ATOM_DND_LEAVE]) else if (event->message_type == xdnd_atoms[ATOM_DND_LEAVE])