* Added new function dupwin.

* Fixed bug in copywin overwrite code.
This commit is contained in:
blymn 2000-04-20 13:12:14 +00:00
parent 9de652ed48
commit fd2c9043b8
4 changed files with 29 additions and 7 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: copywin.c,v 1.2 2000/04/18 22:15:55 jdc Exp $ */
/* $NetBSD: copywin.c,v 1.3 2000/04/20 13:12:14 blymn Exp $ */
/*-
* Copyright (c) 1998-1999 Brett Lymn
@ -91,7 +91,7 @@ int copywin(const WINDOW *srcwin, WINDOW *dstwin, int sminrow,
&dstwin->lines[y - dstwin->begy]->line[startx - dstwin->begx],
&srcwin->lines[y - srcwin->begy]->line[startx - srcwin->begx],
(size_t) x * __LDATASIZE);
__touchline(dstwin, y, (int) (startx - dstwin->begx),
__touchline(dstwin, y - dstwin->begy, (int) (startx - dstwin->begx),
(int) (endx - dstwin->begx), 0);
}
return (OK);

View File

@ -1,4 +1,4 @@
.\" $NetBSD: curses.3,v 1.18 2000/04/18 12:23:01 blymn Exp $
.\" $NetBSD: curses.3,v 1.19 2000/04/20 13:12:14 blymn Exp $
.\"
.\" Copyright (c) 1985, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@ -119,7 +119,10 @@ If overlay is true then copy is nondestructive.
.It delwin(win) delete
.Em win
.It derwin(win,lines,cols,begin_y,begin_x)\ create a subwindow
relative to win.
relative to
.Em win.
.It dupwin(win) duplicate
.Em win
.It echo() set echo mode
.It endwin() end window modes
.It erase() erase

View File

@ -1,4 +1,4 @@
/* $NetBSD: curses.h,v 1.38 2000/04/18 12:23:01 blymn Exp $ */
/* $NetBSD: curses.h,v 1.39 2000/04/20 13:12:14 blymn Exp $ */
/*
* Copyright (c) 1981, 1993, 1994
@ -496,6 +496,7 @@ int def_prog_mode(void);
int def_shell_mode(void);
int delwin(WINDOW *win);
WINDOW *derwin(WINDOW *orig, int nlines, int ncols, int by, int bx);
WINDOW *dupwin(WINDOW *win);
int echo(void);
int endwin(void);
int flash(void);

View File

@ -1,4 +1,4 @@
/* $NetBSD: newwin.c,v 1.21 2000/04/18 22:45:24 jdc Exp $ */
/* $NetBSD: newwin.c,v 1.22 2000/04/20 13:12:14 blymn 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.21 2000/04/18 22:45:24 jdc Exp $");
__RCSID("$NetBSD: newwin.c,v 1.22 2000/04/20 13:12:14 blymn Exp $");
#endif
#endif /* not lint */
@ -67,6 +67,24 @@ derwin(WINDOW *orig, int nlines, int ncols, int by, int bx)
return subwin(orig, nlines, ncols, orig->begy + by, orig->begx + bx);
}
/*
* dupwin --
* Create a copy of the given window.
*/
WINDOW *
dupwin(WINDOW *win)
{
WINDOW *new_one;
if ((new_one =
newwin(win->maxy, win->maxx, win->begy, win->begx)) == NULL)
return NULL;
overwrite(win, new_one);
return new_one;
}
/*
* newwin --
* Allocate space for and set up defaults for a new window.