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 /sway | |
parent | 5709c5d37577a9947bf31b249636c45f15b0258a (diff) | |
parent | 56ad148403d77a6defcbd6cd383dd5cde1a44954 (diff) |
Merge pull request #2236 from kupospelov/fix-stacked-layout
Fix title bar rendering for nested stacked containers
Diffstat (limited to 'sway')
-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, struct border_colors *current_colors = &config->border_colors.unfocused; struct sway_container_state *pstate = &con->current; + int tab_width = pstate->swayc_width / pstate->children->length; + // Render tabs - for (int i = 0; i < con->current.children->length; ++i) { - struct sway_container *child = con->current.children->items[i]; + for (int i = 0; i < pstate->children->length; ++i) { + struct sway_container *child = pstate->children->items[i]; struct sway_view *view = child->type == C_VIEW ? child->sway_view : NULL; struct sway_container_state *cstate = &child->current; struct border_colors *colors; @@ -622,8 +624,8 @@ static void render_container_tabbed(struct sway_output *output, marks_texture = view ? view->marks_unfocused : NULL; } - int tab_width = pstate->swayc_width / pstate->children->length; - int x = pstate->swayc_x + tab_width * i; + int x = cstate->swayc_x + tab_width * i; + // Make last tab use the remaining width of the parent if (i == pstate->children->length - 1) { tab_width = pstate->swayc_width - tab_width * i; @@ -663,9 +665,11 @@ static void render_container_stacked(struct sway_output *output, struct border_colors *current_colors = &config->border_colors.unfocused; struct sway_container_state *pstate = &con->current; + size_t titlebar_height = container_titlebar_height(); + // Render titles - for (int i = 0; i < con->current.children->length; ++i) { - struct sway_container *child = con->current.children->items[i]; + for (int i = 0; i < pstate->children->length; ++i) { + struct sway_container *child = pstate->children->items[i]; struct sway_view *view = child->type == C_VIEW ? child->sway_view : NULL; struct sway_container_state *cstate = &child->current; struct border_colors *colors; @@ -686,7 +690,7 @@ static void render_container_stacked(struct sway_output *output, marks_texture = view ? view->marks_unfocused : NULL; } - int y = pstate->swayc_y + container_titlebar_height() * i; + int y = cstate->swayc_y + titlebar_height * i; render_titlebar(output, damage, child, cstate->swayc_x, y, cstate->swayc_width, colors, title_texture, marks_texture); |