mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-05 04:06:08 -05:00
scaling: always round the scaling factor when converting to int
* In all calls to wl_subsurface_set_position() * (wp_viewport_set_destination() already does this) * Whenever we use the scale to calculate margins (search box, scrollback indicator etc) * Since the scaling factor is stored as a float (and not a double), use roundf() instead of round()
This commit is contained in:
parent
391bc119de
commit
613c61abb4
5 changed files with 104 additions and 80 deletions
12
csi.c
12
csi.c
|
|
@ -1208,8 +1208,8 @@ csi_dispatch(struct terminal *term, uint8_t final)
|
|||
char reply[64];
|
||||
size_t n = xsnprintf(
|
||||
reply, sizeof(reply), "\033[4;%d;%dt",
|
||||
(int)round(height / term->scale),
|
||||
(int)(width / term->scale));
|
||||
(int)roundf(height / term->scale),
|
||||
(int)roundf((width / term->scale)));
|
||||
term_to_slave(term, reply, n);
|
||||
}
|
||||
break;
|
||||
|
|
@ -1233,8 +1233,8 @@ csi_dispatch(struct terminal *term, uint8_t final)
|
|||
char reply[64];
|
||||
size_t n = xsnprintf(
|
||||
reply, sizeof(reply), "\033[6;%d;%dt",
|
||||
(int)round(term->cell_height / term->scale),
|
||||
(int)round(term->cell_width / term->scale));
|
||||
(int)roundf(term->cell_height / term->scale),
|
||||
(int)roundf(term->cell_width / term->scale));
|
||||
term_to_slave(term, reply, n);
|
||||
break;
|
||||
}
|
||||
|
|
@ -1252,8 +1252,8 @@ csi_dispatch(struct terminal *term, uint8_t final)
|
|||
char reply[64];
|
||||
size_t n = xsnprintf(
|
||||
reply, sizeof(reply), "\033[9;%d;%dt",
|
||||
(int)round(it->item->dim.px_real.height / term->cell_height / term->scale),
|
||||
(int)round(it->item->dim.px_real.width / term->cell_width / term->scale));
|
||||
(int)roundf(it->item->dim.px_real.height / term->cell_height / term->scale),
|
||||
(int)roundf(it->item->dim.px_real.width / term->cell_width / term->scale));
|
||||
term_to_slave(term, reply, n);
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue