[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Sat, 06 Dec 2008 17:31:01 -0500
On Fri, Dec 05, 2008 at 11:48:58PM -0800, Mike Gran wrote:
> When calling attr_get(&attrs,&pair,NULL), the color pair value shows up both
> in the returned pair and in the returned attrs value. Is this expected?
...yes. Technically it should not (or need not - there's a distinction).
It need not since it's part of the X/Open extensions over SVR4 curses
which provides for extended color support. That's why there's a
separate parameter for the color pair.
The description here is so vague that it covers lots of possibilities:
However, this (in ncurses) was implemented early (mid-1995), even before
there were any implementations to compare against (1997-1998) and (a
while later...) notice that they provided for more than 8 colors (at
least in the data structures - I've had poor results from _using_ the
vendor unix curses libraries for extended colors).
When I implemented the extended-colors in 2005, I retained the combined
color+attribute in the attribute field, as long as it fits, and provided
for keeping application compability for anything _using_ attr_get and
A really portable X/Open curses application shouldn't really care (much)
since it would only test the video-attribute bits from the attribute
parameter, and would look for the color pair in the pair parameter.
> Running this code snippet....
> int main()
> attr_t attrs;
> short pair;
> initscr ();
> attr_set (WA_UNDERLINE, 1, NULL);
> attr_get (&attrs, &pair, NULL);
> printf ("INPUT: %x %d\n", WA_UNDERLINE, 1);
> printf ("OUTPUT: %x %d\n", attrs, pair);
> return 0;
> .... returns
> INPUT: 20000 1
> OUTPUT: 20100 1
> The "100" in the "20100" value is COLOR_PAIR(1).
> Mike Gran
> Bug-ncurses mailing list
Thomas E. Dickey <address@hidden>
Description: Digital signature
- attr_get, Mike Gran, 2008/12/06
- Re: attr_get,
Thomas Dickey <=