mirror of
https://github.com/dankamongmen/notcurses
synced 2025-03-10 01:29:05 -04: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){
|
if(ictx->initdata){
|
||||||
unsigned idx = amata_next_numeric(&ictx->amata, "\x1b]4;", ';');
|
unsigned idx = amata_next_numeric(&ictx->amata, "\x1b]4;", ';');
|
||||||
char* str = amata_next_string(&ictx->amata, "rgb:");
|
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);
|
logerror("invalid index %u\n", idx);
|
||||||
}else if(str == NULL){
|
}else if(str == NULL){
|
||||||
logerror("empty palette string\n");
|
logerror("empty palette string\n");
|
||||||
}else{
|
}else{
|
||||||
uint32_t color;
|
if(get_default_color(str, &ictx->initdata->palette.chans[idx]) == 0){
|
||||||
if(get_default_color(str, &color) == 0){
|
loginfo("index %u 0x%06x\n", idx, ictx->initdata->palette.chans[idx]);
|
||||||
loginfo("index %u 0x%06x\n", idx, color);
|
|
||||||
}
|
}
|
||||||
free(str);
|
free(str);
|
||||||
}
|
}
|
||||||
|
@ -77,6 +77,7 @@ struct initial_responses {
|
|||||||
int sixelx; // maximum sixel width
|
int sixelx; // maximum sixel width
|
||||||
char* version; // version string, heap-allocated
|
char* version; // version string, heap-allocated
|
||||||
unsigned kbdlevel; // enabled kitty keyboard functions
|
unsigned kbdlevel; // enabled kitty keyboard functions
|
||||||
|
ncpalette palette; // palette entries
|
||||||
};
|
};
|
||||||
|
|
||||||
// Blocking call. Waits until the input thread has processed all responses to
|
// 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->dimy = iresp->dimy;
|
||||||
ti->dimx = iresp->dimx;
|
ti->dimx = iresp->dimx;
|
||||||
}
|
}
|
||||||
|
memcpy(&ti->originalpalette, &iresp->palette, sizeof(ti->originalpalette));
|
||||||
if(iresp->rgb){
|
if(iresp->rgb){
|
||||||
ti->caps.rgb = true;
|
ti->caps.rgb = true;
|
||||||
}
|
}
|
||||||
|
@ -184,6 +184,7 @@ typedef struct tinfo {
|
|||||||
int default_rows; // LINES environment var / lines terminfo / 24
|
int default_rows; // LINES environment var / lines terminfo / 24
|
||||||
int default_cols; // COLUMNS environment var / cols terminfo / 80
|
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
|
pthread_t gpmthread; // thread handle for GPM watcher
|
||||||
int gpmfd; // connection to GPM daemon
|
int gpmfd; // connection to GPM daemon
|
||||||
char mouseproto; // DECSET level (100x, '0', '2', '3')
|
char mouseproto; // DECSET level (100x, '0', '2', '3')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user