wl-shell: role committed

This commit is contained in:
Tony Crisci 2017-12-27 06:32:54 -05:00
parent d5ffa26564
commit 68328700c7
3 changed files with 7 additions and 14 deletions

View File

@ -70,7 +70,6 @@ struct wlr_wl_shell_surface {
char *class; char *class;
struct wl_listener surface_destroy_listener; struct wl_listener surface_destroy_listener;
struct wl_listener surface_commit_listener;
struct wlr_wl_shell_surface *parent; struct wlr_wl_shell_surface *parent;
struct wl_list popup_link; struct wl_list popup_link;
@ -79,7 +78,6 @@ struct wlr_wl_shell_surface {
struct { struct {
struct wl_signal destroy; struct wl_signal destroy;
struct wl_signal commit;
struct wl_signal ping_timeout; struct wl_signal ping_timeout;
struct wl_signal request_move; struct wl_signal request_move;

View File

@ -150,7 +150,7 @@ void handle_wl_shell_surface(struct wl_listener *listener, void *data) {
roots_surface->set_state.notify = handle_set_state; roots_surface->set_state.notify = handle_set_state;
wl_signal_add(&surface->events.set_state, &roots_surface->set_state); wl_signal_add(&surface->events.set_state, &roots_surface->set_state);
roots_surface->surface_commit.notify = handle_surface_commit; roots_surface->surface_commit.notify = handle_surface_commit;
wl_signal_add(&surface->events.commit, &roots_surface->surface_commit); wl_signal_add(&surface->surface->events.commit, &roots_surface->surface_commit);
struct roots_view *view = calloc(1, sizeof(struct roots_view)); struct roots_view *view = calloc(1, sizeof(struct roots_view));
if (!view) { if (!view) {

View File

@ -418,7 +418,7 @@ static void shell_surface_destroy(struct wlr_wl_shell_surface *surface) {
wl_list_remove(&surface->link); wl_list_remove(&surface->link);
wl_list_remove(&surface->surface_destroy_listener.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);
wl_event_source_remove(surface->ping_timer); wl_event_source_remove(surface->ping_timer);
free(surface->transient_state); free(surface->transient_state);
free(surface->title); free(surface->title);
@ -439,10 +439,9 @@ static void handle_wlr_surface_destroyed(struct wl_listener *listener,
wl_container_of(listener, surface, surface_destroy_listener); wl_container_of(listener, surface, surface_destroy_listener);
shell_surface_destroy(surface); shell_surface_destroy(surface);
} }
static void handle_wlr_surface_committed(struct wl_listener *listener, static void handle_wlr_surface_committed(struct wlr_surface *wlr_surface,
void *data) { void *role_data) {
struct wlr_wl_shell_surface *surface = struct wlr_wl_shell_surface *surface = role_data;
wl_container_of(listener, surface, surface_commit_listener);
if (!surface->configured && if (!surface->configured &&
wlr_surface_has_buffer(surface->surface) && wlr_surface_has_buffer(surface->surface) &&
surface->state != WLR_WL_SHELL_SURFACE_STATE_NONE) { surface->state != WLR_WL_SHELL_SURFACE_STATE_NONE) {
@ -459,8 +458,6 @@ static void handle_wlr_surface_committed(struct wl_listener *listener,
surface->popup_state->seat); surface->popup_state->seat);
shell_pointer_grab_maybe_end(&grab->pointer_grab); shell_pointer_grab_maybe_end(&grab->pointer_grab);
} }
wl_signal_emit(&surface->events.commit, surface);
} }
static int shell_surface_ping_timeout(void *user_data) { static int shell_surface_ping_timeout(void *user_data) {
@ -511,7 +508,6 @@ static void shell_protocol_get_shell_surface(struct wl_client *client,
wl_surface->resource); wl_surface->resource);
wl_signal_init(&wl_surface->events.destroy); wl_signal_init(&wl_surface->events.destroy);
wl_signal_init(&wl_surface->events.commit);
wl_signal_init(&wl_surface->events.ping_timeout); wl_signal_init(&wl_surface->events.ping_timeout);
wl_signal_init(&wl_surface->events.request_move); wl_signal_init(&wl_surface->events.request_move);
wl_signal_init(&wl_surface->events.request_resize); wl_signal_init(&wl_surface->events.request_resize);
@ -525,9 +521,8 @@ static void shell_protocol_get_shell_surface(struct wl_client *client,
&wl_surface->surface_destroy_listener); &wl_surface->surface_destroy_listener);
wl_surface->surface_destroy_listener.notify = handle_wlr_surface_destroyed; wl_surface->surface_destroy_listener.notify = handle_wlr_surface_destroyed;
wl_signal_add(&wl_surface->surface->events.commit, wlr_surface_set_role_committed(surface, handle_wlr_surface_committed,
&wl_surface->surface_commit_listener); wl_surface);
wl_surface->surface_commit_listener.notify = handle_wlr_surface_committed;
struct wl_display *display = wl_client_get_display(client); struct wl_display *display = wl_client_get_display(client);
struct wl_event_loop *loop = wl_display_get_event_loop(display); struct wl_event_loop *loop = wl_display_get_event_loop(display);