diff options
author | 2018-07-10 00:33:13 +0300 | |
---|---|---|
committer | 2018-07-10 00:33:13 +0300 | |
commit | 9dd54f934e73370b3438d48e062ec98a1db6b037 (patch) | |
tree | 45c14ac92de181ceba6023b04002e4ef6e64074e /sway/desktop | |
parent | Merge pull request #2223 from RyanDwyer/floating-move (diff) | |
download | sway-9dd54f934e73370b3438d48e062ec98a1db6b037.tar.gz sway-9dd54f934e73370b3438d48e062ec98a1db6b037.tar.zst sway-9dd54f934e73370b3438d48e062ec98a1db6b037.zip |
Fix titlebar rendering for nested stacked containers
Diffstat (limited to 'sway/desktop')
-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 | ||