summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKristian Høgsberg <krh@bitplanet.net>2013-05-07 22:42:28 -0400
committerKristian Høgsberg <krh@bitplanet.net>2013-05-07 22:42:31 -0400
commit415f30cc08708ea06573f75ac4b4941303161fdc (patch)
treec519d38b8c87302abab3950933e6492e63368089 /src
parent5f9555763147a2b963011ee70b09499283ad10a3 (diff)
data-device: Map drag icon in configure handler
This how we usually do it, and we avoid 'polling' for mapping in weston_seat_update_drag_surface().
Diffstat (limited to 'src')
-rw-r--r--src/data-device.c38
1 files changed, 14 insertions, 24 deletions
diff --git a/src/data-device.c b/src/data-device.c
index 16ee121..8b2c7cf 100644
--- a/src/data-device.c
+++ b/src/data-device.c
@@ -165,7 +165,19 @@ find_resource(struct wl_list *list, struct wl_client *client)
static void
drag_surface_configure(struct weston_surface *es, int32_t sx, int32_t sy, int32_t width, int32_t height)
{
- empty_region(&es->pending.input);
+ struct weston_seat *seat = es->configure_private;
+ struct wl_list *list;
+
+ if (!weston_surface_is_mapped(es) && es->buffer_ref.buffer) {
+ if (seat->sprite && weston_surface_is_mapped(seat->sprite))
+ list = &seat->sprite->layer_link;
+ else
+ list = &seat->compositor->cursor_layer.surface_list;
+
+ wl_list_insert(list, &es->layer_link);
+ weston_surface_update_transform(es);
+ empty_region(&es->pending.input);
+ }
weston_surface_configure(es,
es->geometry.x + sx, es->geometry.y + sy,
@@ -190,6 +202,7 @@ device_setup_new_drag_surface(struct weston_seat *seat,
wl_fixed_to_double(seat->pointer->y));
surface->configure = drag_surface_configure;
+ surface->configure_private = seat;
wl_signal_add(&surface->surface.resource.destroy_signal,
&seat->drag_surface_destroy_listener);
@@ -209,35 +222,12 @@ device_release_drag_surface(struct weston_seat *seat)
seat->drag_surface = NULL;
}
-static void
-device_map_drag_surface(struct weston_seat *seat)
-{
- struct wl_list *list;
-
- if (weston_surface_is_mapped(seat->drag_surface) ||
- !seat->drag_surface->buffer_ref.buffer)
- return;
-
- if (seat->sprite && weston_surface_is_mapped(seat->sprite))
- list = &seat->sprite->layer_link;
- else
- list = &seat->compositor->cursor_layer.surface_list;
-
- wl_list_insert(list, &seat->drag_surface->layer_link);
- weston_surface_update_transform(seat->drag_surface);
- empty_region(&seat->drag_surface->input);
-}
-
void
weston_seat_update_drag_surface(struct weston_seat *seat, int dx, int dy)
{
if (!seat->drag_surface)
return;
- /* the client may not have attached a buffer to the drag surface
- * when we setup it up, so check if map is needed on every update */
- device_map_drag_surface(seat);
-
if (!dx && !dy)
return;