[Top][All Lists]

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

Re: Properly setting a cchart_t to WACS value

From: Thomas Dickey
Subject: Re: Properly setting a cchart_t to WACS value
Date: Thu, 20 Dec 2018 19:13:04 -0500
User-agent: Mutt/1.5.23 (2014-03-12)

On Wed, Dec 19, 2018 at 09:07:57PM -0600, Bryan Christ wrote:
> I'm looking through the API documentation and not seeing an easy way to
> stuff the results of NCURSES_WACS(x) into a cchar_t and then modify the
> internals.  Based on what I've read so far, the implementations of cchar_t
> varies greatly which means it's not wise to write code that access the
> struct members directly.  The recommended way seems to be to use getcchar()
> and setcchar().  That being true, therein lies my question.  As best I can
> tell, to store the results of NCURSES_WACS(x) for use later I would have to:
> cchar_t my_cchar;
> wchar_t *data;
> attr_t attrs;
> short color_pair;
> memcpy(&my_cchar, NCURSES_WACS(x), sizeof(my_cchar));
> getcchar(&my_cchar, data, &attrs, &color_pair, NULL);
> attrs = some_attry;
> color_pair = some_color_pair;
> setcchar(&my_cchar, data, attrs, color_pair, NULL);
> Now, assuming I have all of that right, it seems pretty "heavy" just to
> achieve the desired result for a single cchar_t.  Am I going about this all
> wrong?

If you're working on making the result portable across "any" X/Open Curses,
I suppose it's the way to go.  But for your example, I'd expect that the
color and attributes normally would be applied using the background character
or window attributes.

Thomas E. Dickey <address@hidden>

Attachment: signature.asc
Description: Digital signature

reply via email to

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