aboutsummaryrefslogtreecommitdiff
path: root/csi.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2023-06-22 12:21:51 +0000
committerDaniel Eklöf <daniel@ekloef.se>2023-06-29 13:38:22 +0000
commitc1f374cc8dab121388669cee6df3e2d1c483d77f (patch)
tree7a2f86920b591df6100e99bdd1b27ada439a106a /csi.c
parentwayland: plumbing for wp-fractional-scale (diff)
term: convert ‘scale’ to a float
Diffstat (limited to 'csi.c')
-rw-r--r--csi.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/csi.c b/csi.c
index ef1a28f2..153a1099 100644
--- a/csi.c
+++ b/csi.c
@@ -1206,8 +1206,10 @@ csi_dispatch(struct terminal *term, uint8_t final)
if (width >= 0 && height >= 0) {
char reply[64];
- size_t n = xsnprintf(reply, sizeof(reply), "\033[4;%d;%dt",
- height / term->scale, width / term->scale);
+ size_t n = xsnprintf(
+ reply, sizeof(reply), "\033[4;%d;%dt",
+ (int)round(height / term->scale),
+ (int)(width / term->scale));
term_to_slave(term, reply, n);
}
break;
@@ -1229,9 +1231,10 @@ csi_dispatch(struct terminal *term, uint8_t final)
case 16: { /* report cell size in pixels */
char reply[64];
- size_t n = xsnprintf(reply, sizeof(reply), "\033[6;%d;%dt",
- term->cell_height / term->scale,
- term->cell_width / term->scale);
+ 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));
term_to_slave(term, reply, n);
break;
}
@@ -1247,9 +1250,10 @@ csi_dispatch(struct terminal *term, uint8_t final)
case 19: { /* report screen size in chars */
tll_foreach(term->window->on_outputs, it) {
char reply[64];
- size_t n = xsnprintf(reply, sizeof(reply), "\033[9;%d;%dt",
- it->item->dim.px_real.height / term->cell_height / term->scale,
- it->item->dim.px_real.width / term->cell_width / term->scale);
+ 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));
term_to_slave(term, reply, n);
break;
}