bug-ncurses
[Top][All Lists]
Advanced

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

Properly setting a cchart_t to WACS value


From: Bryan Christ
Subject: Properly setting a cchart_t to WACS value
Date: Wed, 19 Dec 2018 21:07:57 -0600

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?

--
Bryan
<><

reply via email to

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