From 20aa8ee67dc528299dbc8735220a1c081c7ff9f6 Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Fri, 25 Jan 2019 08:29:21 +1000 Subject: Implement fullscreen global --- sway/desktop/output.c | 30 ++++++++++++++++++++---------- sway/desktop/render.c | 10 +++++++++- sway/desktop/transaction.c | 2 +- sway/desktop/xdg_shell.c | 2 +- sway/desktop/xdg_shell_v6.c | 2 +- sway/desktop/xwayland.c | 2 +- 6 files changed, 33 insertions(+), 15 deletions(-) (limited to 'sway/desktop') diff --git a/sway/desktop/output.c b/sway/desktop/output.c index f18a118f..b5f164cb 100644 --- a/sway/desktop/output.c +++ b/sway/desktop/output.c @@ -251,17 +251,27 @@ static void output_for_each_surface(struct sway_output *output, }; struct sway_workspace *workspace = output_get_active_workspace(output); - if (workspace->current.fullscreen) { - for_each_surface_container_iterator( - workspace->current.fullscreen, &data); - container_for_each_child(workspace->current.fullscreen, + struct sway_container *fullscreen_con = root->fullscreen_global; + if (fullscreen_con && fullscreen_con->scratchpad && + !fullscreen_con->workspace) { + fullscreen_con = NULL; + } + if (!fullscreen_con) { + fullscreen_con = workspace->current.fullscreen; + } + if (fullscreen_con) { + for_each_surface_container_iterator(fullscreen_con, &data); + container_for_each_child(fullscreen_con, for_each_surface_container_iterator, &data); - for (int i = 0; i < workspace->current.floating->length; ++i) { - struct sway_container *floater = - workspace->current.floating->items[i]; - if (container_is_transient_for(floater, - workspace->current.fullscreen)) { - for_each_surface_container_iterator(floater, &data); + + // TODO: Show transient containers for fullscreen global + if (fullscreen_con == workspace->current.fullscreen) { + for (int i = 0; i < workspace->current.floating->length; ++i) { + struct sway_container *floater = + workspace->current.floating->items[i]; + if (container_is_transient_for(floater, fullscreen_con)) { + for_each_surface_container_iterator(floater, &data); + } } } #if HAVE_XWAYLAND diff --git a/sway/desktop/render.c b/sway/desktop/render.c index a38c6a07..fa27500e 100644 --- a/sway/desktop/render.c +++ b/sway/desktop/render.c @@ -985,7 +985,15 @@ void output_render(struct sway_output *output, struct timespec *when, goto render_overlay; } - struct sway_container *fullscreen_con = workspace->current.fullscreen; + struct sway_container *fullscreen_con = root->fullscreen_global; + if (fullscreen_con && fullscreen_con->scratchpad && + !fullscreen_con->workspace) { + fullscreen_con = NULL; + } + if (!fullscreen_con) { + fullscreen_con = workspace->current.fullscreen; + } + if (fullscreen_con) { float clear_color[] = {0.0f, 0.0f, 0.0f, 1.0f}; diff --git a/sway/desktop/transaction.c b/sway/desktop/transaction.c index 55cf1c5e..b06ac9cc 100644 --- a/sway/desktop/transaction.c +++ b/sway/desktop/transaction.c @@ -134,7 +134,7 @@ static void copy_container_state(struct sway_container *container, state->y = container->y; state->width = container->width; state->height = container->height; - state->is_fullscreen = container->is_fullscreen; + state->fullscreen_mode = container->fullscreen_mode; state->parent = container->parent; state->workspace = container->workspace; state->border = container->border; diff --git a/sway/desktop/xdg_shell.c b/sway/desktop/xdg_shell.c index e2c614b3..007b0a94 100644 --- a/sway/desktop/xdg_shell.c +++ b/sway/desktop/xdg_shell.c @@ -349,7 +349,7 @@ static void handle_request_fullscreen(struct wl_listener *listener, void *data) container_set_fullscreen(view->container, e->fullscreen); - arrange_workspace(view->container->workspace); + arrange_root(); transaction_commit_dirty(); } diff --git a/sway/desktop/xdg_shell_v6.c b/sway/desktop/xdg_shell_v6.c index f11c00b1..386e350e 100644 --- a/sway/desktop/xdg_shell_v6.c +++ b/sway/desktop/xdg_shell_v6.c @@ -342,7 +342,7 @@ static void handle_request_fullscreen(struct wl_listener *listener, void *data) container_set_fullscreen(view->container, e->fullscreen); - arrange_workspace(view->container->workspace); + arrange_root(); transaction_commit_dirty(); } diff --git a/sway/desktop/xwayland.c b/sway/desktop/xwayland.c index 4ea661f8..d9e1b0a9 100644 --- a/sway/desktop/xwayland.c +++ b/sway/desktop/xwayland.c @@ -453,7 +453,7 @@ static void handle_request_fullscreen(struct wl_listener *listener, void *data) } container_set_fullscreen(view->container, xsurface->fullscreen); - arrange_workspace(view->container->workspace); + arrange_root(); transaction_commit_dirty(); } -- cgit v1.2.3