bug-ncurses
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How should applications use direct-color mode?


From: Tim Allen
Subject: Re: How should applications use direct-color mode?
Date: Sun, 15 Apr 2018 22:29:48 +1000
User-agent: Mutt/1.9.4 (2018-02-28)

On Sun, Apr 15, 2018 at 06:59:37AM -0400, Thomas Dickey wrote:
> On Sun, Apr 15, 2018 at 03:05:06PM +1000, Tim Allen wrote:
> > "color values are expected to be in the range 0 to COLORS-1, inclusive
> > (including 0 and COLORS-1)", and at least with the ncurses 6.1+20180210-1
> > library from Debian Experimental "TERM=xterm-direct tput colors" prints
> > 32767, or 0x7FFF. This implies that direct-color mode can only display
> 
> That's because it's an application using the 16-bit values.
> A 32-bit terminfo application would probably give a different result.

Hmm... ldd says the version of tput I'm using is linked against
libtinfo.so.6, so I assumed it was using the latest ABI with all the
associated expansions and features. Although, since Debian ships both
an ABI v5 library and an ABI v6 library, and I guess they need to share
the same terminal database, perhaps Debian's still building terminfo in
16-bit mode?

I guess this is strictly-speaking irrelevant, since any program that wants
to use direct-colour with ncurses should work even with a 16-bit terminfo.
 
> > Thus I assume that an application that wants to support direct-color
> > with ncurses 6.1 should do something like this:
> 
> ...something like that (the developers will have to deal with the issues,
> given the existing demos).

I notice ncurses already provides {alloc,find,free}_pair() functions which
provide reuse-or-allocate logic for pairs, similar to the behaviour I
described for colors. Do you have plans to add {alloc,find,free}_color()
functions in future, to make it easier for applications to support both
palette-colour and direct-colour modes?

> By the way, this program is referencing ncurses internals:

Thanks. I tried removing those lines and the program still seems to work,
so I've submitted a patch to the author.

Thanks for your time.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]