From 03e83c7ef94e90a78390209af8d9c2a0c0adb237 Mon Sep 17 00:00:00 2001 From: taiyu Date: Tue, 18 Aug 2015 11:22:52 -0700 Subject: restored fullscreen/focus behavior --- sway/layout.c | 62 ++++++++++++++++++++++++++++++++++++++--------------------- 1 file changed, 40 insertions(+), 22 deletions(-) (limited to 'sway/layout.c') diff --git a/sway/layout.c b/sway/layout.c index e2ea46a7..105359d2 100644 --- a/sway/layout.c +++ b/sway/layout.c @@ -1,11 +1,12 @@ #include #include #include -#include "list.h" -#include "log.h" #include "layout.h" +#include "log.h" +#include "list.h" #include "container.h" #include "workspace.h" +#include "focus.h" swayc_t root_container; @@ -79,9 +80,10 @@ swayc_t *remove_child(swayc_t *child) { } } } + //Set focused to new container if (parent->focused == child) { if (parent->children->length > 0) { - parent->focused = parent->children->items[i?i-1:0]; + set_focused_container_for(parent, parent->children->items[i?i-1:0]); } else { parent->focused = NULL; } @@ -209,26 +211,42 @@ void arrange_windows(swayc_t *container, int width, int height) { if (container->type == C_WORKSPACE) { for (i = 0; i < container->floating->length; ++i) { swayc_t *view = container->floating->items[i]; - // Set the geometry - struct wlc_geometry geometry = { - .origin = { - .x = view->x, - .y = view->y - }, - .size = { - .w = view->width, - .h = view->height + if (view->type == C_VIEW) { + // Set the geometry + struct wlc_geometry geometry = { + .origin = { + .x = view->x, + .y = view->y + }, + .size = { + .w = view->width, + .h = view->height + } + }; + if (wlc_view_get_state(view->handle) & WLC_BIT_FULLSCREEN) { + swayc_t *parent = view; + while (parent->type != C_OUTPUT) { + parent = parent->parent; + } + geometry.origin.x = 0; + geometry.origin.y = 0; + geometry.size.w = parent->width; + geometry.size.h = parent->height; + wlc_view_set_geometry(view->handle, &geometry); + wlc_view_bring_to_front(view->handle); + } else { + wlc_view_set_geometry(view->handle, &geometry); + view->width = width; + view->height = height; + // Bring the views to the front in order of the list, the list + // will be kept up to date so that more recently focused views + // have higher indexes + // This is conditional on there not being a fullscreen view in the workspace + if (!container->focused + || !(wlc_view_get_state(container->focused->handle) & WLC_BIT_FULLSCREEN)) { + wlc_view_bring_to_front(view->handle); + } } - }; - wlc_view_set_geometry(view->handle, &geometry); - - // Bring the views to the front in order of the list, the list - // will be kept up to date so that more recently focused views - // have higher indexes - // This is conditional on there not being a fullscreen view in the workspace - if (!container->focused - || !(wlc_view_get_state(container->focused->handle) & WLC_BIT_FULLSCREEN)) { - wlc_view_bring_to_front(view->handle); } } } -- cgit v1.2.3