diff options
-rw-r--r-- | include/container.h | 6 | ||||
-rw-r--r-- | sway/border.c | 2 | ||||
-rw-r--r-- | sway/commands.c | 8 | ||||
-rw-r--r-- | sway/container.c | 11 | ||||
-rw-r--r-- | sway/focus.c | 2 | ||||
-rw-r--r-- | sway/layout.c | 4 |
6 files changed, 26 insertions, 7 deletions
diff --git a/include/container.h b/include/container.h index 26da851e..d9f33b8a 100644 --- a/include/container.h +++ b/include/container.h | |||
@@ -240,6 +240,12 @@ bool swayc_is_parent_of(swayc_t *parent, swayc_t *child); | |||
240 | * Returns true if the child is a desecendant of the parent. | 240 | * Returns true if the child is a desecendant of the parent. |
241 | */ | 241 | */ |
242 | bool swayc_is_child_of(swayc_t *child, swayc_t *parent); | 242 | bool swayc_is_child_of(swayc_t *child, swayc_t *parent); |
243 | |||
244 | /** | ||
245 | * Returns true if view is stacked or tabbed. | ||
246 | */ | ||
247 | bool swayc_is_tabbed_stacked(swayc_t *view); | ||
248 | |||
243 | /** | 249 | /** |
244 | * Returns the gap (padding) of the container. | 250 | * Returns the gap (padding) of the container. |
245 | * | 251 | * |
diff --git a/sway/border.c b/sway/border.c index ada5af2a..061c1427 100644 --- a/sway/border.c +++ b/sway/border.c | |||
@@ -237,7 +237,7 @@ void update_view_border(swayc_t *view) { | |||
237 | 237 | ||
238 | swayc_t *p = view->parent; | 238 | swayc_t *p = view->parent; |
239 | 239 | ||
240 | if (p->layout == L_TABBED || p->layout == L_STACKED) { | 240 | if (swayc_is_tabbed_stacked(view)) { |
241 | cr = create_border_buffer(view, view->border_geometry, &surface); | 241 | cr = create_border_buffer(view, view->border_geometry, &surface); |
242 | if (focused == view) { | 242 | if (focused == view) { |
243 | render_borders(view, cr, &config->border_colors.focused, false); | 243 | render_borders(view, cr, &config->border_colors.focused, false); |
diff --git a/sway/commands.c b/sway/commands.c index 07dd715c..12d60854 100644 --- a/sway/commands.c +++ b/sway/commands.c | |||
@@ -1764,8 +1764,16 @@ static struct cmd_results *cmd_layout(int argc, char **argv) { | |||
1764 | // cmd_workspace_layout | 1764 | // cmd_workspace_layout |
1765 | parent->layout = L_HORIZ; | 1765 | parent->layout = L_HORIZ; |
1766 | } else if (strcasecmp(argv[0], "tabbed") == 0) { | 1766 | } else if (strcasecmp(argv[0], "tabbed") == 0) { |
1767 | if (parent->type != C_CONTAINER) { | ||
1768 | parent = new_container(parent, L_TABBED); | ||
1769 | } | ||
1770 | |||
1767 | parent->layout = L_TABBED; | 1771 | parent->layout = L_TABBED; |
1768 | } else if (strcasecmp(argv[0], "stacking") == 0) { | 1772 | } else if (strcasecmp(argv[0], "stacking") == 0) { |
1773 | if (parent->type != C_CONTAINER) { | ||
1774 | parent = new_container(parent, L_STACKED); | ||
1775 | } | ||
1776 | |||
1769 | parent->layout = L_STACKED; | 1777 | parent->layout = L_STACKED; |
1770 | } else if (strcasecmp(argv[0], "splith") == 0) { | 1778 | } else if (strcasecmp(argv[0], "splith") == 0) { |
1771 | parent->layout = L_HORIZ; | 1779 | parent->layout = L_HORIZ; |
diff --git a/sway/container.c b/sway/container.c index e77ba062..2b100f40 100644 --- a/sway/container.c +++ b/sway/container.c | |||
@@ -237,7 +237,7 @@ swayc_t *new_container(swayc_t *child, enum swayc_layouts layout) { | |||
237 | add_child(workspace, cont); | 237 | add_child(workspace, cont); |
238 | // give them proper layouts | 238 | // give them proper layouts |
239 | cont->layout = workspace->layout; | 239 | cont->layout = workspace->layout; |
240 | workspace->layout = layout; | 240 | /* TODO: might break shit in move_container!!! workspace->layout = layout; */ |
241 | set_focused_container_for(workspace, get_focused_view(workspace)); | 241 | set_focused_container_for(workspace, get_focused_view(workspace)); |
242 | } else { // Or is built around container | 242 | } else { // Or is built around container |
243 | swayc_t *parent = replace_child(child, cont); | 243 | swayc_t *parent = replace_child(child, cont); |
@@ -722,9 +722,7 @@ void update_visibility_output(swayc_t *container, wlc_handle output) { | |||
722 | swayc_t *parent = container->parent; | 722 | swayc_t *parent = container->parent; |
723 | container->visible = parent->visible; | 723 | container->visible = parent->visible; |
724 | // special cases where visibility depends on focus | 724 | // special cases where visibility depends on focus |
725 | if (parent->type == C_OUTPUT | 725 | if (parent->type == C_OUTPUT || swayc_is_tabbed_stacked(container)) { |
726 | || parent->layout == L_TABBED | ||
727 | || parent->layout == L_STACKED) { | ||
728 | container->visible = parent->focused == container && parent->visible; | 726 | container->visible = parent->focused == container && parent->visible; |
729 | } | 727 | } |
730 | // Set visibility and output for view | 728 | // Set visibility and output for view |
@@ -814,3 +812,8 @@ static void close_view(swayc_t *container, void *data) { | |||
814 | void close_views(swayc_t *container) { | 812 | void close_views(swayc_t *container) { |
815 | container_map(container, close_view, NULL); | 813 | container_map(container, close_view, NULL); |
816 | } | 814 | } |
815 | |||
816 | bool swayc_is_tabbed_stacked(swayc_t *view) { | ||
817 | return (view->parent->layout == L_TABBED | ||
818 | || view->parent->layout == L_STACKED); | ||
819 | } | ||
diff --git a/sway/focus.c b/sway/focus.c index 8acdc772..8ce22456 100644 --- a/sway/focus.c +++ b/sway/focus.c | |||
@@ -149,7 +149,7 @@ bool set_focused_container(swayc_t *c) { | |||
149 | } | 149 | } |
150 | 150 | ||
151 | // rearrange if parent container is tabbed/stacked | 151 | // rearrange if parent container is tabbed/stacked |
152 | if (p->parent->layout == L_TABBED || p->parent->layout == L_STACKED) { | 152 | if (swayc_is_tabbed_stacked(p)) { |
153 | arrange_windows(p->parent, -1, -1); | 153 | arrange_windows(p->parent, -1, -1); |
154 | } | 154 | } |
155 | } else if (p->type == C_WORKSPACE) { | 155 | } else if (p->type == C_WORKSPACE) { |
diff --git a/sway/layout.c b/sway/layout.c index 0328d361..527579d9 100644 --- a/sway/layout.c +++ b/sway/layout.c | |||
@@ -458,7 +458,7 @@ void update_geometry(swayc_t *container) { | |||
458 | 458 | ||
459 | // use parent size if window is in a stacked/tabbed layout | 459 | // use parent size if window is in a stacked/tabbed layout |
460 | swayc_t *parent = container->parent; | 460 | swayc_t *parent = container->parent; |
461 | if (parent->layout == L_STACKED || parent->layout == L_TABBED) { | 461 | if (swayc_is_tabbed_stacked(container)) { |
462 | width = parent->width; | 462 | width = parent->width; |
463 | height = parent->height; | 463 | height = parent->height; |
464 | } | 464 | } |
@@ -833,6 +833,8 @@ static void arrange_windows_r(swayc_t *container, double width, double height) { | |||
833 | swayc_t *view = container->floating->items[i]; | 833 | swayc_t *view = container->floating->items[i]; |
834 | if (view->type == C_VIEW) { | 834 | if (view->type == C_VIEW) { |
835 | update_geometry(view); | 835 | update_geometry(view); |
836 | sway_log(L_DEBUG, "Set floating view to %.f x %.f @ %.f, %.f", view->width, | ||
837 | view->height, view->x, view->y); | ||
836 | if (swayc_is_fullscreen(view)) { | 838 | if (swayc_is_fullscreen(view)) { |
837 | wlc_view_bring_to_front(view->handle); | 839 | wlc_view_bring_to_front(view->handle); |
838 | } else if (!container->focused | 840 | } else if (!container->focused |