mirror of
https://github.com/dankamongmen/notcurses.git
synced 2024-11-08 01:10:23 +00:00
[terminfo] store initial palette in termdesc #2435
This commit is contained in:
parent
35ff603c17
commit
ed7213a8bf
@ -1279,14 +1279,13 @@ palette_cb(inputctx* ictx){
|
||||
if(ictx->initdata){
|
||||
unsigned idx = amata_next_numeric(&ictx->amata, "\x1b]4;", ';');
|
||||
char* str = amata_next_string(&ictx->amata, "rgb:");
|
||||
if(idx > NCPALETTESIZE){
|
||||
if(idx > sizeof(ictx->initdata->palette.chans) / sizeof(*ictx->initdata->palette.chans)){
|
||||
logerror("invalid index %u\n", idx);
|
||||
}else if(str == NULL){
|
||||
logerror("empty palette string\n");
|
||||
}else{
|
||||
uint32_t color;
|
||||
if(get_default_color(str, &color) == 0){
|
||||
loginfo("index %u 0x%06x\n", idx, color);
|
||||
if(get_default_color(str, &ictx->initdata->palette.chans[idx]) == 0){
|
||||
loginfo("index %u 0x%06x\n", idx, ictx->initdata->palette.chans[idx]);
|
||||
}
|
||||
free(str);
|
||||
}
|
||||
|
@ -77,6 +77,7 @@ struct initial_responses {
|
||||
int sixelx; // maximum sixel width
|
||||
char* version; // version string, heap-allocated
|
||||
unsigned kbdlevel; // enabled kitty keyboard functions
|
||||
ncpalette palette; // palette entries
|
||||
};
|
||||
|
||||
// Blocking call. Waits until the input thread has processed all responses to
|
||||
|
@ -1233,6 +1233,7 @@ int interrogate_terminfo(tinfo* ti, FILE* out, unsigned utf8,
|
||||
ti->dimy = iresp->dimy;
|
||||
ti->dimx = iresp->dimx;
|
||||
}
|
||||
memcpy(&ti->originalpalette, &iresp->palette, sizeof(ti->originalpalette));
|
||||
if(iresp->rgb){
|
||||
ti->caps.rgb = true;
|
||||
}
|
||||
|
@ -184,6 +184,7 @@ typedef struct tinfo {
|
||||
int default_rows; // LINES environment var / lines terminfo / 24
|
||||
int default_cols; // COLUMNS environment var / cols terminfo / 80
|
||||
|
||||
ncpalette originalpalette; // palette as read from initial queries
|
||||
pthread_t gpmthread; // thread handle for GPM watcher
|
||||
int gpmfd; // connection to GPM daemon
|
||||
char mouseproto; // DECSET level (100x, '0', '2', '3')
|
||||
|
Loading…
Reference in New Issue
Block a user