[termdesc] use RGB from XTGETTCAP to set capability

This commit is contained in:
nick black 2021-11-05 08:48:12 -04:00
parent 0f5aec510a
commit f4f1d74dd1
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC
4 changed files with 7 additions and 1 deletions

View File

@ -1246,6 +1246,8 @@ tcap_cb(inputctx* ictx){
}
}
}else if(strncasecmp(s, "524742=", 7) == 0){
loginfo("got rgb (%s)\n", s);
ictx->initdata->rgb = true;
}else{
logdebug("unknown capability=val %s\n", str);
}

View File

@ -62,6 +62,7 @@ struct initial_responses {
unsigned kitty_graphics; // kitty graphics supported
uint32_t bg; // default background
bool got_bg; // have we read default background?
bool rgb; // was RGB DirectColor advertised?
int pixx; // screen geometry in pixels
int pixy; // screen geometry in pixels
int dimx; // screen geometry in cells

View File

@ -95,8 +95,8 @@ notcurses_stop_minimal(void* vnc){
ret = -1;
}
fbuf_reset(f);
ret |= mouse_setup(&nc->tcache, NCMICE_NO_EVENTS);
if(nc->tcache.ttyfd >= 0){
ret |= notcurses_mice_disable(nc);
if(nc->tcache.tpreserved){
ret |= tcsetattr(nc->tcache.ttyfd, TCSAFLUSH, nc->tcache.tpreserved);
}

View File

@ -1044,6 +1044,9 @@ int interrogate_terminfo(tinfo* ti, FILE* out, unsigned utf8,
ti->dimy = iresp->dimy;
ti->dimx = iresp->dimx;
}
if(iresp->rgb){
ti->caps.rgb = true;
}
if(iresp->pixy && iresp->pixx){
ti->pixy = iresp->pixy;
ti->pixx = iresp->pixx;