From e42d762a88dfa588eea336e5302a2653c81b61bd Mon Sep 17 00:00:00 2001 From: Tony Crisci Date: Wed, 27 Dec 2017 06:41:14 -0500 Subject: [PATCH] drag-icon: surface committed --- include/wlr/types/wlr_data_device.h | 1 - types/wlr_data_device.c | 13 ++++++------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/include/wlr/types/wlr_data_device.h b/include/wlr/types/wlr_data_device.h index 70d79a19..e0205101 100644 --- a/include/wlr/types/wlr_data_device.h +++ b/include/wlr/types/wlr_data_device.h @@ -72,7 +72,6 @@ struct wlr_drag_icon { } events; struct wl_listener surface_destroy; - struct wl_listener surface_commit; struct wl_listener seat_client_destroy; }; diff --git a/types/wlr_data_device.c b/types/wlr_data_device.c index c0399160..376c8304 100644 --- a/types/wlr_data_device.c +++ b/types/wlr_data_device.c @@ -651,7 +651,7 @@ static void wlr_drag_icon_destroy(struct wlr_drag_icon *icon) { return; } wl_signal_emit(&icon->events.destroy, icon); - wl_list_remove(&icon->surface_commit.link); + wlr_surface_set_role_committed(icon->surface, NULL, NULL); wl_list_remove(&icon->surface_destroy.link); wl_list_remove(&icon->seat_client_destroy.link); wl_list_remove(&icon->link); @@ -665,10 +665,9 @@ static void handle_drag_icon_surface_destroy(struct wl_listener *listener, wlr_drag_icon_destroy(icon); } -static void handle_drag_icon_surface_commit(struct wl_listener *listener, - void *data) { - struct wlr_drag_icon *icon = - wl_container_of(listener, icon, surface_commit); +static void handle_drag_icon_surface_commit(struct wlr_surface *surface, + void *role_data) { + struct wlr_drag_icon *icon = role_data; icon->sx += icon->surface->current->sx; icon->sy += icon->surface->current->sy; } @@ -701,8 +700,8 @@ static struct wlr_drag_icon *wlr_drag_icon_create( wl_signal_add(&icon->surface->events.destroy, &icon->surface_destroy); icon->surface_destroy.notify = handle_drag_icon_surface_destroy; - wl_signal_add(&icon->surface->events.commit, &icon->surface_commit); - icon->surface_commit.notify = handle_drag_icon_surface_commit; + wlr_surface_set_role_committed(icon->surface, + handle_drag_icon_surface_commit, icon); wl_signal_add(&client->events.destroy, &icon->seat_client_destroy); icon->seat_client_destroy.notify = handle_drag_icon_seat_client_destroy;