summaryrefslogtreecommitdiff
path: root/sway/desktop/render.c
diff options
context:
space:
mode:
authorhead-gardener <[email protected]>2023-03-12 10:20:50 +0300
committerGitHub <[email protected]>2023-03-12 03:20:50 -0400
commitac31a612164828ca6ae5478332eee3cd2317ffdc (patch)
tree6d76f04b672818d527f277fe632377e0a673e06f /sway/desktop/render.c
parent3b101734e67a0966026533ad224d9afa3672e434 (diff)
feature: hide separator between titlebar and content (#91)
Diffstat (limited to 'sway/desktop/render.c')
-rw-r--r--sway/desktop/render.c30
1 files changed, 17 insertions, 13 deletions
diff --git a/sway/desktop/render.c b/sway/desktop/render.c
index f5d8ab3d..29e42d82 100644
--- a/sway/desktop/render.c
+++ b/sway/desktop/render.c
@@ -631,6 +631,8 @@ static void render_titlebar(struct sway_output *output,
int titlebar_h_padding = config->titlebar_h_padding;
int titlebar_v_padding = config->titlebar_v_padding;
enum alignment title_align = config->title_align;
+ // value by which all heights should be adjusted to counteract removed bottom border
+ int bottom_border_compensation = config->titlebar_separator ? 0 : titlebar_border_thickness;
if (corner_location == NONE) {
corner_radius = 0;
@@ -660,18 +662,20 @@ static void render_titlebar(struct sway_output *output,
render_rect(output, output_damage, &box, color);
// Single pixel bar below title
- box.x = x;
- box.y = y + container_titlebar_height() - titlebar_border_thickness;
- box.width = width;
- box.height = titlebar_border_thickness;
- scale_box(&box, output_scale);
- render_rect(output, output_damage, &box, color);
+ if (config->titlebar_separator) {
+ box.x = x;
+ box.y = y + container_titlebar_height() - titlebar_border_thickness;
+ box.width = width;
+ box.height = titlebar_border_thickness;
+ scale_box(&box, output_scale);
+ render_rect(output, output_damage, &box, color);
+ }
// Single pixel bar left edge
box.x = x;
box.y = y;
box.width = titlebar_border_thickness;
- box.height = container_titlebar_height() - titlebar_border_thickness;
+ box.height = container_titlebar_height() + bottom_border_compensation;
if (corner_radius && corner_location != TOP_RIGHT) {
box.height -= corner_radius;
box.y += corner_radius;
@@ -683,7 +687,7 @@ static void render_titlebar(struct sway_output *output,
box.x = x + width - titlebar_border_thickness;
box.y = y;
box.width = titlebar_border_thickness;
- box.height = container_titlebar_height() - titlebar_border_thickness;
+ box.height = container_titlebar_height() + bottom_border_compensation;
if (corner_radius && corner_location != TOP_LEFT) {
box.height -= corner_radius;
box.y += corner_radius;
@@ -781,7 +785,7 @@ static void render_titlebar(struct sway_output *output,
// Padding below
box.y += ob_padding_above + texture_box.height;
- box.height = ob_padding_below;
+ box.height = ob_padding_below + bottom_border_compensation;
render_rect(output, output_damage, &box, color);
}
@@ -857,7 +861,7 @@ static void render_titlebar(struct sway_output *output,
// Padding below
box.y += ob_padding_above + texture_box.height;
- box.height = ob_padding_below;
+ box.height = ob_padding_below + bottom_border_compensation;
render_rect(output, output_damage, &box, color);
}
@@ -891,7 +895,7 @@ static void render_titlebar(struct sway_output *output,
if (box.width > 0) {
box.x = ob_left_x + ob_left_width + round(output_x * output_scale);
box.y = round(bg_y * output_scale);
- box.height = ob_bg_height;
+ box.height = ob_bg_height + bottom_border_compensation;
render_rect(output, output_damage, &box, color);
}
@@ -900,7 +904,7 @@ static void render_titlebar(struct sway_output *output,
box.y = y + titlebar_border_thickness;
box.width = titlebar_h_padding - titlebar_border_thickness;
box.height = (titlebar_v_padding - titlebar_border_thickness) * 2 +
- config->font_height;
+ config->font_height + bottom_border_compensation;
scale_box(&box, output_scale);
int left_x = ob_left_x + round(output_x * output_scale);
if (box.x + box.width < left_x) {
@@ -917,7 +921,7 @@ static void render_titlebar(struct sway_output *output,
box.y = y + titlebar_border_thickness;
box.width = titlebar_h_padding - titlebar_border_thickness;
box.height = (titlebar_v_padding - titlebar_border_thickness) * 2 +
- config->font_height;
+ config->font_height + bottom_border_compensation;
scale_box(&box, output_scale);
int right_rx = ob_right_x + ob_right_width + round(output_x * output_scale);
if (right_rx < box.x) {