diff --git a/sway/desktop/render.c b/sway/desktop/render.c index c4c0004e..4b4abeff 100644 --- a/sway/desktop/render.c +++ b/sway/desktop/render.c @@ -376,21 +376,6 @@ static void render_view(struct render_context *ctx, scale_box(&box, output_scale); render_rect(ctx, &box, color); } - - if (state->border_bottom) { - if (!container_is_current_floating(con) && siblings->length == 1 && layout == L_VERT) { - memcpy(&color, colors->indicator, sizeof(float) * 4); - } else { - memcpy(&color, colors->child_border, sizeof(float) * 4); - } - premultiply_alpha(color, con->alpha); - box.x = floor(state->x); - box.y = floor(state->content_y + state->content_height); - box.width = state->width; - box.height = state->border_thickness; - scale_box(&box, output_scale); - render_rect(ctx, &box, color); - } } /** @@ -670,6 +655,37 @@ static void render_top_border(struct render_context *ctx, struct sway_container render_rect(ctx, &box, color); } +/** + * Render the bottom border line for a view using "border pixel". + */ +static void render_bottom_border(struct render_context *ctx, struct sway_container *con, + struct border_colors *colors) { + struct sway_container_state *state = &con->current; + if (!state->border_bottom) { + return; + } + struct wlr_box box; + float color[4]; + float output_scale = ctx->output->wlr_output->scale; + + list_t *siblings = container_get_current_siblings(con); + enum sway_container_layout layout = + container_current_parent_layout(con); + + if (!container_is_current_floating(con) && siblings->length == 1 && layout == L_VERT) { + memcpy(&color, colors->indicator, sizeof(float) * 4); + } else { + memcpy(&color, colors->child_border, sizeof(float) * 4); + } + premultiply_alpha(color, con->alpha); + box.x = floor(state->x); + box.y = floor(state->content_y + state->content_height); + box.width = state->width; + box.height = state->border_thickness; + scale_box(&box, output_scale); + render_rect(ctx, &box, color); +} + struct parent_data { enum sway_container_layout layout; struct wlr_box box; @@ -724,6 +740,11 @@ static void render_containers_linear(struct render_context *ctx, struct parent_d render_top_border(ctx, child, colors); } render_view(ctx, child, colors); + if (config->titlebar_position != TITLEBAR_BOTTOM) { + render_bottom_border(ctx, child, colors); + } else { + render_top_border(ctx, child, colors); + } } else { render_container(ctx, child, parent->focused || child->current.focused); @@ -801,6 +822,11 @@ static void render_containers_tabbed(struct render_context *ctx, struct parent_d // Render surface and left/right/bottom borders if (current->view) { render_view(ctx, current, current_colors); + if (config->titlebar_position != TITLEBAR_BOTTOM) { + render_bottom_border(ctx, current, current_colors); + } else { + render_top_border(ctx, current, current_colors); + } } else { render_container(ctx, current, parent->focused || current->current.focused); @@ -862,6 +888,11 @@ static void render_containers_stacked(struct render_context *ctx, struct parent_ // Render surface and left/right/bottom borders if (current->view) { + if (titlebar_is_on_top) { + render_bottom_border(ctx, current, current_colors); + } else { + render_top_border(ctx, current, current_colors); + } render_view(ctx, current, current_colors); } else { render_container(ctx, current, @@ -956,6 +987,11 @@ static void render_floating_container(struct render_context *ctx, } else if (con->current.border == B_PIXEL) { render_top_border(ctx, con, colors); } + if (config->titlebar_position != TITLEBAR_BOTTOM) { + render_bottom_border(ctx, con, colors); + } else { + render_top_border(ctx, con, colors); + } render_view(ctx, con, colors); } else { render_container(ctx, con, con->current.focused);