csi: CSI Ps ; Ps ; Ps t: report logical pixels

This commit is contained in:
Daniel Eklöf 2020-04-18 23:20:09 +02:00
parent 4f145bed33
commit e93757198a
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F

13
csi.c
View file

@ -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;
}