diff options
author | emersion <contact@emersion.fr> | 2018-03-31 18:07:44 -0400 |
---|---|---|
committer | emersion <contact@emersion.fr> | 2018-03-31 18:07:44 -0400 |
commit | 1d68f9ecca8870f2f2a6823072c77657436b123a (patch) | |
tree | d66fbfa54f5c20f77c640bb695e43c02f2364bc3 /sway/desktop/xdg_shell_v6.c | |
parent | Introduce common functions to create, map, unmap, destroy views (diff) | |
download | sway-1d68f9ecca8870f2f2a6823072c77657436b123a.tar.gz sway-1d68f9ecca8870f2f2a6823072c77657436b123a.tar.zst sway-1d68f9ecca8870f2f2a6823072c77657436b123a.zip |
Add sway_view_impl
Diffstat (limited to 'sway/desktop/xdg_shell_v6.c')
-rw-r--r-- | sway/desktop/xdg_shell_v6.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/sway/desktop/xdg_shell_v6.c b/sway/desktop/xdg_shell_v6.c index 77a35b13..c1adc7fe 100644 --- a/sway/desktop/xdg_shell_v6.c +++ b/sway/desktop/xdg_shell_v6.c | |||
@@ -67,6 +67,14 @@ static void close(struct sway_view *view) { | |||
67 | } | 67 | } |
68 | } | 68 | } |
69 | 69 | ||
70 | static const struct sway_view_impl view_impl = { | ||
71 | .get_prop = get_prop, | ||
72 | .set_size = set_size, | ||
73 | .set_position = set_position, | ||
74 | .set_activated = set_activated, | ||
75 | .close = close, | ||
76 | }; | ||
77 | |||
70 | static void handle_commit(struct wl_listener *listener, void *data) { | 78 | static void handle_commit(struct wl_listener *listener, void *data) { |
71 | struct sway_xdg_surface_v6 *sway_surface = | 79 | struct sway_xdg_surface_v6 *sway_surface = |
72 | wl_container_of(listener, sway_surface, commit); | 80 | wl_container_of(listener, sway_surface, commit); |
@@ -124,15 +132,10 @@ void handle_xdg_shell_v6_surface(struct wl_listener *listener, void *data) { | |||
124 | return; | 132 | return; |
125 | } | 133 | } |
126 | 134 | ||
127 | struct sway_view *view = view_create(SWAY_XDG_SHELL_V6_VIEW); | 135 | struct sway_view *view = view_create(SWAY_XDG_SHELL_V6_VIEW, &view_impl); |
128 | if (!sway_assert(view, "Failed to allocate view")) { | 136 | if (!sway_assert(view, "Failed to allocate view")) { |
129 | return; | 137 | return; |
130 | } | 138 | } |
131 | view->iface.get_prop = get_prop; | ||
132 | view->iface.set_size = set_size; | ||
133 | view->iface.set_position = set_position; | ||
134 | view->iface.set_activated = set_activated; | ||
135 | view->iface.close = close; | ||
136 | view->wlr_xdg_surface_v6 = xdg_surface; | 139 | view->wlr_xdg_surface_v6 = xdg_surface; |
137 | view->sway_xdg_surface_v6 = sway_surface; | 140 | view->sway_xdg_surface_v6 = sway_surface; |
138 | sway_surface->view = view; | 141 | sway_surface->view = view; |