diff options
author | Ryan Dwyer <RyanDwyer@users.noreply.github.com> | 2018-07-10 20:49:20 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-10 20:49:20 +1000 |
commit | c1bb73f8652f367ee7b7b82f5fc13aff51145358 (patch) | |
tree | 9dc36287be4bed02c4e98e600f26f48ceff5d8d6 | |
parent | Merge pull request #2228 from emersion/focus-mode-toggle (diff) | |
parent | Merge branch 'master' into fix-stacked-layout (diff) | |
download | sway-c1bb73f8652f367ee7b7b82f5fc13aff51145358.tar.gz sway-c1bb73f8652f367ee7b7b82f5fc13aff51145358.tar.zst sway-c1bb73f8652f367ee7b7b82f5fc13aff51145358.zip |
Merge pull request #2236 from kupospelov/fix-stacked-layout
Fix title bar rendering for nested stacked containers
-rw-r--r-- | sway/desktop/render.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/sway/desktop/render.c b/sway/desktop/render.c index 43948f29..f554b813 100644 --- a/sway/desktop/render.c +++ b/sway/desktop/render.c | |||
@@ -599,9 +599,11 @@ static void render_container_tabbed(struct sway_output *output, | |||
599 | struct border_colors *current_colors = &config->border_colors.unfocused; | 599 | struct border_colors *current_colors = &config->border_colors.unfocused; |
600 | struct sway_container_state *pstate = &con->current; | 600 | struct sway_container_state *pstate = &con->current; |
601 | 601 | ||
602 | int tab_width = pstate->swayc_width / pstate->children->length; | ||
603 | |||
602 | // Render tabs | 604 | // Render tabs |
603 | for (int i = 0; i < con->current.children->length; ++i) { | 605 | for (int i = 0; i < pstate->children->length; ++i) { |
604 | struct sway_container *child = con->current.children->items[i]; | 606 | struct sway_container *child = pstate->children->items[i]; |
605 | struct sway_view *view = child->type == C_VIEW ? child->sway_view : NULL; | 607 | struct sway_view *view = child->type == C_VIEW ? child->sway_view : NULL; |
606 | struct sway_container_state *cstate = &child->current; | 608 | struct sway_container_state *cstate = &child->current; |
607 | struct border_colors *colors; | 609 | struct border_colors *colors; |
@@ -622,8 +624,8 @@ static void render_container_tabbed(struct sway_output *output, | |||
622 | marks_texture = view ? view->marks_unfocused : NULL; | 624 | marks_texture = view ? view->marks_unfocused : NULL; |
623 | } | 625 | } |
624 | 626 | ||
625 | int tab_width = pstate->swayc_width / pstate->children->length; | 627 | int x = cstate->swayc_x + tab_width * i; |
626 | int x = pstate->swayc_x + tab_width * i; | 628 | |
627 | // Make last tab use the remaining width of the parent | 629 | // Make last tab use the remaining width of the parent |
628 | if (i == pstate->children->length - 1) { | 630 | if (i == pstate->children->length - 1) { |
629 | tab_width = pstate->swayc_width - tab_width * i; | 631 | tab_width = pstate->swayc_width - tab_width * i; |
@@ -663,9 +665,11 @@ static void render_container_stacked(struct sway_output *output, | |||
663 | struct border_colors *current_colors = &config->border_colors.unfocused; | 665 | struct border_colors *current_colors = &config->border_colors.unfocused; |
664 | struct sway_container_state *pstate = &con->current; | 666 | struct sway_container_state *pstate = &con->current; |
665 | 667 | ||
668 | size_t titlebar_height = container_titlebar_height(); | ||
669 | |||
666 | // Render titles | 670 | // Render titles |
667 | for (int i = 0; i < con->current.children->length; ++i) { | 671 | for (int i = 0; i < pstate->children->length; ++i) { |
668 | struct sway_container *child = con->current.children->items[i]; | 672 | struct sway_container *child = pstate->children->items[i]; |
669 | struct sway_view *view = child->type == C_VIEW ? child->sway_view : NULL; | 673 | struct sway_view *view = child->type == C_VIEW ? child->sway_view : NULL; |
670 | struct sway_container_state *cstate = &child->current; | 674 | struct sway_container_state *cstate = &child->current; |
671 | struct border_colors *colors; | 675 | struct border_colors *colors; |
@@ -686,7 +690,7 @@ static void render_container_stacked(struct sway_output *output, | |||
686 | marks_texture = view ? view->marks_unfocused : NULL; | 690 | marks_texture = view ? view->marks_unfocused : NULL; |
687 | } | 691 | } |
688 | 692 | ||
689 | int y = pstate->swayc_y + container_titlebar_height() * i; | 693 | int y = cstate->swayc_y + titlebar_height * i; |
690 | render_titlebar(output, damage, child, cstate->swayc_x, y, | 694 | render_titlebar(output, damage, child, cstate->swayc_x, y, |
691 | cstate->swayc_width, colors, title_texture, marks_texture); | 695 | cstate->swayc_width, colors, title_texture, marks_texture); |
692 | 696 | ||