don't expose kitty-style bg transparency to user #2432

This commit is contained in:
nick black 2021-12-09 17:07:38 -05:00
parent 4c17970ba0
commit ba1fbbee90
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC
4 changed files with 6 additions and 15 deletions

View File

@ -55,7 +55,7 @@ typedef struct notcurses_options {
**int notcurses_default_foreground(const struct notcurses* ***nc***, uint32_t* ***fg***);**
**int notcurses_default_background(const struct notcurses* ***nc***, uint32_t* ***bg***, unsigned* ***bgtrans***);**
**int notcurses_default_background(const struct notcurses* ***nc***, uint32_t* ***bg***);**
# DESCRIPTION
@ -172,8 +172,7 @@ zero. The following flags are defined:
**notcurses_default_foreground** returns the default foreground color, if it
could be detected. **notcurses_default_background** returns the default
background color, and whether the terminal treats it as transparent, if this
could be detected.
background color, if it could be detected.
## Fatal signals

View File

@ -3639,8 +3639,7 @@ API int notcurses_default_foreground(const struct notcurses* nc, uint32_t* fg)
// (unknown background). On success, returns 0, writing the RGB value to
// 'bg' (if non-NULL) and setting 'bgtrans' high iff the background color
// is treated as transparent.
API int notcurses_default_background(const struct notcurses* nc,
uint32_t* bg, unsigned* bgtrans)
API int notcurses_default_background(const struct notcurses* nc, uint32_t* bg)
__attribute__ ((nonnull (1)));
// Enable or disable the terminal's cursor, if supported, placing it at

View File

@ -376,17 +376,12 @@ tinfo_debug_bitmaps(struct ncplane* n, const tinfo* ti, const char* indent){
}else{
ncplane_printf(n, "%sdefault fg 0x%06x ", indent, fg);
}
unsigned bgtrans = 0;
uint32_t bg = 0;
r = notcurses_default_background(ncplane_notcurses(n), &bg, &bgtrans);
r = notcurses_default_background(ncplane_notcurses(n), &bg);
if(r){
ncplane_printf(n, "no known default fg");
}else{
if(bgtrans){
ncplane_printf(n, "default bg 0x%06x (trans)", bg);
}else{
ncplane_printf(n, "default bg 0x%06x", bg);
}
ncplane_printf(n, "default bg 0x%06x", bg);
}
finish_line(n);
ncpixelimpl_e blit = notcurses_check_pixel_support(ncplane_notcurses(n));

View File

@ -1736,14 +1736,12 @@ int notcurses_default_foreground(const struct notcurses* nc, uint32_t* fg){
return 0;
}
int notcurses_default_background(const struct notcurses* nc,
uint32_t* bg, unsigned* bgtrans){
int notcurses_default_background(const struct notcurses* nc, uint32_t* bg){
const tinfo* ti = &nc->tcache;
if(ti->bg_collides_default & 0x80000000){
logerror("default background could not be determined\n");
return -1;
}
*bgtrans = !!(ti->bg_collides_default & 0x01000000);
*bg = ti->bg_collides_default & NC_BG_RGB_MASK;
return 0;
}