wayland: Ensure drag surface offset changes update the DnD actor

This commit is contained in:
Carlos Garnacho 2014-10-06 17:07:43 +02:00 committed by Jasper St. Pierre
parent 113be01ce8
commit 9c589b6798
3 changed files with 39 additions and 0 deletions

View File

@ -643,3 +643,29 @@ meta_wayland_data_device_set_keyboard_focus (MetaWaylandDataDevice *data_device)
wl_data_device_send_selection (data_device_resource, offer);
}
}
gboolean
meta_wayland_data_device_is_dnd_surface (MetaWaylandDataDevice *data_device,
MetaWaylandSurface *surface)
{
return data_device->current_grab &&
data_device->current_grab->drag_surface == surface;
}
void
meta_wayland_data_device_update_dnd_surface (MetaWaylandDataDevice *data_device)
{
MetaWaylandDragGrab *drag_grab;
if (!data_device->current_grab)
return;
drag_grab = data_device->current_grab;
if (!drag_grab->feedback_actor || !drag_grab->drag_surface)
return;
meta_feedback_actor_set_anchor (META_FEEDBACK_ACTOR (drag_grab->feedback_actor),
-drag_grab->drag_surface->offset_x,
-drag_grab->drag_surface->offset_y);
}

View File

@ -44,4 +44,8 @@ void meta_wayland_data_device_init (MetaWaylandDataDevice *data_device);
void meta_wayland_data_device_set_keyboard_focus (MetaWaylandDataDevice *data_device);
gboolean meta_wayland_data_device_is_dnd_surface (MetaWaylandDataDevice *data_device,
MetaWaylandSurface *surface);
void meta_wayland_data_device_update_dnd_surface (MetaWaylandDataDevice *data_device);
#endif /* META_WAYLAND_DATA_DEVICE_H */

View File

@ -175,6 +175,13 @@ cursor_surface_commit (MetaWaylandSurface *surface,
meta_wayland_seat_update_cursor_surface (surface->compositor->seat);
}
static void
dnd_surface_commit (MetaWaylandSurface *surface,
MetaWaylandPendingState *pending)
{
meta_wayland_data_device_update_dnd_surface (&surface->compositor->seat->data_device);
}
static void
calculate_surface_window_geometry (MetaWaylandSurface *surface,
MetaRectangle *total_geometry,
@ -445,6 +452,8 @@ commit_pending_state (MetaWaylandSurface *surface,
if (surface == compositor->seat->pointer.cursor_surface)
cursor_surface_commit (surface, pending);
else if (meta_wayland_data_device_is_dnd_surface (&compositor->seat->data_device, surface))
dnd_surface_commit (surface, pending);
else if (surface->window)
toplevel_surface_commit (surface, pending);
else if (surface->subsurface.resource)