Source-Changes-HG archive

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

[src/trunk]: src/lib/libcurses Because we are changing the libcurses major nu...



details:   https://anonhg.NetBSD.org/src/rev/8047e2e93711
branches:  trunk
changeset: 559714:8047e2e93711
user:      jdc <jdc%NetBSD.org@localhost>
date:      Mon Mar 22 18:57:38 2004 +0000

description:
Because we are changing the libcurses major number, remove can_change_colors()
and change the attribute definitions so that we can support more colour pairs.

diffstat:

 lib/libcurses/color.c          |  23 ++++++-----------------
 lib/libcurses/curses.h         |  32 ++++++++++++++++----------------
 lib/libcurses/curses_private.h |   6 +++++-
 3 files changed, 27 insertions(+), 34 deletions(-)

diffs (164 lines):

diff -r 98583c5b1947 -r 8047e2e93711 lib/libcurses/color.c
--- a/lib/libcurses/color.c     Mon Mar 22 18:57:10 2004 +0000
+++ b/lib/libcurses/color.c     Mon Mar 22 18:57:38 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: color.c,v 1.28 2004/03/16 07:52:43 jdc Exp $   */
+/*     $NetBSD: color.c,v 1.29 2004/03/22 18:57:38 jdc Exp $   */
 
 /*
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: color.c,v 1.28 2004/03/16 07:52:43 jdc Exp $");
+__RCSID("$NetBSD: color.c,v 1.29 2004/03/22 18:57:38 jdc Exp $");
 #endif                         /* not lint */
 
 #include "curses.h"
@@ -89,17 +89,6 @@
 }
 
 /*
- * can_change_colors --
- *     Alias for can_change_color().
- *     To be removed at next major number increment.
- */
-bool
-can_change_colors(void)
-{
-       return can_change_color();
-}
-
-/*
  * start_color --
  *     Initialise colour support.
  */
@@ -124,10 +113,10 @@
                        COLOR_PAIRS = 0;
                        COLORS = 0;
                } else {
-                       COLOR_PAIRS = (__tc_pa > MAX_PAIRS ?
-                           MAX_PAIRS : __tc_pa) - 1;
+                       COLOR_PAIRS = (__tc_pa > MAX_PAIRS - 1 ?
+                           MAX_PAIRS - 1 : __tc_pa);
                         /* Use the last colour pair for curses default. */
-                       __default_color = COLOR_PAIR(COLOR_PAIRS);
+                       __default_color = COLOR_PAIR(MAX_PAIRS - 1);
                }
        }
        if (!COLORS)
@@ -238,7 +227,7 @@
        _cursesi_screen->colour_pairs[0].flags = 0;
 
        /* Initialise user colour pairs to default (white on black) */
