From 6b461c89cf887df8900d445d760a16c520426095 Mon Sep 17 00:00:00 2001 From: nick black Date: Sat, 8 Jan 2022 01:13:11 -0500 Subject: [PATCH] report pixel mice capabilities in notcurses-info #2326 --- doc/man/man1/notcurses-info.1.md | 3 ++- src/info/main.c | 1 + src/lib/in.c | 2 ++ src/lib/in.h | 1 + src/lib/termdesc.c | 1 + src/lib/termdesc.h | 1 + 6 files changed, 8 insertions(+), 1 deletion(-) diff --git a/doc/man/man1/notcurses-info.1.md b/doc/man/man1/notcurses-info.1.md index f0d6185a7..afddd21c9 100644 --- a/doc/man/man1/notcurses-info.1.md +++ b/doc/man/man1/notcurses-info.1.md @@ -79,7 +79,8 @@ The next five lines describe properties of the terminal environment: * The fourth line indicates the default background color, and whether that color is treated as transparent by the terminal (only **kitty** is known - to do this), and the default foreground color. + to do this), and the default foreground color. **pmouse** indicates + whether pixel-precise mouse events are supported. * The fifth line describes the available bitmap graphics. If Sixels are available, the maximum number of color registers and maximum Sixel diff --git a/src/info/main.c b/src/info/main.c index a3fce86f3..6b31f86fd 100644 --- a/src/info/main.c +++ b/src/info/main.c @@ -383,6 +383,7 @@ tinfo_debug_bitmaps(struct ncplane* n, const tinfo* ti, const char* indent){ }else{ ncplane_printf(n, "default bg 0x%06x", bg); } + tinfo_debug_cap(n, " pmouse", ti->pixelmice); finish_line(n); ncpixelimpl_e blit = notcurses_check_pixel_support(ncplane_notcurses(n)); switch(blit){ diff --git a/src/lib/in.c b/src/lib/in.c index fcc7e5eec..783f6e7e0 100644 --- a/src/lib/in.c +++ b/src/lib/in.c @@ -1148,6 +1148,8 @@ da1_attrs_cb(inputctx* ictx){ } }else if(curattr == 28){ ictx->initdata->rectangular_edits = true; + }else if(curattr == 29){ + ictx->initdata->pixelmice = true; } if(!foundsixel){ scrub_sixel_responses(ictx->initdata); diff --git a/src/lib/in.h b/src/lib/in.h index fc73c9ecb..c8b42089a 100644 --- a/src/lib/in.h +++ b/src/lib/in.h @@ -81,6 +81,7 @@ struct initial_responses { unsigned kbdlevel; // enabled kitty keyboard functions ncpalette palette; // palette entries int maxpaletteread; // maximum palette index read + bool pixelmice; // have we pixel-based mice events? }; // Blocking call. Waits until the input thread has processed all responses to diff --git a/src/lib/termdesc.c b/src/lib/termdesc.c index 1595d3462..8af8fd490 100644 --- a/src/lib/termdesc.c +++ b/src/lib/termdesc.c @@ -1346,6 +1346,7 @@ int interrogate_terminfo(tinfo* ti, FILE* out, unsigned utf8, ti->sixel_maxy = iresp->sixely; ti->sixel_maxx = iresp->sixelx; } + ti->pixelmice = iresp->pixelmice; if(iresp->rectangular_edits){ if(grow_esc_table(ti, "\x1b[%p1%d;%p2%d;%p3%d;$z", ESCAPE_DECERA, &tablelen, &tableused)){ goto err; diff --git a/src/lib/termdesc.h b/src/lib/termdesc.h index 2ef47d589..eceb3be03 100644 --- a/src/lib/termdesc.h +++ b/src/lib/termdesc.h @@ -192,6 +192,7 @@ typedef struct tinfo { pthread_t gpmthread; // thread handle for GPM watcher int gpmfd; // connection to GPM daemon char mouseproto; // DECSET level (100x, '0', '2', '3') + bool pixelmice; // we support pixel-accuracy for mice #ifdef __linux__ int linux_fb_fd; // linux framebuffer device fd char* linux_fb_dev; // device corresponding to linux_fb_dev