[mutter/wip/dnd-surface2: 5/18] data-device: Store the current drag grab
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wip/dnd-surface2: 5/18] data-device: Store the current drag grab
- Date: Tue, 30 Sep 2014 15:35:33 +0000 (UTC)
commit 30cc4e1d0a61f23e16a5abd98fc71bc1b62f6af1
Author: Carlos Garnacho <carlosg gnome org>
Date: Fri Sep 26 19:08:42 2014 +0200
data-device: Store the current drag grab
And bail out if any further start_drag() is attempted.
src/wayland/meta-wayland-data-device.c | 11 +++++++----
src/wayland/meta-wayland-data-device.h | 3 +++
2 files changed, 10 insertions(+), 4 deletions(-)
---
diff --git a/src/wayland/meta-wayland-data-device.c b/src/wayland/meta-wayland-data-device.c
index 60d1c8c..ed2e4f8 100644
--- a/src/wayland/meta-wayland-data-device.c
+++ b/src/wayland/meta-wayland-data-device.c
@@ -162,7 +162,7 @@ static struct wl_data_source_interface data_source_interface = {
data_source_destroy
};
-typedef struct {
+struct _MetaWaylandDragGrab {
MetaWaylandPointerGrab generic;
MetaWaylandSeat *seat;
@@ -177,7 +177,7 @@ typedef struct {
MetaWaylandDataSource *drag_data_source;
struct wl_listener drag_data_source_listener;
-} MetaWaylandDragGrab;
+};
static void
destroy_drag_focus (struct wl_listener *listener, void *data)
@@ -271,6 +271,8 @@ data_device_end_drag_grab (MetaWaylandDragGrab *drag_grab)
if (drag_grab->drag_data_source)
wl_list_remove (&drag_grab->drag_data_source_listener.link);
+ drag_grab->seat->data_device.current_grab = NULL;
+
drag_grab_focus (&drag_grab->generic, NULL);
meta_wayland_pointer_end_grab (drag_grab->generic.pointer);
@@ -339,10 +341,11 @@ data_device_start_drag (struct wl_client *client,
/* FIXME: Check that the data source type array isn't empty. */
- if (seat->pointer.grab != &seat->pointer.default_grab)
+ if (data_device->current_grab ||
+ seat->pointer.grab != &seat->pointer.default_grab)
return;
- drag_grab = g_slice_new0 (MetaWaylandDragGrab);
+ data_device->current_grab = drag_grab = g_slice_new0 (MetaWaylandDragGrab);
drag_grab->generic.interface = &drag_grab_interface;
drag_grab->generic.pointer = &seat->pointer;
diff --git a/src/wayland/meta-wayland-data-device.h b/src/wayland/meta-wayland-data-device.h
index 931346c..854c1fd 100644
--- a/src/wayland/meta-wayland-data-device.h
+++ b/src/wayland/meta-wayland-data-device.h
@@ -27,12 +27,15 @@
#include "meta-wayland-types.h"
+typedef struct _MetaWaylandDragGrab MetaWaylandDragGrab;
+
struct _MetaWaylandDataDevice
{
uint32_t selection_serial;
MetaWaylandDataSource *selection_data_source;
struct wl_listener selection_data_source_listener;
struct wl_list resource_list;
+ MetaWaylandDragGrab *current_grab;
};
void meta_wayland_data_device_manager_init (MetaWaylandCompositor *compositor);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]