diff options
author | Ronan Pigott <rpigott@berkeley.edu> | 2020-07-30 16:31:52 -0700 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2020-08-05 11:05:49 +0200 |
commit | f478f4cc6663f9519281f08334f1f27e3182b022 (patch) | |
tree | b309a8f99c857d1beac60bd4d07a1dca1f722ae4 /sway/tree/view.c | |
parent | a01573016a0a18476afbc2fa7c467406338a7672 (diff) |
view: implement foreign toplevel fullscreen request
Diffstat (limited to 'sway/tree/view.c')
-rw-r--r-- | sway/tree/view.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/sway/tree/view.c b/sway/tree/view.c index 2353feff..b1837242 100644 --- a/sway/tree/view.c +++ b/sway/tree/view.c @@ -636,6 +636,33 @@ static void handle_foreign_activate_request( } } +static void handle_foreign_fullscreen_request( + struct wl_listener *listener, void *data) { + struct sway_view *view = wl_container_of( + listener, view, foreign_fullscreen_request); + struct wlr_foreign_toplevel_handle_v1_fullscreen_event *event = data; + + // Match fullscreen command behavior for scratchpad hidden views + struct sway_container *container = view->container; + if (!container->workspace) { + while (container->parent) { + container = container->parent; + } + } + + container_set_fullscreen(container, + event->fullscreen ? FULLSCREEN_WORKSPACE : FULLSCREEN_NONE); + if (event->fullscreen) { + arrange_root(); + } else { + if (container->parent) { + arrange_container(container->parent); + } else if (container->workspace) { + arrange_workspace(container->workspace); + } + } +} + static void handle_foreign_close_request( struct wl_listener *listener, void *data) { struct sway_view *view = wl_container_of( @@ -676,6 +703,9 @@ void view_map(struct sway_view *view, struct wlr_surface *wlr_surface, view->foreign_activate_request.notify = handle_foreign_activate_request; wl_signal_add(&view->foreign_toplevel->events.request_activate, &view->foreign_activate_request); + view->foreign_fullscreen_request.notify = handle_foreign_fullscreen_request; + wl_signal_add(&view->foreign_toplevel->events.request_fullscreen, + &view->foreign_fullscreen_request); view->foreign_close_request.notify = handle_foreign_close_request; wl_signal_add(&view->foreign_toplevel->events.request_close, &view->foreign_close_request); |