Source-Changes-HG archive

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

[src/trunk]: src/lib/libcurses Add a list of windows (used when a colour pair...



details:   https://anonhg.NetBSD.org/src/rev/02417cdd2963
branches:  trunk
changeset: 484913:02417cdd2963
user:      jdc <jdc%NetBSD.org@localhost>
date:      Fri Apr 14 17:35:14 2000 +0000

description:
Add a list of windows (used when a colour pair changes).

diffstat:

 lib/libcurses/curses_private.h |  20 +++++++++++++-------
 lib/libcurses/initscr.c        |   9 +++++++--
 lib/libcurses/newwin.c         |  33 ++++++++++++++++++++++++++++-----
 3 files changed, 48 insertions(+), 14 deletions(-)

diffs (143 lines):

diff -r 00400e746c3e -r 02417cdd2963 lib/libcurses/curses_private.h
--- a/lib/libcurses/curses_private.h    Fri Apr 14 15:49:07 2000 +0000
+++ b/lib/libcurses/curses_private.h    Fri Apr 14 17:35:14 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: curses_private.h,v 1.2 2000/04/12 21:46:27 jdc Exp $   */
+/*     $NetBSD: curses_private.h,v 1.3 2000/04/14 17:35:14 jdc Exp $   */
 
 /*-
  * Copyright (c) 1998-2000 Brett Lymn
@@ -86,6 +86,11 @@
        attr_t  battr;                  /* Background attributes */
 };
 
+struct __winlist {
+       struct __window         *winp;  /* The window. */
+       struct __winlist        *nextp; /* Next window. */
+};
+
 /* Private functions. */
 #ifdef DEBUG
 void    __CTRACE __P((const char *, ...));
@@ -123,9 +128,10 @@
 #define        max(a,b)        (a > b ? a : b)
 
 /* Private externs. */
-extern int      __echoit;
-extern int      __endwin;
-extern int      __pfast;
-extern int      __rawmode;
-extern int      __noqch;
-extern attr_t   __nca;
+extern int              __echoit;
+extern int              __endwin;
+extern int              __pfast;
+extern int              __rawmode;
+extern int              __noqch;
+extern attr_t           __nca;
+extern struct __winlist        *__winlistp;
diff -r 00400e746c3e -r 02417cdd2963 lib/libcurses/initscr.c
--- a/lib/libcurses/initscr.c   Fri Apr 14 15:49:07 2000 +0000
+++ b/lib/libcurses/initscr.c   Fri Apr 14 17:35:14 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: initscr.c,v 1.13 2000/04/12 21:45:04 jdc Exp $ */
+/*     $NetBSD: initscr.c,v 1.14 2000/04/14 17:35:14 jdc Exp $ */
 
 /*
  * Copyright (c) 1981, 1993, 1994
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "@(#)initscr.c  8.2 (Berkeley) 5/4/94";
 #else
-__RCSID("$NetBSD: initscr.c,v 1.13 2000/04/12 21:45:04 jdc Exp $");
+__RCSID("$NetBSD: initscr.c,v 1.14 2000/04/14 17:35:14 jdc Exp $");
 #endif
 #endif /* not lint */
 
@@ -48,6 +48,9 @@
 #include "curses.h"
 #include "curses_private.h"
 
+/* Window list */
+struct __winlist       *__winlistp;
+
 /*
  * initscr --
  *     Initialize the current and standard screen.
@@ -79,6 +82,8 @@
        /* Need either homing or cursor motion for refreshes */
        if (!HO && !CM)
                return (NULL);
+       
+       __winlistp = NULL;
 
        if (curscr != NULL)
                delwin(curscr);
diff -r 00400e746c3e -r 02417cdd2963 lib/libcurses/newwin.c
--- a/lib/libcurses/newwin.c    Fri Apr 14 15:49:07 2000 +0000
+++ b/lib/libcurses/newwin.c    Fri Apr 14 17:35:14 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: newwin.c,v 1.14 2000/04/12 21:48:46 jdc Exp $  */
+/*     $NetBSD: newwin.c,v 1.15 2000/04/14 17:35:15 jdc Exp $  */
 
 /*
  * Copyright (c) 1981, 1993, 1994
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "@(#)newwin.c   8.3 (Berkeley) 7/27/94";
 #else
-__RCSID("$NetBSD: newwin.c,v 1.14 2000/04/12 21:48:46 jdc Exp $");
+__RCSID("$NetBSD: newwin.c,v 1.15 2000/04/14 17:35:15 jdc Exp $");
 #endif
 #endif                         /* not lint */
 
@@ -49,6 +49,8 @@
 
 #undef nl                      /* Don't need it here, and it interferes. */
 
+extern struct __winlist        *winlistp;
+
 static WINDOW *__makenew __P((int, int, int, int, int));
 
 void __set_subwin __P((WINDOW *, WINDOW *));
@@ -164,9 +166,10 @@
        int     by, bx, nl, nc;
        int     sub;
 {
-       WINDOW *win;
-       __LINE *lp;
-       int     i;
+       WINDOW                  *win;
+       __LINE                  *lp;
+       struct __winlist        *wlp, *wlp2;
+       int                      i;
 
 
 #ifdef DEBUG
@@ -201,6 +204,26 @@
                        return NULL;
                }
                /*
+                * Append window to window list.
+                */
+               if ((wlp = malloc(sizeof(struct __winlist))) == NULL) {
+                       free(win->wspace);
+                       free(win->lines);
+                       free(win->lspace);
+                       free(win);
+                       return NULL;
+               }
+               wlp->winp = win;
+               wlp->nextp = NULL;
+               if (__winlistp == NULL)
+                       __winlistp = wlp;
+               else {
+                       wlp2 = __winlistp;
+                       while (wlp2->nextp != NULL)
+                               wlp2 = wlp2->nextp;
+                       wlp2->nextp = wlp;
+               }
+               /*
                 * Point line pointers to line space, and lines themselves into
                 * window space.
                 */



Home | Main Index | Thread Index | Old Index