1 1.36 blymn /* $NetBSD: attributes.c,v 1.36 2024/12/23 02:58:03 blymn Exp $ */ 2 1.1 mrg 3 1.3 jdc /*- 4 1.3 jdc * Copyright (c) 1999 The NetBSD Foundation, Inc. 5 1.1 mrg * All rights reserved. 6 1.1 mrg * 7 1.3 jdc * This code is derived from software contributed to The NetBSD Foundation 8 1.3 jdc * by Julian Coleman. 9 1.3 jdc * 10 1.1 mrg * Redistribution and use in source and binary forms, with or without 11 1.1 mrg * modification, are permitted provided that the following conditions 12 1.1 mrg * are met: 13 1.1 mrg * 1. Redistributions of source code must retain the above copyright 14 1.1 mrg * notice, this list of conditions and the following disclaimer. 15 1.3 jdc * 2. Redistributions in binary form must reproduce the above copyright 16 1.3 jdc * notice, this list of conditions and the following disclaimer in the 17 1.3 jdc * documentation and/or other materials provided with the distribution. 18 1.1 mrg * 19 1.3 jdc * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 20 1.3 jdc * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 21 1.3 jdc * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 22 1.3 jdc * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 23 1.3 jdc * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 1.3 jdc * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 1.3 jdc * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 1.3 jdc * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 1.3 jdc * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 1.3 jdc * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 1.3 jdc * POSSIBILITY OF SUCH DAMAGE. 30 1.1 mrg */ 31 1.6 blymn 32 1.6 blymn #include <sys/cdefs.h> 33 1.6 blymn #ifndef lint 34 1.36 blymn __RCSID("$NetBSD: attributes.c,v 1.36 2024/12/23 02:58:03 blymn Exp $"); 35 1.6 blymn #endif /* not lint */ 36 1.1 mrg 37 1.1 mrg #include "curses.h" 38 1.2 blymn #include "curses_private.h" 39 1.1 mrg 40 1.27 uwe static int __wattr_off(WINDOW *, attr_t); 41 1.27 uwe static int __wattr_on(WINDOW *, attr_t); 42 1.25 uwe static void __wcolor_set(WINDOW *, attr_t); 43 1.12 jdc 44 1.27 uwe 45 1.4 blymn #ifndef _CURSES_USE_MACROS 46 1.31 uwe #ifdef HAVE_WCHAR 47 1.4 blymn /* 48 1.12 jdc * attr_get -- 49 1.16 jdc * Get wide attributes and color pair from stdscr 50 1.12 jdc */ 51 1.12 jdc /* ARGSUSED */ 52 1.12 jdc int 53 1.28 uwe attr_get(attr_t *attr, short *pair, void *opts) 54 1.12 jdc { 55 1.28 uwe return wattr_get(stdscr, attr, pair, opts); 56 1.12 jdc } 57 1.12 jdc 58 1.12 jdc /* 59 1.12 jdc * attr_on -- 60 1.16 jdc * Test and set wide attributes on stdscr 61 1.12 jdc */ 62 1.12 jdc /* ARGSUSED */ 63 1.12 jdc int 64 1.28 uwe attr_on(attr_t attr, void *opts) 65 1.12 jdc { 66 1.28 uwe return wattr_on(stdscr, attr, opts); 67 1.12 jdc } 68 1.12 jdc 69 1.12 jdc /* 70 1.12 jdc * attr_off -- 71 1.16 jdc * Test and unset wide attributes on stdscr 72 1.12 jdc */ 73 1.12 jdc /* ARGSUSED */ 74 1.12 jdc int 75 1.28 uwe attr_off(attr_t attr, void *opts) 76 1.12 jdc { 77 1.28 uwe return wattr_off(stdscr, attr, opts); 78 1.12 jdc } 79 1.12 jdc 80 1.12 jdc /* 81 1.12 jdc * attr_set -- 82 1.16 jdc * Set wide attributes and color pair on stdscr 83 1.12 jdc */ 84 1.12 jdc /* ARGSUSED */ 85 1.12 jdc int 86 1.28 uwe attr_set(attr_t attr, short pair, void *opts) 87 1.12 jdc { 88 1.28 uwe return wattr_set(stdscr, attr, pair, opts); 89 1.12 jdc } 90 1.12 jdc 91 1.12 jdc /* 92 1.12 jdc * color_set -- 93 1.12 jdc * Set color pair on stdscr 94 1.12 jdc */ 95 1.12 jdc /* ARGSUSED */ 96 1.12 jdc int 97 1.28 uwe color_set(short pair, void *opts) 98 1.12 jdc { 99 1.28 uwe return wcolor_set(stdscr, pair, opts); 100 1.12 jdc } 101 1.31 uwe #endif /* HAVE_WCHAR */ 102 1.12 jdc 103 1.12 jdc /* 104 1.8 jdc * attron -- 105 1.4 blymn * Test and set attributes on stdscr 106 1.4 blymn */ 107 1.4 blymn int 108 1.4 blymn attron(int attr) 109 1.4 blymn { 110 1.30 uwe return wattron(stdscr, attr); 111 1.4 blymn } 112 1.4 blymn 113 1.4 blymn /* 114 1.8 jdc * attroff -- 115 1.4 blymn * Test and unset attributes on stdscr. 116 1.4 blymn */ 117 1.4 blymn int 118 1.4 blymn attroff(int attr) 119 1.4 blymn { 120 1.30 uwe return wattroff(stdscr, attr); 121 1.4 blymn } 122 1.4 blymn 123 1.4 blymn /* 124 1.8 jdc * attrset -- 125 1.4 blymn * Set specific attribute modes. 126 1.4 blymn * Unset others. On stdscr. 127 1.4 blymn */ 128 1.4 blymn int 129 1.4 blymn attrset(int attr) 130 1.4 blymn { 131 1.4 blymn return wattrset(stdscr, attr); 132 1.4 blymn } 133 1.12 jdc #endif /* _CURSES_USE_MACROS */ 134 1.4 blymn 135 1.31 uwe 136 1.31 uwe #ifdef HAVE_WCHAR 137 1.12 jdc /* 138 1.12 jdc * wattr_get -- 139 1.16 jdc * Get wide attributes and colour pair from window 140 1.12 jdc * Note that attributes also includes colour. 141 1.12 jdc */ 142 1.12 jdc /* ARGSUSED */ 143 1.12 jdc int 144 1.28 uwe wattr_get(WINDOW *win, attr_t *attr, short *pair, void *opts) 145 1.12 jdc { 146 1.35 blymn if (__predict_false(win == NULL)) 147 1.35 blymn return ERR; 148 1.35 blymn 149 1.14 jdc __CTRACE(__CTRACE_ATTR, "wattr_get: win %p\n", win); 150 1.15 blymn if (attr != NULL) { 151 1.12 jdc *attr = win->wattr; 152 1.15 blymn #ifdef HAVE_WCHAR 153 1.15 blymn *attr &= WA_ATTRIBUTES; 154 1.15 blymn #endif 155 1.15 blymn } 156 1.15 blymn 157 1.12 jdc if (pair != NULL) 158 1.12 jdc *pair = PAIR_NUMBER(win->wattr); 159 1.12 jdc return OK; 160 1.12 jdc } 161 1.4 blymn 162 1.1 mrg /* 163 1.12 jdc * wattr_on -- 164 1.16 jdc * Test and set wide attributes on window 165 1.1 mrg */ 166 1.1 mrg int 167 1.28 uwe wattr_on(WINDOW *win, attr_t attr, void *opts) 168 1.1 mrg { 169 1.28 uwe if (__predict_false(opts != NULL)) 170 1.27 uwe return ERR; 171 1.23 roy 172 1.27 uwe return __wattr_on(win, attr); 173 1.1 mrg } 174 1.1 mrg 175 1.1 mrg /* 176 1.12 jdc * wattr_off -- 177 1.16 jdc * Test and unset wide attributes on window 178 1.1 mrg * 179 1.1 mrg * Note that the 'me' sequence unsets all attributes. We handle 180 1.1 mrg * which attributes should really be set in refresh.c:makech(). 181 1.1 mrg */ 182 1.1 mrg int 183 1.28 uwe wattr_off(WINDOW *win, attr_t attr, void *opts) 184 1.1 mrg { 185 1.28 uwe if (__predict_false(opts != NULL)) 186 1.27 uwe return ERR; 187 1.23 roy 188 1.27 uwe return __wattr_off(win, attr); 189 1.12 jdc } 190 1.12 jdc 191 1.27 uwe 192 1.12 jdc /* 193 1.12 jdc * wattr_set -- 194 1.16 jdc * Set wide attributes and color pair on window 195 1.12 jdc */ 196 1.12 jdc int 197 1.28 uwe wattr_set(WINDOW *win, attr_t attr, short pair, void *opts) 198 1.12 jdc { 199 1.14 jdc __CTRACE(__CTRACE_ATTR, "wattr_set: win %p, attr %08x, pair %d\n", 200 1.14 jdc win, attr, pair); 201 1.36 blymn 202 1.28 uwe if (__predict_false(opts != NULL)) 203 1.27 uwe return ERR; 204 1.27 uwe 205 1.12 jdc /* 206 1.15 blymn * This overwrites any colour setting from the attributes 207 1.12 jdc * and is compatible with ncurses. 208 1.12 jdc */ 209 1.22 roy attr = (attr & ~__COLOR) | COLOR_PAIR(pair); 210 1.27 uwe 211 1.29 uwe __wattr_off(win, WA_ATTRIBUTES); 212 1.27 uwe __wattr_on(win, attr); 213 1.12 jdc return OK; 214 1.12 jdc } 215 1.12 jdc 216 1.12 jdc /* 217 1.25 uwe * wcolor_set -- 218 1.25 uwe * Set color pair on window 219 1.25 uwe */ 220 1.25 uwe /* ARGSUSED */ 221 1.25 uwe int 222 1.28 uwe wcolor_set(WINDOW *win, short pair, void *opts) 223 1.25 uwe { 224 1.25 uwe __CTRACE(__CTRACE_COLOR, "wolor_set: win %p, pair %d\n", win, pair); 225 1.36 blymn 226 1.36 blymn if (__predict_false(opts != NULL)) 227 1.36 blymn return ERR; 228 1.36 blymn 229 1.25 uwe __wcolor_set(win, (attr_t) COLOR_PAIR(pair)); 230 1.25 uwe return OK; 231 1.25 uwe } 232 1.31 uwe #endif /* HAVE_WCHAR */ 233 1.31 uwe 234 1.25 uwe 235 1.25 uwe /* 236 1.25 uwe * getattrs -- 237 1.25 uwe * Get window attributes. 238 1.25 uwe */ 239 1.25 uwe chtype 240 1.25 uwe getattrs(WINDOW *win) 241 1.25 uwe { 242 1.35 blymn if (__predict_false(win == NULL)) 243 1.35 blymn return ERR; 244 1.35 blymn 245 1.25 uwe __CTRACE(__CTRACE_ATTR, "getattrs: win %p\n", win); 246 1.25 uwe return((chtype) win->wattr); 247 1.25 uwe } 248 1.25 uwe 249 1.25 uwe /* 250 1.12 jdc * wattron -- 251 1.12 jdc * Test and set attributes. 252 1.12 jdc */ 253 1.12 jdc int 254 1.12 jdc wattron(WINDOW *win, int attr) 255 1.12 jdc { 256 1.14 jdc __CTRACE(__CTRACE_ATTR, "wattron: win %p, attr %08x\n", win, attr); 257 1.27 uwe return __wattr_on(win, (attr_t) attr); 258 1.12 jdc } 259 1.12 jdc 260 1.12 jdc /* 261 1.12 jdc * wattroff -- 262 1.12 jdc * Test and unset attributes. 263 1.12 jdc */ 264 1.12 jdc int 265 1.12 jdc wattroff(WINDOW *win, int attr) 266 1.12 jdc { 267 1.14 jdc __CTRACE(__CTRACE_ATTR, "wattroff: win %p, attr %08x\n", win, attr); 268 1.27 uwe return __wattr_off(win, (attr_t) attr); 269 1.1 mrg } 270 1.1 mrg 271 1.1 mrg /* 272 1.8 jdc * wattrset -- 273 1.1 mrg * Set specific attribute modes. 274 1.1 mrg * Unset others. 275 1.1 mrg */ 276 1.1 mrg int 277 1.4 blymn wattrset(WINDOW *win, int attr) 278 1.1 mrg { 279 1.14 jdc __CTRACE(__CTRACE_ATTR, "wattrset: win %p, attr %08x\n", win, attr); 280 1.27 uwe __wattr_off(win, __ATTRIBUTES); 281 1.27 uwe __wattr_on(win, (attr_t) attr); 282 1.12 jdc return OK; 283 1.12 jdc } 284 1.12 jdc 285 1.12 jdc /* 286 1.16 jdc * termattrs -- 287 1.16 jdc * Get terminal attributes 288 1.16 jdc */ 289 1.16 jdc chtype 290 1.16 jdc termattrs(void) 291 1.16 jdc { 292 1.19 yamt chtype ch = 0; 293 1.19 yamt 294 1.16 jdc __CTRACE(__CTRACE_ATTR, "termattrs\n"); 295 1.20 roy if (exit_attribute_mode != NULL) { 296 1.21 blymn __CTRACE(__CTRACE_ATTR, "termattrs: have exit attribute mode\n"); 297 1.20 roy if (enter_blink_mode != NULL) 298 1.16 jdc ch |= __BLINK; 299 1.20 roy if (enter_bold_mode != NULL) 300 1.16 jdc ch |= __BOLD; 301 1.20 roy if (enter_dim_mode != NULL) 302 1.16 jdc ch |= __DIM; 303 1.20 roy if (enter_secure_mode != NULL) 304 1.16 jdc ch |= __BLANK; 305 1.20 roy if (enter_protected_mode != NULL) 306 1.16 jdc ch |= __PROTECT; 307 1.20 roy if (enter_reverse_mode != NULL) 308 1.16 jdc ch |= __REVERSE; 309 1.16 jdc } 310 1.20 roy if (enter_standout_mode != NULL && exit_standout_mode != NULL) 311 1.16 jdc ch |= __STANDOUT; 312 1.20 roy if (enter_underline_mode != NULL && exit_underline_mode != NULL) 313 1.16 jdc ch |= __UNDERSCORE; 314 1.20 roy if (enter_alt_charset_mode != NULL && exit_alt_charset_mode != NULL) 315 1.16 jdc ch |= __ALTCHARSET; 316 1.16 jdc 317 1.16 jdc return ch; 318 1.16 jdc } 319 1.16 jdc 320 1.31 uwe 321 1.31 uwe #ifdef HAVE_WCHAR 322 1.16 jdc /* 323 1.16 jdc * term_attrs -- 324 1.16 jdc * Get terminal wide attributes 325 1.16 jdc */ 326 1.16 jdc attr_t 327 1.16 jdc term_attrs(void) 328 1.16 jdc { 329 1.19 yamt attr_t attr = 0; 330 1.19 yamt 331 1.16 jdc __CTRACE(__CTRACE_ATTR, "term_attrs\n"); 332 1.20 roy if (exit_attribute_mode != NULL) { 333 1.20 roy if (enter_blink_mode != NULL) 334 1.17 jdc attr |= __BLINK; 335 1.20 roy if (enter_bold_mode != NULL) 336 1.17 jdc attr |= __BOLD; 337 1.20 roy if (enter_dim_mode != NULL) 338 1.17 jdc attr |= __DIM; 339 1.20 roy if (enter_secure_mode != NULL) 340 1.17 jdc attr |= __BLANK; 341 1.20 roy if (enter_protected_mode != NULL) 342 1.17 jdc attr |= __PROTECT; 343 1.20 roy if (enter_reverse_mode != NULL) 344 1.17 jdc attr |= __REVERSE; 345 1.16 jdc #ifdef HAVE_WCHAR 346 1.20 roy if (enter_low_hl_mode != NULL) 347 1.16 jdc attr |= WA_LOW; 348 1.20 roy if (enter_top_hl_mode != NULL) 349 1.16 jdc attr |= WA_TOP; 350 1.20 roy if (enter_left_hl_mode != NULL) 351 1.16 jdc attr |= WA_LEFT; 352 1.20 roy if (enter_right_hl_mode != NULL) 353 1.16 jdc attr |= WA_RIGHT; 354 1.20 roy if (enter_horizontal_hl_mode != NULL) 355 1.16 jdc attr |= WA_HORIZONTAL; 356 1.20 roy if (enter_vertical_hl_mode != NULL) 357 1.16 jdc attr |= WA_VERTICAL; 358 1.16 jdc #endif /* HAVE_WCHAR */ 359 1.16 jdc } 360 1.20 roy if (enter_standout_mode != NULL && exit_standout_mode != NULL) 361 1.17 jdc attr |= __STANDOUT; 362 1.20 roy if (enter_underline_mode != NULL && exit_underline_mode != NULL) 363 1.17 jdc attr |= __UNDERSCORE; 364 1.20 roy if (enter_alt_charset_mode != NULL && exit_alt_charset_mode != NULL) 365 1.17 jdc attr |= __ALTCHARSET; 366 1.16 jdc 367 1.16 jdc return attr; 368 1.16 jdc } 369 1.31 uwe #endif /* HAVE_WCHAR */ 370 1.16 jdc 371 1.27 uwe 372 1.27 uwe static int 373 1.27 uwe __wattr_on(WINDOW *win, attr_t attr) 374 1.27 uwe { 375 1.35 blymn const TERMINAL *t; 376 1.35 blymn 377 1.35 blymn if (__predict_false(win == NULL)) 378 1.35 blymn return ERR; 379 1.35 blymn 380 1.35 blymn t = win->screen->term; 381 1.27 uwe 382 1.27 uwe __CTRACE(__CTRACE_ATTR, "wattr_on: win %p, attr %08x\n", win, attr); 383 1.33 andvar /* If can enter modes, set the relevant attribute bits. */ 384 1.27 uwe if (t_exit_attribute_mode(t) != NULL) { 385 1.27 uwe if (attr & __BLINK && t_enter_blink_mode(t) != NULL) 386 1.27 uwe win->wattr |= __BLINK; 387 1.27 uwe if (attr & __BOLD && t_enter_bold_mode(t) != NULL) 388 1.27 uwe win->wattr |= __BOLD; 389 1.27 uwe if (attr & __DIM && t_enter_dim_mode(t) != NULL) 390 1.27 uwe win->wattr |= __DIM; 391 1.27 uwe if (attr & __BLANK && t_enter_secure_mode(t) != NULL) 392 1.27 uwe win->wattr |= __BLANK; 393 1.27 uwe if (attr & __PROTECT && t_enter_protected_mode(t) != NULL) 394 1.27 uwe win->wattr |= __PROTECT; 395 1.27 uwe if (attr & __REVERSE && t_enter_reverse_mode(t) != NULL) 396 1.27 uwe win->wattr |= __REVERSE; 397 1.27 uwe #ifdef HAVE_WCHAR 398 1.27 uwe if (attr & WA_LOW && t_enter_low_hl_mode(t) != NULL) 399 1.27 uwe win->wattr |= WA_LOW; 400 1.27 uwe if (attr & WA_TOP && t_enter_top_hl_mode(t) != NULL) 401 1.27 uwe win->wattr |= WA_TOP; 402 1.27 uwe if (attr & WA_LEFT && t_enter_left_hl_mode(t) != NULL) 403 1.27 uwe win->wattr |= WA_LEFT; 404 1.27 uwe if (attr & WA_RIGHT && t_enter_right_hl_mode(t) != NULL) 405 1.27 uwe win->wattr |= WA_RIGHT; 406 1.27 uwe if (attr & WA_HORIZONTAL && t_enter_horizontal_hl_mode(t) != NULL) 407 1.27 uwe win->wattr |= WA_HORIZONTAL; 408 1.27 uwe if (attr & WA_VERTICAL && t_enter_vertical_hl_mode(t) != NULL) 409 1.27 uwe win->wattr |= WA_VERTICAL; 410 1.27 uwe #endif /* HAVE_WCHAR */ 411 1.27 uwe } 412 1.27 uwe if (attr & __STANDOUT && t_enter_standout_mode(t) != NULL && 413 1.27 uwe t_exit_standout_mode(t) != NULL) 414 1.27 uwe wstandout(win); 415 1.27 uwe if (attr & __UNDERSCORE && t_enter_underline_mode(t) != NULL && 416 1.27 uwe t_exit_underline_mode(t) != NULL) 417 1.27 uwe wunderscore(win); 418 1.27 uwe if (attr & __COLOR) 419 1.27 uwe __wcolor_set(win, attr); 420 1.27 uwe return OK; 421 1.27 uwe } 422 1.27 uwe 423 1.27 uwe 424 1.27 uwe static int 425 1.27 uwe __wattr_off(WINDOW *win, attr_t attr) 426 1.27 uwe { 427 1.35 blymn const TERMINAL *t; 428 1.35 blymn 429 1.35 blymn if (__predict_false(win == NULL)) 430 1.35 blymn return ERR; 431 1.35 blymn 432 1.35 blymn t = win->screen->term; 433 1.27 uwe 434 1.27 uwe __CTRACE(__CTRACE_ATTR, "wattr_off: win %p, attr %08x\n", win, attr); 435 1.33 andvar /* If can do exit modes, unset the relevant attribute bits. */ 436 1.27 uwe if (t_exit_attribute_mode(t) != NULL) { 437 1.27 uwe if (attr & __BLINK) 438 1.27 uwe win->wattr &= ~__BLINK; 439 1.27 uwe if (attr & __BOLD) 440 1.27 uwe win->wattr &= ~__BOLD; 441 1.27 uwe if (attr & __DIM) 442 1.27 uwe win->wattr &= ~__DIM; 443 1.27 uwe if (attr & __BLANK) 444 1.27 uwe win->wattr &= ~__BLANK; 445 1.27 uwe if (attr & __PROTECT) 446 1.27 uwe win->wattr &= ~__PROTECT; 447 1.27 uwe if (attr & __REVERSE) 448 1.27 uwe win->wattr &= ~__REVERSE; 449 1.27 uwe #ifdef HAVE_WCHAR 450 1.27 uwe if (attr & WA_LOW) 451 1.27 uwe win->wattr &= ~WA_LOW; 452 1.27 uwe if (attr & WA_TOP) 453 1.27 uwe win->wattr &= ~WA_TOP; 454 1.27 uwe if (attr & WA_LEFT) 455 1.27 uwe win->wattr &= ~WA_LEFT; 456 1.27 uwe if (attr & WA_RIGHT) 457 1.27 uwe win->wattr &= ~WA_RIGHT; 458 1.27 uwe if (attr & WA_HORIZONTAL) 459 1.27 uwe win->wattr &= ~WA_HORIZONTAL; 460 1.27 uwe if (attr & WA_VERTICAL) 461 1.27 uwe win->wattr &= ~WA_VERTICAL; 462 1.27 uwe #endif /* HAVE_WCHAR */ 463 1.27 uwe } 464 1.27 uwe if (attr & __STANDOUT) 465 1.27 uwe wstandend(win); 466 1.27 uwe if (attr & __UNDERSCORE) 467 1.27 uwe wunderend(win); 468 1.27 uwe if (attr & __COLOR) { 469 1.27 uwe if (max_colors != 0) 470 1.27 uwe win->wattr &= ~__COLOR; 471 1.27 uwe } 472 1.27 uwe return OK; 473 1.27 uwe } 474 1.27 uwe 475 1.27 uwe 476 1.25 uwe static void 477 1.12 jdc __wcolor_set(WINDOW *win, attr_t attr) 478 1.12 jdc { 479 1.35 blymn const TERMINAL *t; 480 1.35 blymn 481 1.35 blymn if (__predict_false(win == NULL)) 482 1.35 blymn return; 483 1.35 blymn 484 1.35 blymn t = win->screen->term; 485 1.23 roy 486 1.12 jdc /* If another color pair is set, turn that off first. */ 487 1.12 jdc win->wattr &= ~__COLOR; 488 1.12 jdc /* If can do color video, set the color pair bits. */ 489 1.34 blymn if (t_max_colors(t) != 0) 490 1.12 jdc win->wattr |= attr & __COLOR; 491 1.1 mrg } 492