summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Garnacho <carlosg@gnome.org>2014-10-06 17:07:43 +0200
committerCarlos Garnacho <carlosg@gnome.org>2014-10-06 17:11:18 +0200
commit80398e065f3d2db1c24a386cca90858eb10625e7 (patch)
tree304a00c25ee459987da2d8c65d50dc7c8dd164b8
parent55a583adb8fcf4a2312b2dc2833297a033999a81 (diff)
downloadmutter-wip/dnd-surface3.tar.gz
wayland: Ensure drag surface offset changes update the DnD actorwip/dnd-surface3
-rw-r--r--src/wayland/meta-wayland-data-device.c26
-rw-r--r--src/wayland/meta-wayland-data-device.h4
-rw-r--r--src/wayland/meta-wayland-surface.c9
3 files changed, 39 insertions, 0 deletions
diff --git a/src/wayland/meta-wayland-data-device.c b/src/wayland/meta-wayland-data-device.c
index 97f142687..421d34b3a 100644
--- a/src/wayland/meta-wayland-data-device.c
+++ b/src/wayland/meta-wayland-data-device.c
@@ -645,3 +645,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);
+}
diff --git a/src/wayland/meta-wayland-data-device.h b/src/wayland/meta-wayland-data-device.h
index 854c1fd7f..b4b3900c2 100644
--- a/src/wayland/meta-wayland-data-device.h
+++ b/src/wayland/meta-wayland-data-device.h
@@ -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 */
diff --git a/src/wayland/meta-wayland-surface.c b/src/wayland/meta-wayland-surface.c
index cf840e5c8..01d09a701 100644
--- a/src/wayland/meta-wayland-surface.c
+++ b/src/wayland/meta-wayland-surface.c
@@ -176,6 +176,13 @@ cursor_surface_commit (MetaWaylandSurface *surface,
}
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,
float parent_x,
@@ -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)