From 195226120fcf4854c90e544a6e7e0ec0b1c3312c Mon Sep 17 00:00:00 2001 From: Brian Ashworth Date: Sun, 24 Mar 2019 23:24:02 -0400 Subject: Honor output for xdg_toplevel_set_fullscreen This honors the fullscreen output request for `xdg_toplevel_set_fullscreen` and `zxdg_toplevel_v6_set_fullscreen`. If the request was sent before mapping, the fullscreen output request will be retrieved from the client_pending state for the toplevel. The output will be passed to `view_map` and if there is a workspace on the output, the view will be placed on that workspace. If the request comes in after being mapped, the view will be moved to the workspace on the output (if there is one) before becoming fullscreen. --- sway/desktop/xdg_shell.c | 16 +++++++++++++++- sway/desktop/xdg_shell_v6.c | 16 +++++++++++++++- sway/desktop/xwayland.c | 2 +- 3 files changed, 31 insertions(+), 3 deletions(-) (limited to 'sway/desktop') diff --git a/sway/desktop/xdg_shell.c b/sway/desktop/xdg_shell.c index ea5dcd16..9e914f14 100644 --- a/sway/desktop/xdg_shell.c +++ b/sway/desktop/xdg_shell.c @@ -339,6 +339,18 @@ static void handle_request_fullscreen(struct wl_listener *listener, void *data) return; } + if (e->fullscreen && e->output && e->output->data) { + struct sway_output *output = e->output->data; + struct sway_workspace *ws = output_get_active_workspace(output); + if (ws && !container_is_scratchpad_hidden(view->container)) { + if (container_is_floating(view->container)) { + workspace_add_floating(ws, view->container); + } else { + workspace_add_tiling(ws, view->container); + } + } + } + container_set_fullscreen(view->container, e->fullscreen); arrange_root(); @@ -417,7 +429,9 @@ static void handle_map(struct wl_listener *listener, void *data) { } view_map(view, view->wlr_xdg_surface->surface, - xdg_surface->toplevel->client_pending.fullscreen, csd); + xdg_surface->toplevel->client_pending.fullscreen, + xdg_surface->toplevel->client_pending.fullscreen_output, + csd); transaction_commit_dirty(); diff --git a/sway/desktop/xdg_shell_v6.c b/sway/desktop/xdg_shell_v6.c index 7ff4c4de..5ac589cf 100644 --- a/sway/desktop/xdg_shell_v6.c +++ b/sway/desktop/xdg_shell_v6.c @@ -339,6 +339,18 @@ static void handle_request_fullscreen(struct wl_listener *listener, void *data) return; } + if (e->fullscreen && e->output && e->output->data) { + struct sway_output *output = e->output->data; + struct sway_workspace *ws = output_get_active_workspace(output); + if (ws && !container_is_scratchpad_hidden(view->container)) { + if (container_is_floating(view->container)) { + workspace_add_floating(ws, view->container); + } else { + workspace_add_tiling(ws, view->container); + } + } + } + container_set_fullscreen(view->container, e->fullscreen); arrange_root(); @@ -411,7 +423,9 @@ static void handle_map(struct wl_listener *listener, void *data) { == WLR_SERVER_DECORATION_MANAGER_MODE_CLIENT; view_map(view, view->wlr_xdg_surface_v6->surface, - xdg_surface->toplevel->client_pending.fullscreen, csd); + xdg_surface->toplevel->client_pending.fullscreen, + xdg_surface->toplevel->client_pending.fullscreen_output, + csd); transaction_commit_dirty(); diff --git a/sway/desktop/xwayland.c b/sway/desktop/xwayland.c index 37d0b986..f6ca8f81 100644 --- a/sway/desktop/xwayland.c +++ b/sway/desktop/xwayland.c @@ -415,7 +415,7 @@ static void handle_map(struct wl_listener *listener, void *data) { xwayland_view->commit.notify = handle_commit; // Put it back into the tree - view_map(view, xsurface->surface, xsurface->fullscreen, false); + view_map(view, xsurface->surface, xsurface->fullscreen, NULL, false); transaction_commit_dirty(); } -- cgit v1.2.3