[PATCH] data-device: notify the compositor about new drag icons
Ander Conselvan de Oliveira
ander.conselvan.de.oliveira at intel.com
Tue Mar 27 07:36:35 PDT 2012
Let the compositor use a listener to be notified when a new drag icon
is set up.
---
src/data-device.c | 5 +++++
src/wayland-server.c | 2 ++
src/wayland-server.h | 1 +
3 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/src/data-device.c b/src/data-device.c
index 57f31ca..797fdd7 100644
--- a/src/data-device.c
+++ b/src/data-device.c
@@ -300,6 +300,7 @@ data_device_start_drag(struct wl_client *client, struct wl_resource *resource,
struct wl_resource *icon_resource, uint32_t time)
{
struct wl_input_device *device = resource->data;
+ struct wl_listener *listener, *tmp;
/* FIXME: Check that client has implicit grab on the origin
* surface that matches the given time. */
@@ -318,6 +319,10 @@ data_device_start_drag(struct wl_client *client, struct wl_resource *resource,
device->drag_icon_listener.func = destroy_data_device_icon;
wl_list_insert(icon_resource->destroy_listener_list.prev,
&device->drag_icon_listener.link);
+
+ wl_list_for_each_safe(listener, tmp,
+ &device->drag_icon_listener_list, link)
+ listener->func(listener, icon_resource, time);
}
wl_input_device_start_pointer_grab(device, &device->drag_grab, time);
diff --git a/src/wayland-server.c b/src/wayland-server.c
index 899c094..07a3964 100644
--- a/src/wayland-server.c
+++ b/src/wayland-server.c
@@ -533,6 +533,8 @@ wl_input_device_init(struct wl_input_device *device)
device->selection_data_source = NULL;
wl_list_init(&device->selection_listener_list);
+ wl_list_init(&device->drag_icon_listener_list);
+
device->x = 100;
device->y = 100;
}
diff --git a/src/wayland-server.h b/src/wayland-server.h
index 78372eb..c9b59bd 100644
--- a/src/wayland-server.h
+++ b/src/wayland-server.h
@@ -233,6 +233,7 @@ struct wl_input_device {
struct wl_pointer_grab drag_grab;
struct wl_surface *drag_surface;
struct wl_listener drag_icon_listener;
+ struct wl_list drag_icon_listener_list;
struct wl_data_source *selection_data_source;
struct wl_listener selection_data_source_listener;
--
1.7.4.1
More information about the wayland-devel
mailing list