X-Git-Url: https://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=ncurses%2Fbase%2Flib_mvwin.c;h=58bdb199f274245483f06700593b911007f7dde2;hp=e4dad4a746f08ec811e5f6fd333676639af552f5;hb=HEAD;hpb=027ae42953e3186daed8f3882da73de48291b606;ds=sidebyside diff --git a/ncurses/base/lib_mvwin.c b/ncurses/base/lib_mvwin.c index e4dad4a7..fca014ef 100644 --- a/ncurses/base/lib_mvwin.c +++ b/ncurses/base/lib_mvwin.c @@ -1,5 +1,6 @@ /**************************************************************************** - * Copyright (c) 1998-2001,2006 Free Software Foundation, Inc. * + * Copyright 2020,2021 Thomas E. Dickey * + * Copyright 1998-2009,2010 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -29,6 +30,8 @@ /**************************************************************************** * Author: Zeyd M. Ben-Halim 1992,1995 * * and: Eric S. Raymond * + * and: Thomas E. Dickey 1996-on * + * and: Juergen Pfeifer * ****************************************************************************/ /* @@ -40,14 +43,18 @@ #include -MODULE_ID("$Id: lib_mvwin.c,v 1.14 2006/02/25 22:53:46 tom Exp $") +MODULE_ID("$Id: lib_mvwin.c,v 1.20 2021/10/23 18:57:41 tom Exp $") NCURSES_EXPORT(int) mvwin(WINDOW *win, int by, int bx) { - T((T_CALLED("mvwin(%p,%d,%d)"), win, by, bx)); +#if NCURSES_SP_FUNCS + SCREEN *sp = _nc_screen_of(win); +#endif + + T((T_CALLED("mvwin(%p,%d,%d)"), (void *) win, by, bx)); - if (!win || (win->_flags & _ISPAD)) + if (!win || IS_PAD(win)) returnCode(ERR); /* @@ -56,7 +63,7 @@ mvwin(WINDOW *win, int by, int bx) */ #if 0 /* Copying subwindows is allowed, but it is expensive... */ - if (win->_flags & _SUBWIN) { + if (IS_SUBWIN(win)) { int err = ERR; WINDOW *parent = win->_parent; if (parent) { /* Now comes the complicated and costly part, you should really @@ -96,8 +103,8 @@ mvwin(WINDOW *win, int by, int bx) } #endif - if (by + win->_maxy > screen_lines - 1 - || bx + win->_maxx > screen_columns - 1 + if (by + win->_maxy > screen_lines(SP_PARM) - 1 + || bx + win->_maxx > screen_columns(SP_PARM) - 1 || by < 0 || bx < 0) returnCode(ERR); @@ -108,7 +115,7 @@ mvwin(WINDOW *win, int by, int bx) * new location. This ensures that if the caller has refreshed another * window at the same location, that this one will be displayed. */ - win->_begy = by; - win->_begx = bx; + win->_begy = (NCURSES_SIZE_T) by; + win->_begx = (NCURSES_SIZE_T) bx; returnCode(touchwin(win)); }