aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRonan Pigott <rpigott@berkeley.edu>2020-07-30 16:31:52 -0700
committerSimon Ser <contact@emersion.fr>2020-08-05 11:05:49 +0200
commitf478f4cc6663f9519281f08334f1f27e3182b022 (patch)
treeb309a8f99c857d1beac60bd4d07a1dca1f722ae4
parenta01573016a0a18476afbc2fa7c467406338a7672 (diff)
view: implement foreign toplevel fullscreen request
-rw-r--r--include/sway/tree/view.h1
-rw-r--r--sway/tree/view.c30
2 files changed, 31 insertions, 0 deletions
diff --git a/include/sway/tree/view.h b/include/sway/tree/view.h
index a32f5907..58722dbd 100644
--- a/include/sway/tree/view.h
+++ b/include/sway/tree/view.h
@@ -99,6 +99,7 @@ struct sway_view {
struct wlr_foreign_toplevel_handle_v1 *foreign_toplevel;
struct wl_listener foreign_activate_request;
+ struct wl_listener foreign_fullscreen_request;
struct wl_listener foreign_close_request;
bool destroying;
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);