diff options
Diffstat (limited to 'sway/desktop/xdg_shell_v6.c')
-rw-r--r-- | sway/desktop/xdg_shell_v6.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/sway/desktop/xdg_shell_v6.c b/sway/desktop/xdg_shell_v6.c index e4703040..fdfb9346 100644 --- a/sway/desktop/xdg_shell_v6.c +++ b/sway/desktop/xdg_shell_v6.c | |||
@@ -118,6 +118,14 @@ static void set_activated(struct sway_view *view, bool activated) { | |||
118 | } | 118 | } |
119 | } | 119 | } |
120 | 120 | ||
121 | static void set_fullscreen(struct sway_view *view, bool fullscreen) { | ||
122 | if (xdg_shell_v6_view_from_view(view) == NULL) { | ||
123 | return; | ||
124 | } | ||
125 | struct wlr_xdg_surface_v6 *surface = view->wlr_xdg_surface_v6; | ||
126 | wlr_xdg_toplevel_v6_set_fullscreen(surface, fullscreen); | ||
127 | } | ||
128 | |||
121 | static void for_each_surface(struct sway_view *view, | 129 | static void for_each_surface(struct sway_view *view, |
122 | wlr_surface_iterator_func_t iterator, void *user_data) { | 130 | wlr_surface_iterator_func_t iterator, void *user_data) { |
123 | if (xdg_shell_v6_view_from_view(view) == NULL) { | 131 | if (xdg_shell_v6_view_from_view(view) == NULL) { |
@@ -146,6 +154,7 @@ static void destroy(struct sway_view *view) { | |||
146 | wl_list_remove(&xdg_shell_v6_view->destroy.link); | 154 | wl_list_remove(&xdg_shell_v6_view->destroy.link); |
147 | wl_list_remove(&xdg_shell_v6_view->map.link); | 155 | wl_list_remove(&xdg_shell_v6_view->map.link); |
148 | wl_list_remove(&xdg_shell_v6_view->unmap.link); | 156 | wl_list_remove(&xdg_shell_v6_view->unmap.link); |
157 | wl_list_remove(&xdg_shell_v6_view->request_fullscreen.link); | ||
149 | free(xdg_shell_v6_view); | 158 | free(xdg_shell_v6_view); |
150 | } | 159 | } |
151 | 160 | ||
@@ -153,6 +162,7 @@ static const struct sway_view_impl view_impl = { | |||
153 | .get_prop = get_prop, | 162 | .get_prop = get_prop, |
154 | .configure = configure, | 163 | .configure = configure, |
155 | .set_activated = set_activated, | 164 | .set_activated = set_activated, |
165 | .set_fullscreen = set_fullscreen, | ||
156 | .for_each_surface = for_each_surface, | 166 | .for_each_surface = for_each_surface, |
157 | .close = _close, | 167 | .close = _close, |
158 | .destroy = destroy, | 168 | .destroy = destroy, |
@@ -202,6 +212,10 @@ static void handle_map(struct wl_listener *listener, void *data) { | |||
202 | xdg_shell_v6_view->new_popup.notify = handle_new_popup; | 212 | xdg_shell_v6_view->new_popup.notify = handle_new_popup; |
203 | wl_signal_add(&xdg_surface->events.new_popup, | 213 | wl_signal_add(&xdg_surface->events.new_popup, |
204 | &xdg_shell_v6_view->new_popup); | 214 | &xdg_shell_v6_view->new_popup); |
215 | |||
216 | if (xdg_surface->toplevel->client_pending.fullscreen) { | ||
217 | view_set_fullscreen(view, true); | ||
218 | } | ||
205 | } | 219 | } |
206 | 220 | ||
207 | static void handle_destroy(struct wl_listener *listener, void *data) { | 221 | static void handle_destroy(struct wl_listener *listener, void *data) { |
@@ -210,6 +224,23 @@ static void handle_destroy(struct wl_listener *listener, void *data) { | |||
210 | view_destroy(&xdg_shell_v6_view->view); | 224 | view_destroy(&xdg_shell_v6_view->view); |
211 | } | 225 | } |
212 | 226 | ||
227 | static void handle_request_fullscreen(struct wl_listener *listener, void *data) { | ||
228 | struct sway_xdg_shell_v6_view *xdg_shell_v6_view = | ||
229 | wl_container_of(listener, xdg_shell_v6_view, request_fullscreen); | ||
230 | struct wlr_xdg_toplevel_v6_set_fullscreen_event *e = data; | ||
231 | |||
232 | if (!sway_assert(xdg_shell_v6_view->view.wlr_xdg_surface_v6->role == WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL, | ||
233 | "xdg_shell_v6 requested fullscreen of surface with role %i", | ||
234 | xdg_shell_v6_view->view.wlr_xdg_surface_v6->role)) { | ||
235 | return; | ||
236 | } | ||
237 | if (!xdg_shell_v6_view->view.wlr_xdg_surface_v6->mapped) { | ||
238 | return; | ||
239 | } | ||
240 | |||
241 | view_set_fullscreen(&xdg_shell_v6_view->view, e->fullscreen); | ||
242 | } | ||
243 | |||
213 | void handle_xdg_shell_v6_surface(struct wl_listener *listener, void *data) { | 244 | void handle_xdg_shell_v6_surface(struct wl_listener *listener, void *data) { |
214 | struct sway_server *server = wl_container_of(listener, server, | 245 | struct sway_server *server = wl_container_of(listener, server, |
215 | xdg_shell_v6_surface); | 246 | xdg_shell_v6_surface); |
@@ -246,4 +277,8 @@ void handle_xdg_shell_v6_surface(struct wl_listener *listener, void *data) { | |||
246 | 277 | ||
247 | xdg_shell_v6_view->destroy.notify = handle_destroy; | 278 | xdg_shell_v6_view->destroy.notify = handle_destroy; |
248 | wl_signal_add(&xdg_surface->events.destroy, &xdg_shell_v6_view->destroy); | 279 | wl_signal_add(&xdg_surface->events.destroy, &xdg_shell_v6_view->destroy); |
280 | |||
281 | xdg_shell_v6_view->request_fullscreen.notify = handle_request_fullscreen; | ||
282 | wl_signal_add(&xdg_surface->toplevel->events.request_fullscreen, | ||
283 | &xdg_shell_v6_view->request_fullscreen); | ||
249 | } | 284 | } |