mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-04 04:06:06 -05:00
wayland: regression: use correct scaling factor when calling render_resize()
When an output property (such as scaling factor) has changed, we need to call render_resize() to ensure the window surface is correct (for example, we may have to change its scale). The width/height parameters are in *logical* pixels (i.e. already scaled). For render_resize() to work correctly when the scale is being changed, it needs to be called with *current* logical size. This means we need to scale our current width/height using the *old* scaling factor.
This commit is contained in:
parent
ebbee61f14
commit
bc8c2e0112
1 changed files with 5 additions and 3 deletions
|
|
@ -392,6 +392,8 @@ static void
|
|||
update_term_for_output_change(struct terminal *term)
|
||||
{
|
||||
const float old_scale = term->scale;
|
||||
const float logical_width = term->width / old_scale;
|
||||
const float logical_height = term->height / old_scale;
|
||||
|
||||
/* Note: order matters! term_update_scale() must come first */
|
||||
bool scale_updated = term_update_scale(term);
|
||||
|
|
@ -400,7 +402,7 @@ update_term_for_output_change(struct terminal *term)
|
|||
|
||||
csd_reload_font(term->window, old_scale);
|
||||
|
||||
uint8_t resize_opts = RESIZE_KEEP_GRID;
|
||||
enum resize_options resize_opts = RESIZE_KEEP_GRID;
|
||||
|
||||
if (fonts_updated) {
|
||||
/*
|
||||
|
|
@ -428,8 +430,8 @@ update_term_for_output_change(struct terminal *term)
|
|||
|
||||
render_resize(
|
||||
term,
|
||||
(int)roundf(term->width / term->scale),
|
||||
(int)roundf(term->height / term->scale),
|
||||
(int)roundf(logical_width),
|
||||
(int)roundf(logical_height),
|
||||
resize_opts);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue