aboutsummaryrefslogtreecommitdiff
path: root/rootston/wl_shell.c
diff options
context:
space:
mode:
authoremersion <contact@emersion.fr>2019-02-23 14:18:32 +0100
committeremersion <contact@emersion.fr>2019-02-23 14:18:32 +0100
commit9f11bf571e2644447b7b39aec8ee87ceab8015f0 (patch)
treecf4e552797ed0aabfc029cd9e1677cef4d473260 /rootston/wl_shell.c
parente86c7a3dd67f14d738b058c4aa3698e9e74958c9 (diff)
rootston: add a view child interface
Diffstat (limited to 'rootston/wl_shell.c')
-rw-r--r--rootston/wl_shell.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/rootston/wl_shell.c b/rootston/wl_shell.c
index 97067937..81c0c128 100644
--- a/rootston/wl_shell.c
+++ b/rootston/wl_shell.c
@@ -10,23 +10,25 @@
#include "rootston/input.h"
#include "rootston/server.h"
+static const struct roots_view_child_interface popup_impl;
+
static void popup_destroy(struct roots_view_child *child) {
- assert(child->destroy == popup_destroy);
+ assert(child->impl == &popup_impl);
struct roots_wl_shell_popup *popup = (struct roots_wl_shell_popup *)child;
- if (popup == NULL) {
- return;
- }
wl_list_remove(&popup->destroy.link);
wl_list_remove(&popup->set_state.link);
wl_list_remove(&popup->new_popup.link);
- view_child_finish(&popup->view_child);
free(popup);
}
+static const struct roots_view_child_interface popup_impl = {
+ .destroy = popup_destroy,
+};
+
static void popup_handle_destroy(struct wl_listener *listener, void *data) {
struct roots_wl_shell_popup *popup =
wl_container_of(listener, popup, destroy);
- popup_destroy((struct roots_view_child *)popup);
+ view_child_destroy(&popup->view_child);
}
static void popup_handle_set_state(struct wl_listener *listener, void *data) {
@@ -53,8 +55,8 @@ static struct roots_wl_shell_popup *popup_create(struct roots_view *view,
return NULL;
}
popup->wlr_wl_shell_surface = wlr_wl_shell_surface;
- popup->view_child.destroy = popup_destroy;
- view_child_init(&popup->view_child, view, wlr_wl_shell_surface->surface);
+ view_child_init(&popup->view_child, &popup_impl,
+ view, wlr_wl_shell_surface->surface);
popup->destroy.notify = popup_handle_destroy;
wl_signal_add(&wlr_wl_shell_surface->events.destroy, &popup->destroy);
popup->set_state.notify = popup_handle_set_state;