diff --git a/examples/sixdraw.c b/examples/sixdraw.c index 385aac7..484fddd 100644 --- a/examples/sixdraw.c +++ b/examples/sixdraw.c @@ -29,7 +29,6 @@ # include "config.h" #endif // HAVE_CONFIG_H -#include #include #include #include @@ -140,8 +139,8 @@ get_winsize(struct sixdraw_ctx *ctx) ctx->rows = ws.ws_row; ctx->ch_width = ws.ws_xpixel / ws.ws_col; ctx->ch_height = ws.ws_ypixel / ws.ws_row; - ctx->canvas_width = ws.ws_xpixel - ctx->ch_width; - ctx->canvas_height = ws.ws_ypixel - ctx->ch_height * 3; + ctx->canvas_width = ctx->ch_width * ws.ws_col; + ctx->canvas_height = ctx->ch_height * ws.ws_row - ctx->ch_height * 2; return true; } @@ -377,6 +376,7 @@ draw(struct sixdraw_ctx *ctx) while (true) { switch (ctlseqs_read(ctx->reader, ctx->matcher, -1)) { case 2: // CTLSEQS_RESP_SGR_MOUSE + // Pixel coordinates start at 1 instead of 0. print_sixel_dot(ctx, result[1].num - 1, result[2].num - 1); break; case CTLSEQS_NOSEQ: