Source-Changes-HG archive

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

[src/trunk]: src/lib/libcurses Use the terminal of the SCREEN of the WINDOW r...



details:   https://anonhg.NetBSD.org/src/rev/b82fffbf3b72
branches:  trunk
changeset: 820524:b82fffbf3b72
user:      roy <roy%NetBSD.org@localhost>
date:      Tue Jan 10 21:56:50 2017 +0000

description:
Use the terminal of the SCREEN of the WINDOW rather than cur_term
for window attribute functions.

diffstat:

 lib/libcurses/attributes.c |  46 +++++++++++++++++++++++++++-------------------
 1 files changed, 27 insertions(+), 19 deletions(-)

diffs (107 lines):

diff -r f59fddea9cce -r b82fffbf3b72 lib/libcurses/attributes.c
--- a/lib/libcurses/attributes.c        Tue Jan 10 21:15:54 2017 +0000
+++ b/lib/libcurses/attributes.c        Tue Jan 10 21:56:50 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: attributes.c,v 1.22 2017/01/06 13:53:18 roy Exp $      */
+/*     $NetBSD: attributes.c,v 1.23 2017/01/10 21:56:50 roy Exp $      */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: attributes.c,v 1.22 2017/01/06 13:53:18 roy Exp $");
+__RCSID("$NetBSD: attributes.c,v 1.23 2017/01/10 21:56:50 roy Exp $");
 #endif                         /* not lint */
 
 #include "curses.h"
@@ -159,41 +159,45 @@
 int
 wattr_on(WINDOW *win, attr_t attr, void *opt)
 {
+       const TERMINAL *t = win->screen->term;
+
 #ifdef DEBUG
        __CTRACE(__CTRACE_ATTR, "wattr_on: win %p, attr %08x\n", win, attr);
 #endif
        /* If can enter modes, set the relevent attribute bits. */
-       if (exit_attribute_mode != NULL) {
-               if (attr & __BLINK && enter_blink_mode != NULL)
+       if (t_exit_attribute_mode(t) != NULL) {
+               if (attr & __BLINK && t_enter_blink_mode(t) != NULL)
                        win->wattr |= __BLINK;
-               if (attr & __BOLD && enter_bold_mode != NULL)
+               if (attr & __BOLD && t_enter_bold_mode(t) != NULL)
                        win->wattr |= __BOLD;
-               if (attr & __DIM && enter_dim_mode != NULL)
+               if (attr & __DIM && t_enter_dim_mode(t) != NULL)
                        win->wattr |= __DIM;
-               if (attr & __BLANK && enter_secure_mode != NULL)
+               if (attr & __BLANK && t_enter_secure_mode(t) != NULL)
                        win->wattr |= __BLANK;
-               if (attr & __PROTECT && enter_protected_mode != NULL)
+               if (attr & __PROTECT && t_enter_protected_mode(t) != NULL)
                        win->wattr |= __PROTECT;
-               if (attr & __REVERSE && enter_reverse_mode != NULL)
+               if (attr & __REVERSE && t_enter_reverse_mode(t) != NULL)
                        win->wattr |= __REVERSE;
 #ifdef HAVE_WCHAR
-               if (attr & WA_LOW && enter_low_hl_mode != NULL)
+               if (attr & WA_LOW && t_enter_low_hl_mode(t) != NULL)
                        win->wattr |= WA_LOW;
-               if (attr & WA_TOP && enter_top_hl_mode != NULL)
+               if (attr & WA_TOP && t_enter_top_hl_mode(t) != NULL)
                        win->wattr |= WA_TOP;
-               if (attr & WA_LEFT && enter_left_hl_mode != NULL)
+               if (attr & WA_LEFT && t_enter_left_hl_mode(t) != NULL)
                        win->wattr |= WA_LEFT;
-               if (attr & WA_RIGHT && enter_right_hl_mode != NULL)
+               if (attr & WA_RIGHT && t_enter_right_hl_mode(t) != NULL)
                        win->wattr |= WA_RIGHT;
-               if (attr & WA_HORIZONTAL && enter_horizontal_hl_mode != NULL)
+               if (attr & WA_HORIZONTAL && t_enter_horizontal_hl_mode(t) != NULL)
                        win->wattr |= WA_HORIZONTAL;
-               if (attr & WA_VERTICAL && enter_vertical_hl_mode != NULL)
+               if (attr & WA_VERTICAL && t_enter_vertical_hl_mode(t) != NULL)
                        win->wattr |= WA_VERTICAL;
 #endif /* HAVE_WCHAR */
        }
-       if (attr & __STANDOUT && enter_standout_mode != NULL && exit_standout_mode != NULL)
+       if (attr & __STANDOUT && t_enter_standout_mode(t) != NULL &&
+           t_exit_standout_mode(t) != NULL)
                wstandout(win);
-       if (attr & __UNDERSCORE && enter_underline_mode != NULL && exit_underline_mode != NULL)
+       if (attr & __UNDERSCORE && t_enter_underline_mode(t) != NULL &&
+           t_exit_underline_mode(t) != NULL)
                wunderscore(win);
        if ((attr_t) attr & __COLOR)
                __wcolor_set(win, (attr_t) attr);
@@ -211,11 +215,13 @@
 int
 wattr_off(WINDOW *win, attr_t attr, void *opt)
 {
+       const TERMINAL *t = win->screen->term;
+
 #ifdef DEBUG
        __CTRACE(__CTRACE_ATTR, "wattr_off: win %p, attr %08x\n", win, attr);
 #endif
        /* If can do exit modes, unset the relevent attribute bits. */
-       if (exit_attribute_mode != NULL) {
+       if (t_exit_attribute_mode(t) != NULL) {
                if (attr & __BLINK)
                        win->wattr &= ~__BLINK;
                if (attr & __BOLD)
@@ -441,9 +447,11 @@
 void
 __wcolor_set(WINDOW *win, attr_t attr)
 {
+       const TERMINAL *t = win->screen->term;
+
        /* If another color pair is set, turn that off first. */
        win->wattr &= ~__COLOR;
        /* If can do color video, set the color pair bits. */
-       if (max_colors != 0 && attr & __COLOR)
+       if (t_max_colors(t) != 0 && attr & __COLOR)
                win->wattr |= attr & __COLOR;
 }



Home | Main Index | Thread Index | Old Index