summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnder Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>2012-03-27 17:36:39 +0300
committerKristian Høgsberg <krh@bitplanet.net>2012-03-27 16:36:53 -0400
commitd6ea33dfd6f71e070f1be77cf9c81707d818f468 (patch)
tree83d260bde83d5cd0bf32f56cbaf1084399d076e1
parent9390ae3ed102a4b555efdee1c049c8c58b2282c6 (diff)
compositor: use new drag icon listener for setting up drag surfaces
That way we can get rid of the call to weston_compositor_update_drag_surfaces() on shell->map().
-rw-r--r--src/compositor.c16
-rw-r--r--src/compositor.h2
-rw-r--r--src/shell.c2
3 files changed, 18 insertions, 2 deletions
diff --git a/src/compositor.c b/src/compositor.c
index be0e798..5172c70 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -1958,6 +1958,18 @@ bind_input_device(struct wl_client *client,
resource->destroy = unbind_input_device;
}
+static void
+device_handle_new_drag_icon(struct wl_listener *listener,
+ struct wl_resource *resource, uint32_t time)
+{
+ struct weston_input_device *device;
+
+ device = container_of(listener, struct weston_input_device,
+ new_drag_icon_listener);
+
+ weston_input_update_drag_surface(&device->input_device, 0, 0);
+}
+
WL_EXPORT void
weston_input_device_init(struct weston_input_device *device,
struct weston_compositor *ec)
@@ -1979,6 +1991,10 @@ weston_input_device_init(struct weston_input_device *device,
device->drag_surface_destroy_listener.func = handle_drag_surface_destroy;
wl_list_insert(ec->input_device_list.prev, &device->link);
+
+ device->new_drag_icon_listener.func = device_handle_new_drag_icon;
+ wl_list_insert(device->input_device.drag_icon_listener_list.prev,
+ &device->new_drag_icon_listener.link);
}
WL_EXPORT void
diff --git a/src/compositor.h b/src/compositor.h
index 58bae0f..d76e99d 100644
--- a/src/compositor.h
+++ b/src/compositor.h
@@ -121,6 +121,8 @@ struct weston_input_device {
struct wl_listener touch_focus_listener;
struct wl_resource *touch_focus_resource;
struct wl_listener touch_focus_resource_listener;
+
+ struct wl_listener new_drag_icon_listener;
};
struct weston_shader {
diff --git a/src/shell.c b/src/shell.c
index 550184a..e6935ce 100644
--- a/src/shell.c
+++ b/src/shell.c
@@ -1555,8 +1555,6 @@ map(struct weston_shell *base, struct weston_surface *surface,
surface->geometry.height = height;
surface->geometry.dirty = 1;
- weston_compositor_update_drag_surfaces(compositor);
-
/* initial positioning, see also configure() */
switch (surface_type) {
case SHELL_SURFACE_TOPLEVEL: