aboutsummaryrefslogtreecommitdiff
path: root/sway
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2023-05-09 16:39:48 +0200
committerKenny Levinsen <kl@kl.wtf>2023-05-09 18:12:06 +0200
commit19cc36accc0d5a9997fd264c98df92b8b0ed8bea (patch)
tree5fd35dce841d47efaba02bc1a7d19746fc8b735c /sway
parent0a951517aed2375b972bbd70cb164bf7acb25e00 (diff)
render: fix titlebar texture clipping
We need to provide an unclipped dst_box. Fixes: https://github.com/swaywm/sway/issues/7573 Regressed by: https://github.com/swaywm/sway/pull/7552
Diffstat (limited to 'sway')
-rw-r--r--sway/desktop/render.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/sway/desktop/render.c b/sway/desktop/render.c
index edefa658..223457b2 100644
--- a/sway/desktop/render.c
+++ b/sway/desktop/render.c
@@ -509,23 +509,24 @@ static void render_titlebar(struct render_context *ctx, struct sway_container *c
texture_box.y = round((bg_y - output_y) * output_scale) +
ob_padding_above;
- if (ob_inner_width < texture_box.width) {
- texture_box.width = ob_inner_width;
+ struct wlr_box clip_box = texture_box;
+ if (ob_inner_width < clip_box.width) {
+ clip_box.width = ob_inner_width;
}
render_texture(ctx, marks_texture,
- NULL, &texture_box, NULL, WL_OUTPUT_TRANSFORM_NORMAL, con->alpha);
+ NULL, &texture_box, &clip_box, WL_OUTPUT_TRANSFORM_NORMAL, con->alpha);
// Padding above
memcpy(&color, colors->background, sizeof(float) * 4);
premultiply_alpha(color, con->alpha);
- box.x = texture_box.x + round(output_x * output_scale);
+ box.x = clip_box.x + round(output_x * output_scale);
box.y = roundf((y + titlebar_border_thickness) * output_scale);
- box.width = texture_box.width;
+ box.width = clip_box.width;
box.height = ob_padding_above;
render_rect(ctx, &box, color);
// Padding below
- box.y += ob_padding_above + texture_box.height;
+ box.y += ob_padding_above + clip_box.height;
box.height = ob_padding_below;
render_rect(ctx, &box, color);
}
@@ -579,24 +580,25 @@ static void render_titlebar(struct render_context *ctx, struct sway_container *c
texture_box.y =
round((bg_y - output_y) * output_scale) + ob_padding_above;
- if (ob_inner_width - ob_marks_width < texture_box.width) {
- texture_box.width = ob_inner_width - ob_marks_width;
+ struct wlr_box clip_box = texture_box;
+ if (ob_inner_width - ob_marks_width < clip_box.width) {
+ clip_box.width = ob_inner_width - ob_marks_width;
}
render_texture(ctx, title_texture,
- NULL, &texture_box, NULL, WL_OUTPUT_TRANSFORM_NORMAL, con->alpha);
+ NULL, &texture_box, &clip_box, WL_OUTPUT_TRANSFORM_NORMAL, con->alpha);
// Padding above
memcpy(&color, colors->background, sizeof(float) * 4);
premultiply_alpha(color, con->alpha);
- box.x = texture_box.x + round(output_x * output_scale);
+ box.x = clip_box.x + round(output_x * output_scale);
box.y = roundf((y + titlebar_border_thickness) * output_scale);
- box.width = texture_box.width;
+ box.width = clip_box.width;
box.height = ob_padding_above;
render_rect(ctx, &box, color);
// Padding below
- box.y += ob_padding_above + texture_box.height;
+ box.y += ob_padding_above + clip_box.height;
box.height = ob_padding_below;
render_rect(ctx, &box, color);
}