X-Git-Url: https://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=ncurses%2Fwidechar%2Flib_vid_attr.c;h=9fc802d78b61bbf058cfb2be015fb78cc80a508e;hp=46bde8add3ad512cba08920daff2b8b32ce6f16d;hb=286b1e1135a99a4dd5844e5d45af42098155fab5;hpb=404cc3f5b0751dd219565139f825c5a4d445f651 diff --git a/ncurses/widechar/lib_vid_attr.c b/ncurses/widechar/lib_vid_attr.c index 46bde8ad..9fc802d7 100644 --- a/ncurses/widechar/lib_vid_attr.c +++ b/ncurses/widechar/lib_vid_attr.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 2002-2007,2009 Free Software Foundation, Inc. * + * Copyright (c) 2002-2011,2012 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -31,13 +31,12 @@ ****************************************************************************/ #include -#include #ifndef CUR -#define CUR SP_TERMTYPE +#define CUR SP_TERMTYPE #endif -MODULE_ID("$Id: lib_vid_attr.c,v 1.11 2009/05/10 00:48:29 tom Exp $") +MODULE_ID("$Id: lib_vid_attr.c,v 1.16 2012/06/09 20:29:33 tom Exp $") #define doPut(mode) TPUTS_TRACE(#mode); NCURSES_SP_NAME(tputs)(NCURSES_SP_ARGx mode, 1, outc) @@ -60,7 +59,9 @@ MODULE_ID("$Id: lib_vid_attr.c,v 1.11 2009/05/10 00:48:29 tom Exp $") } \ } -#define set_color(mode, pair) mode &= ALL_BUT_COLOR; mode |= COLOR_PAIR(pair) +#define set_color(mode, pair) \ + mode &= ALL_BUT_COLOR; \ + mode |= (attr_t) ColorPair(pair) NCURSES_EXPORT(int) NCURSES_SP_NAME(vid_puts) (NCURSES_SP_DCLx @@ -119,7 +120,7 @@ NCURSES_SP_NAME(vid_puts) (NCURSES_SP_DCLx * A_ALTCHARSET (256) down 2 to line up. We use the NCURSES_BITS * macro so this will work properly for the wide-character layout. */ - unsigned value = no_color_video; + unsigned value = (unsigned) no_color_video; attr_t mask = NCURSES_BITS((value & 63) | ((value & 192) << 1) | ((value & 256) >> 2), 8); @@ -295,24 +296,26 @@ vid_attr(attr_t newmode, short pair, void *opts) NCURSES_EXPORT(attr_t) NCURSES_SP_NAME(term_attrs) (NCURSES_SP_DCL0) { - attr_t attrs; + attr_t attrs = 0; T((T_CALLED("term_attrs()"))); - attrs = SP_PARM ? NCURSES_SP_NAME(termattrs) (NCURSES_SP_ARG) : 0; - - /* these are only supported for wide-character mode */ - if (enter_horizontal_hl_mode) - attrs |= WA_HORIZONTAL; - if (enter_left_hl_mode) - attrs |= WA_LEFT; - if (enter_low_hl_mode) - attrs |= WA_LOW; - if (enter_right_hl_mode) - attrs |= WA_RIGHT; - if (enter_top_hl_mode) - attrs |= WA_TOP; - if (enter_vertical_hl_mode) - attrs |= WA_VERTICAL; + if (SP_PARM) { + attrs = NCURSES_SP_NAME(termattrs) (NCURSES_SP_ARG); + + /* these are only supported for wide-character mode */ + if (enter_horizontal_hl_mode) + attrs |= WA_HORIZONTAL; + if (enter_left_hl_mode) + attrs |= WA_LEFT; + if (enter_low_hl_mode) + attrs |= WA_LOW; + if (enter_right_hl_mode) + attrs |= WA_RIGHT; + if (enter_top_hl_mode) + attrs |= WA_TOP; + if (enter_vertical_hl_mode) + attrs |= WA_VERTICAL; + } returnAttr(attrs); }