diff options
author | Quantum <quantum2048@gmail.com> | 2021-02-22 00:30:36 -0500 |
---|---|---|
committer | Tudor Brindus <me@tbrindus.ca> | 2021-02-22 02:08:37 -0500 |
commit | e0a94bee8da3271f942c0881ee18a7e2d4138063 (patch) | |
tree | 531b3b9db103d2cb147fb89126fb2b4153d8e845 /sway/desktop/render.c | |
parent | f58f054c87843eb27acc94cc19914d369738a671 (diff) |
render: scale titlebars correctly when straddling outputs
When a container straddles multiple outputs, the title bar is only rendered
at the scale of the "effective" output. If the title bar straddles onto
another output with a different scale factor, it was drawn at the wrong size.
In this commit, we take into consideration the scale the title was rendered
at and scale it accordingly so that it appears at the right size on the other
outputs.
This fixes #6054.
Diffstat (limited to 'sway/desktop/render.c')
-rw-r--r-- | sway/desktop/render.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/sway/desktop/render.c b/sway/desktop/render.c index 0def0bac..ce90eae0 100644 --- a/sway/desktop/render.c +++ b/sway/desktop/render.c @@ -518,6 +518,10 @@ static void render_titlebar(struct sway_output *output, struct wlr_box texture_box; wlr_texture_get_size(title_texture, &texture_box.width, &texture_box.height); + + float title_scale = container_get_effective_output(con)->wlr_output->scale; + texture_box.width = texture_box.width * output_scale / title_scale; + texture_box.height = texture_box.height * output_scale / title_scale; ob_title_width = texture_box.width; // The title texture might be shorter than the config->font_height, |