[BACK]Return to mvwin.c CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / lib / libcurses

Annotation of src/lib/libcurses/mvwin.c, Revision 1.11

1.11    ! blymn       1: /*     $NetBSD: mvwin.c,v 1.10 2000/04/11 13:57:10 blymn Exp $ */
1.7       mikel       2:
1.1       cgd         3: /*
1.6       cgd         4:  * Copyright (c) 1981, 1993, 1994
1.4       cgd         5:  *     The Regents of the University of California.  All rights reserved.
1.1       cgd         6:  *
                      7:  * Redistribution and use in source and binary forms, with or without
                      8:  * modification, are permitted provided that the following conditions
                      9:  * are met:
                     10:  * 1. Redistributions of source code must retain the above copyright
                     11:  *    notice, this list of conditions and the following disclaimer.
                     12:  * 2. Redistributions in binary form must reproduce the above copyright
                     13:  *    notice, this list of conditions and the following disclaimer in the
                     14:  *    documentation and/or other materials provided with the distribution.
                     15:  * 3. All advertising materials mentioning features or use of this software
                     16:  *    must display the following acknowledgement:
                     17:  *     This product includes software developed by the University of
                     18:  *     California, Berkeley and its contributors.
                     19:  * 4. Neither the name of the University nor the names of its contributors
                     20:  *    may be used to endorse or promote products derived from this software
                     21:  *    without specific prior written permission.
                     22:  *
                     23:  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
                     24:  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
                     25:  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
                     26:  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
                     27:  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
                     28:  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
                     29:  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
                     30:  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
                     31:  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
                     32:  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
                     33:  * SUCH DAMAGE.
                     34:  */
                     35:
1.7       mikel      36: #include <sys/cdefs.h>
1.1       cgd        37: #ifndef lint
1.7       mikel      38: #if 0
1.6       cgd        39: static char sccsid[] = "@(#)mvwin.c    8.2 (Berkeley) 5/4/94";
1.7       mikel      40: #else
1.11    ! blymn      41: __RCSID("$NetBSD: mvwin.c,v 1.10 2000/04/11 13:57:10 blymn Exp $");
1.7       mikel      42: #endif
1.9       mrg        43: #endif                         /* not lint */
1.1       cgd        44:
1.6       cgd        45: #include "curses.h"
1.10      blymn      46: #include "curses_private.h"
1.1       cgd        47:
                     48: /*
1.3       mycroft    49:  * mvwin --
                     50:  *     Relocate the starting position of a window.
1.1       cgd        51:  */
1.3       mycroft    52: int
1.11    ! blymn      53: mvwin(WINDOW *win, int by, int bx)
1.3       mycroft    54: {
1.8       perry      55:        WINDOW *orig;
1.9       mrg        56:        int     dy, dx;
1.1       cgd        57:
1.4       cgd        58:        if (by + win->maxy > LINES || bx + win->maxx > COLS)
1.3       mycroft    59:                return (ERR);
1.4       cgd        60:        dy = by - win->begy;
                     61:        dx = bx - win->begx;
                     62:        orig = win->orig;
1.1       cgd        63:        if (orig == NULL) {
                     64:                orig = win;
                     65:                do {
1.4       cgd        66:                        win->begy += dy;
                     67:                        win->begx += dx;
1.3       mycroft    68:                        __swflags(win);
1.4       cgd        69:                        win = win->nextp;
1.1       cgd        70:                } while (win != orig);
1.3       mycroft    71:        } else {
1.4       cgd        72:                if (by < orig->begy || win->maxy + dy > orig->maxy)
1.3       mycroft    73:                        return (ERR);
1.4       cgd        74:                if (bx < orig->begx || win->maxx + dx > orig->maxx)
1.3       mycroft    75:                        return (ERR);
1.4       cgd        76:                win->begy = by;
                     77:                win->begx = bx;
1.3       mycroft    78:                __swflags(win);
                     79:                __set_subwin(orig, win);
1.1       cgd        80:        }
1.4       cgd        81:        __touchwin(win);
1.3       mycroft    82:        return (OK);
1.1       cgd        83: }

CVSweb <webmaster@jp.NetBSD.org>