mirror of
https://github.com/dankamongmen/notcurses.git
synced 2024-11-20 03:25:47 +00:00
This commit is contained in:
parent
217453780e
commit
694a0c133f
@ -20,7 +20,7 @@ tinfo_debug_caps(const tinfo* ti, FILE* debugfp, int rows, int cols,
|
||||
indent, capyn(ti->sgr), capyn(ti->sgr0));
|
||||
fprintf(debugfp, "%sop: %c fgop: %c bgop: %c\n",
|
||||
indent, capyn(ti->op), capyn(ti->fgop), capyn(ti->bgop));
|
||||
fprintf(debugfp, "%srows: %u cols: %u rpix: %u cpix: %u (%dx%d)\n",
|
||||
fprintf(debugfp, "%srows: %u cols: %u rpx: %u cpx: %u (%dx%d)\n",
|
||||
indent, rows, cols, ti->cellpixy, ti->cellpixx, rows * ti->cellpixy, cols * ti->cellpixx);
|
||||
if(!ti->pixel_query_done){
|
||||
fprintf(debugfp, "%sno bitmap graphics information yet\n", indent);
|
||||
|
@ -372,6 +372,9 @@ query_sixel(tinfo* ti, int fd){
|
||||
}
|
||||
|
||||
// fd must be a real terminal. uses the query lock of |ti| to only act once.
|
||||
// we ought already have performed a TIOCGWINSZ ioctl() to verify that the
|
||||
// terminal reports cell area in pixels, as that's necessary for our use of
|
||||
// sixel (or any other bitmap protocol).
|
||||
int query_term(tinfo* ti, int fd){
|
||||
if(fd < 0){
|
||||
return -1;
|
||||
@ -383,6 +386,11 @@ int query_term(tinfo* ti, int fd){
|
||||
int ret = 0;
|
||||
pthread_mutex_lock(&ti->pixel_query);
|
||||
if(!ti->pixel_query_done){
|
||||
// if the terminal reported 0 pixels for cell dimensions, bypass any
|
||||
// interrogation, and assume no bitmap support.
|
||||
if(!ti->cellpixx || !ti->cellpixy){
|
||||
ti->pixel_query_done = true;
|
||||
}else{
|
||||
if(flags & O_NONBLOCK){
|
||||
fcntl(fd, F_SETFL, flags & ~O_NONBLOCK);
|
||||
}
|
||||
@ -395,6 +403,7 @@ int query_term(tinfo* ti, int fd){
|
||||
fcntl(fd, F_SETFL, flags);
|
||||
}
|
||||
}
|
||||
}
|
||||
pthread_mutex_unlock(&ti->pixel_query);
|
||||
return ret;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user