-       for (i = 1; i < COLOR_PAIRS; i++) {
+       for (i = 0; i < COLOR_PAIRS; i++) {
                _cursesi_screen->colour_pairs[i].fore = COLOR_WHITE;
                _cursesi_screen->colour_pairs[i].back = COLOR_BLACK;
                _cursesi_screen->colour_pairs[i].flags = 0;
diff -r 98583c5b1947 -r 8047e2e93711 lib/libcurses/curses.h
--- a/lib/libcurses/curses.h    Mon Mar 22 18:57:10 2004 +0000
+++ b/lib/libcurses/curses.h    Mon Mar 22 18:57:38 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: curses.h,v 1.83 2004/03/16 07:46:24 jdc Exp $  */
+/*     $NetBSD: curses.h,v 1.84 2004/03/22 18:57:38 jdc Exp $  */
 
 /*
  * Copyright (c) 1981, 1993, 1994
@@ -179,7 +179,8 @@
 #define    KEY_SUSPEND    0x197    /* Suspend key */
 #define    KEY_UNDO       0x198    /* Undo key */
 #define    KEY_MOUSE      0x199    /* Mouse event has occurred */
-#define    KEY_MAX        0x199    /* maximum extended key value */
+#define    KEY_RESIZE     0x200    /* Resize event has occurred */
+#define    KEY_MAX        0x240    /* maximum extended key value */
 
 #include <unctrl.h>
 
@@ -193,18 +194,18 @@
  */
 #define __CHARTEXT     0x000000ff      /* bits for 8-bit characters */
 #define __NORMAL       0x00000000      /* Added characters are normal. */
-#define __STANDOUT     0x00010000      /* Added characters are standout. */
-#define __UNDERSCORE   0x00020000      /* Added characters are underscored. */
-#define __REVERSE      0x00040000      /* Added characters are reverse
+#define __STANDOUT     0x00000100      /* Added characters are standout. */
+#define __UNDERSCORE   0x00000200      /* Added characters are underscored. */
+#define __REVERSE      0x00000400      /* Added characters are reverse
                                           video. */
-#define __BLINK                0x00080000      /* Added characters are blinking. */
-#define __DIM          0x00100000      /* Added characters are dim. */
-#define __BOLD         0x00200000      /* Added characters are bold. */
-#define __BLANK                0x00400000      /* Added characters are blanked. */
-#define __PROTECT      0x00800000      /* Added characters are protected. */
-#define __ALTCHARSET   0x01000000      /* Added characters are ACS */
-#define __COLOR                0x7e000000      /* Color bits */
-#define __ATTRIBUTES   0x7fff0000      /* All 8-bit attribute bits */
+#define __BLINK                0x00000800      /* Added characters are blinking. */
+#define __DIM          0x00001000      /* Added characters are dim. */
+#define __BOLD         0x00002000      /* Added characters are bold. */
+#define __BLANK                0x00004000      /* Added characters are blanked. */
+#define __PROTECT      0x00008000      /* Added characters are protected. */
+#define __ALTCHARSET   0x00010000      /* Added characters are ACS */
+#define __COLOR                0x03fe0000      /* Color bits */
+#define __ATTRIBUTES   0x03ffff00      /* All 8-bit attribute bits */
 
 typedef struct __ldata __LDATA;
 typedef struct __line  __LINE;
@@ -289,8 +290,8 @@
 #define        COLOR_CYAN      0x06
 #define        COLOR_WHITE     0x07
 
-#define        COLOR_PAIR(n)   ((((u_int32_t)n) << 25) & A_COLOR)
-#define        PAIR_NUMBER(n)  ((((u_int32_t)n) & A_COLOR) >> 25)
+#define        COLOR_PAIR(n)   ((((u_int32_t)n) << 17) & A_COLOR)
+#define        PAIR_NUMBER(n)  ((((u_int32_t)n) & A_COLOR) >> 17)
 
 /* Curses external declarations. */
 extern WINDOW  *curscr;                /* Current screen. */
@@ -510,7 +511,6 @@
 int     beep(void);
 int     box(WINDOW *, chtype, chtype);
 bool    can_change_color(void);
-bool    can_change_colors(void);
 int     cbreak(void);
 int     clearok(WINDOW *, bool);
 int     color_content(short, short *, short *, short *);
diff -r 98583c5b1947 -r 8047e2e93711 lib/libcurses/curses_private.h
--- a/lib/libcurses/curses_private.h    Mon Mar 22 18:57:10 2004 +0000
+++ b/lib/libcurses/curses_private.h    Mon Mar 22 18:57:38 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: curses_private.h,v 1.34 2003/08/10 07:37:11 dsl Exp $  */
+/*     $NetBSD: curses_private.h,v 1.35 2004/03/22 18:57:38 jdc Exp $  */
 
 /*-
  * Copyright (c) 1998-2000 Brett Lymn
@@ -245,6 +245,7 @@
        int endwin;
        int notty;
        int half_delay;
+       int resized;
 };
 
 
@@ -283,9 +284,11 @@
 void     __restore_meta_state(void);
 void    __restore_termios(void);
 void    __restore_stophandler(void);
+void    __restore_winchhandler(void);
 void    __save_termios(void);
 void    __set_color(WINDOW *win, attr_t attr);
 void    __set_stophandler(void);
+void    __set_winchhandler(void);
 void    __set_subwin(WINDOW *, WINDOW *);
 void    __startwin(SCREEN *);
 void    __stop_signal_handler(int);
@@ -299,6 +302,7 @@
 void    __unset_color(WINDOW *win);
 int     __waddch(WINDOW *, __LDATA *);
 int     __wgetnstr(WINDOW *, char *, int);
+void    __winch_signal_handler(int);
 
 /* Private #defines. */
 #define        min(a,b)        ((a) < (b) ? (a) : (b))



Home | Main Index | Thread Index | Old Index