diff --git a/include/wlr/types/wlr_xdg_shell_v6.h b/include/wlr/types/wlr_xdg_shell_v6.h index b723a950..280bea27 100644 --- a/include/wlr/types/wlr_xdg_shell_v6.h +++ b/include/wlr/types/wlr_xdg_shell_v6.h @@ -122,10 +122,8 @@ struct wlr_xdg_surface_v6 { struct wlr_box *geometry; struct wl_listener surface_destroy_listener; - struct wl_listener surface_commit_listener; struct { - struct wl_signal commit; struct wl_signal destroy; struct wl_signal ping_timeout; diff --git a/rootston/xdg_shell_v6.c b/rootston/xdg_shell_v6.c index a0503ad8..0515263b 100644 --- a/rootston/xdg_shell_v6.c +++ b/rootston/xdg_shell_v6.c @@ -253,7 +253,7 @@ void handle_xdg_shell_v6_surface(struct wl_listener *listener, void *data) { return; } roots_surface->commit.notify = handle_commit; - wl_signal_add(&surface->events.commit, &roots_surface->commit); + wl_signal_add(&surface->surface->events.commit, &roots_surface->commit); roots_surface->destroy.notify = handle_destroy; wl_signal_add(&surface->events.destroy, &roots_surface->destroy); roots_surface->request_move.notify = handle_request_move; diff --git a/types/wlr_xdg_shell_v6.c b/types/wlr_xdg_shell_v6.c index 23d36b6f..bb6c171c 100644 --- a/types/wlr_xdg_shell_v6.c +++ b/types/wlr_xdg_shell_v6.c @@ -209,7 +209,7 @@ static void xdg_surface_destroy(struct wlr_xdg_surface_v6 *surface) { wl_resource_set_user_data(surface->resource, NULL); wl_list_remove(&surface->link); wl_list_remove(&surface->surface_destroy_listener.link); - wl_list_remove(&surface->surface_commit_listener.link); + wlr_surface_set_role_committed(surface->surface, NULL, NULL); free(surface->geometry); free(surface->next_geometry); free(surface->title); @@ -1047,10 +1047,9 @@ static void wlr_xdg_surface_v6_popup_committed( } } -static void handle_wlr_surface_committed(struct wl_listener *listener, - void *data) { - struct wlr_xdg_surface_v6 *surface = - wl_container_of(listener, surface, surface_commit_listener); +static void handle_wlr_surface_committed(struct wlr_surface *wlr_surface, + void *role_data) { + struct wlr_xdg_surface_v6 *surface = role_data; if (wlr_surface_has_buffer(surface->surface) && !surface->configured) { wl_resource_post_error(surface->resource, @@ -1085,8 +1084,6 @@ static void handle_wlr_surface_committed(struct wl_listener *listener, surface->added = true; wl_signal_emit(&surface->client->shell->events.new_surface, surface); } - - wl_signal_emit(&surface->events.commit, surface); } static void xdg_shell_get_xdg_surface(struct wl_client *wl_client, @@ -1148,7 +1145,6 @@ static void xdg_shell_get_xdg_surface(struct wl_client *wl_client, wl_signal_init(&surface->events.request_move); wl_signal_init(&surface->events.request_resize); wl_signal_init(&surface->events.request_show_window_menu); - wl_signal_init(&surface->events.commit); wl_signal_init(&surface->events.destroy); wl_signal_init(&surface->events.ping_timeout); @@ -1156,9 +1152,8 @@ static void xdg_shell_get_xdg_surface(struct wl_client *wl_client, &surface->surface_destroy_listener); surface->surface_destroy_listener.notify = handle_wlr_surface_destroyed; - wl_signal_add(&surface->surface->events.commit, - &surface->surface_commit_listener); - surface->surface_commit_listener.notify = handle_wlr_surface_committed; + wlr_surface_set_role_committed(surface->surface, + handle_wlr_surface_committed, surface); wlr_log(L_DEBUG, "new xdg_surface %p (res %p)", surface, surface->resource); wl_resource_set_implementation(surface->resource,