Skip to content

Commit

Permalink
report pixel mice capabilities in notcurses-info #2326
Browse files Browse the repository at this point in the history
  • Loading branch information
dankamongmen committed Jan 8, 2022
1 parent 76afcbd commit 6b461c8
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 1 deletion.
3 changes: 2 additions & 1 deletion doc/man/man1/notcurses-info.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/info/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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){
Expand Down
2 changes: 2 additions & 0 deletions src/lib/in.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions src/lib/in.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/lib/termdesc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions src/lib/termdesc.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 6b461c8

Please sign in to comment.