Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libcurses - Make mvderwin work as per the SUSv2 specific...
details: https://anonhg.NetBSD.org/src/rev/15b7f6f7ac7c
branches: trunk
changeset: 769586:15b7f6f7ac7c
user: blymn <blymn%NetBSD.org@localhost>
date: Thu Sep 15 11:58:05 2011 +0000
description:
- Make mvderwin work as per the SUSv2 specification and other curses
implementations.
diffstat:
lib/libcurses/curses_window.3 | 16 +++++++++++++---
lib/libcurses/mvwin.c | 32 +++++++++++++++++++++++++-------
2 files changed, 38 insertions(+), 10 deletions(-)
diffs (106 lines):
diff -r 91f351d11b9b -r 15b7f6f7ac7c lib/libcurses/curses_window.3
--- a/lib/libcurses/curses_window.3 Thu Sep 15 11:53:12 2011 +0000
+++ b/lib/libcurses/curses_window.3 Thu Sep 15 11:58:05 2011 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: curses_window.3,v 1.13 2009/05/18 09:30:31 wiz Exp $
+.\" $NetBSD: curses_window.3,v 1.14 2011/09/15 11:58:05 blymn Exp $
.\"
.\" Copyright (c) 2002
.\" Brett Lymn (blymn%NetBSD.org@localhost, brett_lymn%yahoo.com.au@localhost)
@@ -155,18 +155,28 @@
If the new position would cause the any part of the window to lie outside
the screen, it is an error and the window is not moved.
.Pp
-A subwindow can be moved relative to the parent window by calling the
+A mapping of a region relative to the parent window may be created by
+calling the
.Fn mvderwin
function, the
.Fa y
and
.Fa x
positions are relative to the origin of the parent window.
+The screen offset of
+.Fa win
+is not updated, the characters beginning at
+.Fa y ,
+.Fa x
+for the area the size of
+.Fa win
+will be displayed at the screen offset of
+.Fa win .
If the given window in
.Fa win
is not a subwindow then an error will be returned.
If the new position would cause the any part of the window to lie outside
-the parent window, it is an error and the window is not moved.
+the parent window, it is an error and the mapping is not updated.
.Pp
The
.Fn newwin
diff -r 91f351d11b9b -r 15b7f6f7ac7c lib/libcurses/mvwin.c
--- a/lib/libcurses/mvwin.c Thu Sep 15 11:53:12 2011 +0000
+++ b/lib/libcurses/mvwin.c Thu Sep 15 11:58:05 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mvwin.c,v 1.15 2003/08/07 16:44:22 agc Exp $ */
+/* $NetBSD: mvwin.c,v 1.16 2011/09/15 11:58:05 blymn Exp $ */
/*
* Copyright (c) 1981, 1993, 1994
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)mvwin.c 8.2 (Berkeley) 5/4/94";
#else
-__RCSID("$NetBSD: mvwin.c,v 1.15 2003/08/07 16:44:22 agc Exp $");
+__RCSID("$NetBSD: mvwin.c,v 1.16 2011/09/15 11:58:05 blymn Exp $");
#endif
#endif /* not lint */
@@ -43,14 +43,16 @@
/*
* mvderwin --
- * Move a derived window.
+ * Move a derived window. This does not change the physical screen
+ * coordinates of the subwin, rather maps the characters in the subwin
+ * sized part of the parent window starting at dy, dx into the subwin.
*
*/
int
mvderwin(WINDOW *win, int dy, int dx)
{
WINDOW *parent;
- int x, y;
+ int ox, oy, i;
if (win == NULL)
return ERR;
@@ -60,9 +62,25 @@
if (parent == NULL)
return ERR;
- x = parent->begx + dx;
- y = parent->begy + dy;
- return mvwin(win, y, x);
+ if (((win->maxx + dx) > parent->maxx) ||
+ ((win->maxy + dy) > parent->maxy))
+ return ERR;
+
+ ox = win->begx;
+ oy = win->begy;
+
+ win->begx = parent->begx + dx;
+ win->begy = parent->begy + dy;
+
+ __set_subwin(parent, win);
+
+ win->begx = ox;
+ win->begy = oy;
+
+ for (i = 0; i < win->maxy; i++)
+ win->alines[i]->flags = __ISDIRTY;
+
+ return OK;
}
/*
Home |
Main Index |
Thread Index |
Old Index