X-Git-Url: https://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=ncurses%2Fbase%2Flib_pad.c;h=ccd3ad7efd89eaf2a403fd5191e569360db35fd7;hp=97b2d357acbe5785d895f4c5cf9605a45a67a03f;hb=bbb7fd37298f7d81386a4cf868417b9e084d7d90;hpb=46722468f47c2b77b3987729b4bcf2321cccfd01 diff --git a/ncurses/base/lib_pad.c b/ncurses/base/lib_pad.c index 97b2d357..ccd3ad7e 100644 --- a/ncurses/base/lib_pad.c +++ b/ncurses/base/lib_pad.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2001,2002 Free Software Foundation, Inc. * + * Copyright (c) 1998-2006,2009 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 +29,8 @@ /**************************************************************************** * Author: Zeyd M. Ben-Halim 1992,1995 * * and: Eric S. Raymond * + * and: Thomas E. Dickey 1996-on * + * and: Juergen Pfeifer 2009 * ****************************************************************************/ /* @@ -40,21 +42,22 @@ #include -MODULE_ID("$Id: lib_pad.c,v 1.38 2002/08/03 23:29:26 Philippe.Blain Exp $") +MODULE_ID("$Id: lib_pad.c,v 1.44 2009/07/04 19:45:20 tom Exp $") NCURSES_EXPORT(WINDOW *) -newpad(int l, int c) +NCURSES_SP_NAME(newpad) (NCURSES_SP_DCLx int l, int c) { WINDOW *win; NCURSES_CH_T *ptr; int i; - T((T_CALLED("newpad(%d, %d)"), l, c)); + T((T_CALLED("newpad(%p,%d, %d)"), SP_PARM, l, c)); if (l <= 0 || c <= 0) returnWin(0); - if ((win = _nc_makenew(l, c, 0, 0, _ISPAD)) == NULL) + win = NCURSES_SP_NAME(_nc_makenew) (NCURSES_SP_ARGx l, c, 0, 0, _ISPAD); + if (win == NULL) returnWin(0); for (i = 0; i < l; i++) { @@ -70,9 +73,16 @@ newpad(int l, int c) returnWin(win); } +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(WINDOW *) +newpad(int l, int c) +{ + return NCURSES_SP_NAME(newpad) (CURRENT_SCREEN, l, c); +} +#endif + NCURSES_EXPORT(WINDOW *) -subpad -(WINDOW *orig, int l, int c, int begy, int begx) +subpad(WINDOW *orig, int l, int c, int begy, int begx) { WINDOW *win = (WINDOW *) 0; @@ -87,28 +97,41 @@ subpad } NCURSES_EXPORT(int) -prefresh -(WINDOW *win, int pminrow, int pmincol, - int sminrow, int smincol, int smaxrow, int smaxcol) +prefresh(WINDOW *win, + int pminrow, + int pmincol, + int sminrow, + int smincol, + int smaxrow, + int smaxcol) { +#if NCURSES_SP_FUNCS + SCREEN *sp = _nc_screen_of(win); +#endif + T((T_CALLED("prefresh()"))); if (pnoutrefresh(win, pminrow, pmincol, sminrow, smincol, smaxrow, smaxcol) != ERR - && doupdate() != ERR) { + && NCURSES_SP_NAME(doupdate) (NCURSES_SP_ARG) != ERR) { returnCode(OK); } returnCode(ERR); } NCURSES_EXPORT(int) -pnoutrefresh -(WINDOW *win, int pminrow, int pmincol, - int sminrow, int smincol, int smaxrow, int smaxcol) +pnoutrefresh(WINDOW *win, + int pminrow, + int pmincol, + int sminrow, + int smincol, + int smaxrow, + int smaxcol) { NCURSES_SIZE_T i, j; NCURSES_SIZE_T m, n; NCURSES_SIZE_T pmaxrow; NCURSES_SIZE_T pmaxcol; + SCREEN *sp; #if USE_SCROLL_HINTS const int my_len = 2; /* parameterize the threshold for hardscroll */ @@ -125,6 +148,8 @@ pnoutrefresh if (!(win->_flags & _ISPAD)) returnCode(ERR); + sp = _nc_screen_of(win); + /* negative values are interpreted as zero */ if (pminrow < 0) pminrow = 0; @@ -138,8 +163,10 @@ pnoutrefresh pmaxrow = pminrow + smaxrow - sminrow; pmaxcol = pmincol + smaxcol - smincol; - T((" pminrow + smaxrow - sminrow %d, win->_maxy %d", pmaxrow, win->_maxy)); - T((" pmincol + smaxcol - smincol %d, win->_maxx %d", pmaxcol, win->_maxx)); + T((" pminrow + smaxrow - sminrow %ld, win->_maxy %ld", + (long) pmaxrow, (long) win->_maxy)); + T((" pmincol + smaxcol - smincol %ld, win->_maxx %ld", + (long) pmaxcol, (long) win->_maxx)); /* * Trim the caller's screen size back to the actual limits. @@ -153,8 +180,8 @@ pnoutrefresh pmaxcol = pmincol + smaxcol - smincol; } - if (smaxrow >= screen_lines - || smaxcol >= screen_columns + if (smaxrow >= screen_lines(sp) + || smaxcol >= screen_columns(sp) || sminrow > smaxrow || smincol > smaxcol) returnCode(ERR); @@ -185,13 +212,13 @@ pnoutrefresh * merely change the costs of various update cases. */ #if USE_SCROLL_HINTS - wide = (smincol < my_len && smaxcol > (newscr->_maxx - my_len)); + wide = (smincol < my_len && smaxcol > (NewScreen(sp)->_maxx - my_len)); #endif for (i = pminrow, m = sminrow + win->_yoffset; - i <= pmaxrow && m <= newscr->_maxy; + i <= pmaxrow && m <= NewScreen(sp)->_maxy; i++, m++) { - register struct ldat *nline = &newscr->_line[m]; + register struct ldat *nline = &NewScreen(sp)->_line[m]; register struct ldat *oline = &win->_line[i]; for (j = pmincol, n = smincol; j <= pmaxcol; j++, n++) { NCURSES_CH_T ch = oline->text[j]; @@ -202,7 +229,7 @@ pnoutrefresh */ if (j == pmincol && j > 0 - && isnac(ch)) { + && isWidecExt(ch)) { SetChar(ch, L(' '), AttrOf(oline->text[j - 1])); } #endif @@ -220,9 +247,9 @@ pnoutrefresh || nind > smaxrow) { nind = _NEWINDEX; } else if (displaced) { - register struct ldat *pline = &curscr->_line[nind]; + register struct ldat *pline = &CurScreen(sp)->_line[nind]; for (j = 0; j <= my_len; j++) { - int k = newscr->_maxx - j; + int k = NewScreen(sp)->_maxx - j; if (pline->text[j] != nline->text[j] || pline->text[k] != nline->text[k]) { nind = _NEWINDEX; @@ -257,7 +284,7 @@ pnoutrefresh if (win->_clear) { win->_clear = FALSE; - newscr->_clear = TRUE; + NewScreen(sp)->_clear = TRUE; } /* @@ -269,10 +296,10 @@ pnoutrefresh && win->_curx >= pmincol && win->_cury <= pmaxrow && win->_curx <= pmaxcol) { - newscr->_cury = win->_cury - pminrow + win->_begy + win->_yoffset; - newscr->_curx = win->_curx - pmincol + win->_begx; + NewScreen(sp)->_cury = win->_cury - pminrow + win->_begy + win->_yoffset; + NewScreen(sp)->_curx = win->_curx - pmincol + win->_begx; } - newscr->_leaveok = win->_leaveok; + NewScreen(sp)->_leaveok = win->_leaveok; win->_flags &= ~_HASMOVED; /*