diff options
Diffstat (limited to 'sway/desktop/wl_shell.c')
-rw-r--r-- | sway/desktop/wl_shell.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/sway/desktop/wl_shell.c b/sway/desktop/wl_shell.c index 96332e5c..2d666d95 100644 --- a/sway/desktop/wl_shell.c +++ b/sway/desktop/wl_shell.c | |||
@@ -61,14 +61,21 @@ static void destroy(struct sway_view *view) { | |||
61 | } | 61 | } |
62 | wl_list_remove(&wl_shell_view->commit.link); | 62 | wl_list_remove(&wl_shell_view->commit.link); |
63 | wl_list_remove(&wl_shell_view->destroy.link); | 63 | wl_list_remove(&wl_shell_view->destroy.link); |
64 | wl_list_remove(&wl_shell_view->request_fullscreen.link); | ||
65 | wl_list_remove(&wl_shell_view->set_state.link); | ||
64 | free(wl_shell_view); | 66 | free(wl_shell_view); |
65 | } | 67 | } |
66 | 68 | ||
69 | static void set_fullscreen(struct sway_view *view, bool fullscreen) { | ||
70 | // TODO | ||
71 | } | ||
72 | |||
67 | static const struct sway_view_impl view_impl = { | 73 | static const struct sway_view_impl view_impl = { |
68 | .get_prop = get_prop, | 74 | .get_prop = get_prop, |
69 | .configure = configure, | 75 | .configure = configure, |
70 | .close = _close, | 76 | .close = _close, |
71 | .destroy = destroy, | 77 | .destroy = destroy, |
78 | .set_fullscreen = set_fullscreen, | ||
72 | }; | 79 | }; |
73 | 80 | ||
74 | static void handle_commit(struct wl_listener *listener, void *data) { | 81 | static void handle_commit(struct wl_listener *listener, void *data) { |
@@ -88,6 +95,23 @@ static void handle_destroy(struct wl_listener *listener, void *data) { | |||
88 | view_destroy(&wl_shell_view->view); | 95 | view_destroy(&wl_shell_view->view); |
89 | } | 96 | } |
90 | 97 | ||
98 | static void handle_request_fullscreen(struct wl_listener *listener, void *data) { | ||
99 | struct sway_wl_shell_view *wl_shell_view = | ||
100 | wl_container_of(listener, wl_shell_view, request_fullscreen); | ||
101 | view_set_fullscreen(&wl_shell_view->view, true); | ||
102 | } | ||
103 | |||
104 | static void handle_set_state(struct wl_listener *listener, void *data) { | ||
105 | struct sway_wl_shell_view *wl_shell_view = | ||
106 | wl_container_of(listener, wl_shell_view, set_state); | ||
107 | struct sway_view *view = &wl_shell_view->view; | ||
108 | struct wlr_wl_shell_surface *surface = view->wlr_wl_shell_surface; | ||
109 | if (view->is_fullscreen && | ||
110 | surface->state != WLR_WL_SHELL_SURFACE_STATE_FULLSCREEN) { | ||
111 | view_set_fullscreen(view, false); | ||
112 | } | ||
113 | } | ||
114 | |||
91 | void handle_wl_shell_surface(struct wl_listener *listener, void *data) { | 115 | void handle_wl_shell_surface(struct wl_listener *listener, void *data) { |
92 | struct sway_server *server = wl_container_of(listener, server, | 116 | struct sway_server *server = wl_container_of(listener, server, |
93 | wl_shell_surface); | 117 | wl_shell_surface); |
@@ -127,6 +151,13 @@ void handle_wl_shell_surface(struct wl_listener *listener, void *data) { | |||
127 | wl_shell_view->destroy.notify = handle_destroy; | 151 | wl_shell_view->destroy.notify = handle_destroy; |
128 | wl_signal_add(&shell_surface->events.destroy, &wl_shell_view->destroy); | 152 | wl_signal_add(&shell_surface->events.destroy, &wl_shell_view->destroy); |
129 | 153 | ||
154 | wl_shell_view->request_fullscreen.notify = handle_request_fullscreen; | ||
155 | wl_signal_add(&shell_surface->events.request_fullscreen, | ||
156 | &wl_shell_view->request_fullscreen); | ||
157 | |||
158 | wl_shell_view->set_state.notify = handle_set_state; | ||
159 | wl_signal_add(&shell_surface->events.set_state, &wl_shell_view->set_state); | ||
160 | |||
130 | view_map(&wl_shell_view->view, shell_surface->surface); | 161 | view_map(&wl_shell_view->view, shell_surface->surface); |
131 | 162 | ||
132 | if (shell_surface->state == WLR_WL_SHELL_SURFACE_STATE_FULLSCREEN) { | 163 | if (shell_surface->state == WLR_WL_SHELL_SURFACE_STATE_FULLSCREEN) { |