aboutsummaryrefslogtreecommitdiff
path: root/rootston/wl_shell.c
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2017-10-21 09:40:18 -0400
committerGitHub <noreply@github.com>2017-10-21 09:40:18 -0400
commitce2f945441155fa9d98935dabd6979304f2d2fbc (patch)
tree5e6d6aa0d0071093f64987fb4e189668062aa312 /rootston/wl_shell.c
parent17adb2621889284a2917f7a00a1dff2bc96c5b89 (diff)
parentf2c4b80620337e8533ce0986186cc914d45b6dce (diff)
Merge pull request #303 from emersion/wl-signal-no-list-init
Remove wl_list_init when using wl_signal_add
Diffstat (limited to 'rootston/wl_shell.c')
-rw-r--r--rootston/wl_shell.c19
1 files changed, 6 insertions, 13 deletions
diff --git a/rootston/wl_shell.c b/rootston/wl_shell.c
index 2c6047b1..248514f0 100644
--- a/rootston/wl_shell.c
+++ b/rootston/wl_shell.c
@@ -57,11 +57,8 @@ static void handle_destroy(struct wl_listener *listener, void *data) {
struct roots_wl_shell_surface *roots_surface =
wl_container_of(listener, roots_surface, destroy);
wl_list_remove(&roots_surface->destroy.link);
- wl_list_remove(&roots_surface->ping_timeout.link);
wl_list_remove(&roots_surface->request_move.link);
wl_list_remove(&roots_surface->request_resize.link);
- wl_list_remove(&roots_surface->request_set_fullscreen.link);
- wl_list_remove(&roots_surface->request_set_maximized.link);
view_destroy(roots_surface->view);
free(roots_surface);
}
@@ -88,25 +85,22 @@ void handle_wl_shell_surface(struct wl_listener *listener, void *data) {
if (!roots_surface) {
return;
}
- wl_list_init(&roots_surface->destroy.link);
roots_surface->destroy.notify = handle_destroy;
wl_signal_add(&surface->events.destroy, &roots_surface->destroy);
- wl_list_init(&roots_surface->ping_timeout.link);
- wl_list_init(&roots_surface->request_move.link);
roots_surface->request_move.notify = handle_request_move;
wl_signal_add(&surface->events.request_move, &roots_surface->request_move);
- wl_list_init(&roots_surface->request_resize.link);
roots_surface->request_resize.notify = handle_request_resize;
wl_signal_add(&surface->events.request_resize,
&roots_surface->request_resize);
- wl_list_init(&roots_surface->request_set_fullscreen.link);
- wl_list_init(&roots_surface->request_set_maximized.link);
- wl_list_init(&roots_surface->surface_commit.link);
roots_surface->surface_commit.notify = handle_surface_commit;
wl_signal_add(&surface->surface->events.commit,
&roots_surface->surface_commit);
struct roots_view *view = calloc(1, sizeof(struct roots_view));
+ if (!view) {
+ free(roots_surface);
+ return;
+ }
view->type = ROOTS_WL_SHELL_VIEW;
view->wl_shell_surface = surface;
@@ -121,9 +115,8 @@ void handle_wl_shell_surface(struct wl_listener *listener, void *data) {
if (surface->state == WLR_WL_SHELL_SURFACE_STATE_TRANSIENT) {
// we need to map it relative to the parent
- int i =
- list_seq_find(desktop->views,
- shell_surface_compare_equals, surface->parent);
+ int i = list_seq_find(desktop->views, shell_surface_compare_equals,
+ surface->parent);
if (i != -1) {
struct roots_view *parent = desktop->views->items[i];
view_set_position(view,