diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/data-device.c | 38 |
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; |