From e93757198a6894ac36939b96a16a151c78e86a6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Sat, 18 Apr 2020 23:20:09 +0200 Subject: [PATCH] csi: CSI Ps ; Ps ; Ps t: report logical pixels --- csi.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/csi.c b/csi.c index 8e6dba1c..e6cbeefc 100644 --- a/csi.c +++ b/csi.c @@ -817,7 +817,8 @@ csi_dispatch(struct terminal *term, uint8_t final) if (x >= 0 && y >= 0) { char reply[64]; - snprintf(reply, sizeof(reply), "\033[3;%d;%dt", x, y); + snprintf(reply, sizeof(reply), "\033[3;%d;%dt", + x / term->scale, y / term->scale); term_to_slave(term, reply, strlen(reply)); } break; @@ -847,7 +848,8 @@ csi_dispatch(struct terminal *term, uint8_t final) if (width >= 0 && height >= 0) { char reply[64]; - snprintf(reply, sizeof(reply), "\033[4;%d;%dt", height, width); + snprintf(reply, sizeof(reply), "\033[4;%d;%dt", + height / term->scale, width / term->scale); term_to_slave(term, reply, strlen(reply)); } break; @@ -870,7 +872,8 @@ csi_dispatch(struct terminal *term, uint8_t final) case 16: { /* report cell size in pixels */ char reply[64]; snprintf(reply, sizeof(reply), "\033[6;%d;%dt", - term->cell_height, term->cell_width); + term->cell_height / term->scale, + term->cell_width / term->scale); term_to_slave(term, reply, strlen(reply)); break; } @@ -887,8 +890,8 @@ csi_dispatch(struct terminal *term, uint8_t final) tll_foreach(term->window->on_outputs, it) { char reply[64]; snprintf(reply, sizeof(reply), "\033[9;%d;%dt", - it->item->dim.px_scaled.height / term->cell_height, - it->item->dim.px_scaled.width / term->cell_width); + it->item->dim.px_real.height / term->cell_height / term->scale, + it->item->dim.px_real.width / term->cell_width) / term->scale; term_to_slave(term, reply, strlen(reply)); break; }