X-Git-Url: https://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=ncurses%2Fbase%2Flib_refresh.c;h=27649df0669a5e4b41f3d5951a0d88393a8745fd;hp=910664b0187a3c83e8bb1f191a72007762a117f6;hb=3853a8e97d7efa8cb6a3c93c696d2c52895d6a70;hpb=b1f61d9f3aa244512045a6b02e759825d7049d34 diff --git a/ncurses/base/lib_refresh.c b/ncurses/base/lib_refresh.c index 910664b0..27649df0 100644 --- a/ncurses/base/lib_refresh.c +++ b/ncurses/base/lib_refresh.c @@ -1,5 +1,5 @@ /**************************************************************************** - * 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 * @@ -29,6 +29,7 @@ /**************************************************************************** * Author: Zeyd M. Ben-Halim 1992,1995 * * and: Eric S. Raymond * + * and: Thomas E. Dickey 1996-on * ****************************************************************************/ /* @@ -40,16 +41,18 @@ #include -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) { @@ -67,7 +70,7 @@ wrefresh(WINDOW *win) returnCode(code); } -int +NCURSES_EXPORT(int) wnoutrefresh(WINDOW *win) { NCURSES_SIZE_T limit_x; @@ -75,7 +78,9 @@ wnoutrefresh(WINDOW *win) 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 @@ -94,12 +99,13 @@ wnoutrefresh(WINDOW *win) 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 @@ -115,6 +121,7 @@ wnoutrefresh(WINDOW *win) * merely change the costs of various update cases. */ wide = (begx <= 1 && win->_maxx >= (newscr->_maxx - 1)); +#endif win->_flags &= ~_HASMOVED; @@ -128,12 +135,12 @@ wnoutrefresh(WINDOW *win) /* 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]; @@ -144,7 +151,7 @@ wnoutrefresh(WINDOW *win) 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); }