/****************************************************************************
- * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2005,2006 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 *
/****************************************************************************
* Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
* and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ * and: Thomas E. Dickey 1996-on *
****************************************************************************/
/*
#include <curses.priv.h>
-MODULE_ID("$Id: lib_refresh.c,v 1.25 2000/04/29 21:17:08 tom Exp $")
+MODULE_ID("$Id: lib_refresh.c,v 1.34 2006/05/27 19:21:19 tom Exp $")
-int
+NCURSES_EXPORT(int)
wrefresh(WINDOW *win)
{
int code;
T((T_CALLED("wrefresh(%p)"), win));
- if (win == curscr) {
+ if (win == 0) {
+ code = ERR;
+ } else if (win == curscr) {
curscr->_clear = TRUE;
code = doupdate();
} else if ((code = wnoutrefresh(win)) == OK) {
returnCode(code);
}
-int
+NCURSES_EXPORT(int)
wnoutrefresh(WINDOW *win)
{
NCURSES_SIZE_T limit_x;
NCURSES_SIZE_T begx;
NCURSES_SIZE_T begy;
NCURSES_SIZE_T m, n;
+#if USE_SCROLL_HINTS
bool wide;
+#endif
T((T_CALLED("wnoutrefresh(%p)"), win));
#ifdef TRACE
begx = win->_begx;
begy = win->_begy;
- newscr->_bkgd = win->_bkgd;
- newscr->_attrs = win->_attrs;
+ newscr->_nc_bkgd = win->_nc_bkgd;
+ WINDOW_ATTRS(newscr) = WINDOW_ATTRS(win);
/* merge in change information from all subwindows of this window */
wsyncdown(win);
+#if USE_SCROLL_HINTS
/*
* For pure efficiency, we'd want to transfer scrolling information
* from the window to newscr whenever the window is wide enough that
* merely change the costs of various update cases.
*/
wide = (begx <= 1 && win->_maxx >= (newscr->_maxx - 1));
+#endif
win->_flags &= ~_HASMOVED;
/* limit(n) */
limit_x = win->_maxx;
/* limit(j) */
- if (limit_x > win->_maxx)
- limit_x = win->_maxx;
+ if (limit_x > newscr->_maxx - begx)
+ limit_x = newscr->_maxx - begx;
for (i = 0, m = begy + win->_yoffset;
- i <= win->_maxy && m <= newscr->_maxy;
- i++, m++) {
+ i <= win->_maxy && m <= newscr->_maxy;
+ i++, m++) {
register struct ldat *nline = &newscr->_line[m];
register struct ldat *oline = &win->_line[i];
last = limit_x;
for (j = oline->firstchar, n = j + begx; j <= last; j++, n++) {
- if (oline->text[j] != nline->text[n]) {
+ if (!CharEq(oline->text[j], nline->text[n])) {
nline->text[n] = oline->text[j];
CHANGED_CELL(nline, n);
}