[Top][All Lists]

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

Re: How should applications use direct-color mode?

From: Thomas Dickey
Subject: Re: How should applications use direct-color mode?
Date: Sun, 15 Apr 2018 11:28:21 -0400
User-agent: Mutt/1.5.23 (2014-03-12)

On Sun, Apr 15, 2018 at 10:29:48PM +1000, Tim Allen wrote:
> 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?

Something like that.  I've not been paying close attention to their progress,
but recall some recent (in the past month or so) comment that they'll start
packaging the updates for 6.1 "soon".

For the command-line tools to show the full terminal description, they'll have
to be linked with the wide-character flavor of "tinfo" (the Debian package
maintainers are aware of that, while some other packagers are not).

The most recent update that my Debian/testing machine has is from February 11,
and the changelog refers to some tweaks which the packager did to avoid an
abrupt change.  That is, it's still using the older function for reading
terminfo entries (I can see that by inspecting the symbol versions).

On my Debian/testing, there are 127 executables in /usr/bin using ncurses.

For my own work, I build packages using a different name, so those can
coexist on the same system as the distribution.
> 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.

right - it's all data-driven...
> > > 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?

not at the moment (I seem to recall considering it, but decided it was
not necessary for 6.1).  At the moment I'm working on something unrelated
to direct-colors, which will take a while to complete.  In the meantime,
I'll be responding to regressions and bug-reports (those with patches
get more attention, of course).

> > 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.

Thomas E. Dickey <address@hidden>

Attachment: signature.asc
Description: Digital signature

reply via email to

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