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/wl_shell.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/wl_shell.c')
-rw-r--r-- | sway/desktop/wl_shell.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/sway/desktop/wl_shell.c b/sway/desktop/wl_shell.c index ab969b17..e0909a03 100644 --- a/sway/desktop/wl_shell.c +++ b/sway/desktop/wl_shell.c | |||
@@ -47,10 +47,6 @@ static void set_position(struct sway_view *view, double ox, double oy) { | |||
47 | view->swayc->y = oy; | 47 | view->swayc->y = oy; |
48 | } | 48 | } |
49 | 49 | ||
50 | static void set_activated(struct sway_view *view, bool activated) { | ||
51 | // no way to activate wl_shell | ||
52 | } | ||
53 | |||
54 | static void close(struct sway_view *view) { | 50 | static void close(struct sway_view *view) { |
55 | if (!assert_wl_shell(view)) { | 51 | if (!assert_wl_shell(view)) { |
56 | return; | 52 | return; |
@@ -59,6 +55,13 @@ static void close(struct sway_view *view) { | |||
59 | wl_client_destroy(view->wlr_wl_shell_surface->client); | 55 | wl_client_destroy(view->wlr_wl_shell_surface->client); |
60 | } | 56 | } |
61 | 57 | ||
58 | static const struct sway_view_impl view_impl = { | ||
59 | .get_prop = get_prop, | ||
60 | .set_size = set_size, | ||
61 | .set_position = set_position, | ||
62 | .close = close, | ||
63 | }; | ||
64 | |||
62 | static void handle_commit(struct wl_listener *listener, void *data) { | 65 | static void handle_commit(struct wl_listener *listener, void *data) { |
63 | struct sway_wl_shell_surface *sway_surface = | 66 | struct sway_wl_shell_surface *sway_surface = |
64 | wl_container_of(listener, sway_surface, commit); | 67 | wl_container_of(listener, sway_surface, commit); |
@@ -101,15 +104,10 @@ void handle_wl_shell_surface(struct wl_listener *listener, void *data) { | |||
101 | return; | 104 | return; |
102 | } | 105 | } |
103 | 106 | ||
104 | struct sway_view *view = view_create(SWAY_WL_SHELL_VIEW); | 107 | struct sway_view *view = view_create(SWAY_WL_SHELL_VIEW, &view_impl); |
105 | if (!sway_assert(view, "Failed to allocate view")) { | 108 | if (!sway_assert(view, "Failed to allocate view")) { |
106 | return; | 109 | return; |
107 | } | 110 | } |
108 | view->iface.get_prop = get_prop; | ||
109 | view->iface.set_size = set_size; | ||
110 | view->iface.set_position = set_position; | ||
111 | view->iface.set_activated = set_activated; | ||
112 | view->iface.close = close; | ||
113 | view->wlr_wl_shell_surface = shell_surface; | 111 | view->wlr_wl_shell_surface = shell_surface; |
114 | view->sway_wl_shell_surface = sway_surface; | 112 | view->sway_wl_shell_surface = sway_surface; |
115 | sway_surface->view = view; | 113 | sway_surface->view = view; |