]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - ncurses/base/lib_refresh.c
ncurses 5.7 - patch 20100522
[ncurses.git] / ncurses / base / lib_refresh.c
index 2a9cafb7b0ad97dfbe5fdef4b56dc13fc44693b4..01d363f43fde63cccdcfd128589e0ba0b0459857 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2006,2007 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2007,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            *
@@ -30,6 +30,7 @@
  *  Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995               *
  *     and: Eric S. Raymond <esr@snark.thyrsus.com>                         *
  *     and: Thomas E. Dickey                        1996-on                 *
+ *     and: Juergen Pfeifer                                                 *
  ****************************************************************************/
 
 /*
 
 #include <curses.priv.h>
 
-MODULE_ID("$Id: lib_refresh.c,v 1.41 2007/09/29 20:39:34 tom Exp $")
+MODULE_ID("$Id: lib_refresh.c,v 1.43 2009/10/24 22:08:32 tom Exp $")
 
 NCURSES_EXPORT(int)
 wrefresh(WINDOW *win)
 {
     int code;
+#if NCURSES_SP_FUNCS
+    SCREEN *SP_PARM = _nc_screen_of(win);
+#endif
 
-    T((T_CALLED("wrefresh(%p)"), win));
+    T((T_CALLED("wrefresh(%p)"), (void *) win));
 
     if (win == 0) {
        code = ERR;
-    } else if (win == curscr) {
-       curscr->_clear = TRUE;
-       code = doupdate();
+    } else if (win == CurScreen(SP_PARM)) {
+       CurScreen(SP_PARM)->_clear = TRUE;
+       code = NCURSES_SP_NAME(doupdate) (NCURSES_SP_ARG);
     } else if ((code = wnoutrefresh(win)) == OK) {
        if (win->_clear)
-           newscr->_clear = TRUE;
-       code = doupdate();
+           NewScreen(SP_PARM)->_clear = TRUE;
+       code = NCURSES_SP_NAME(doupdate) (NCURSES_SP_ARG);
        /*
         * Reset the clearok() flag in case it was set for the special
         * case in hardscroll.c (if we don't reset it here, we'll get 2
@@ -81,8 +85,11 @@ wnoutrefresh(WINDOW *win)
 #if USE_SCROLL_HINTS
     bool wide;
 #endif
+#if NCURSES_SP_FUNCS
+    SCREEN *SP_PARM = _nc_screen_of(win);
+#endif
 
-    T((T_CALLED("wnoutrefresh(%p)"), win));
+    T((T_CALLED("wnoutrefresh(%p)"), (void *) win));
 #ifdef TRACE
     if (USE_TRACEF(TRACE_UPDATE)) {
        _tracedump("...win", win);
@@ -101,8 +108,8 @@ wnoutrefresh(WINDOW *win)
     begx = win->_begx;
     begy = win->_begy;
 
-    newscr->_nc_bkgd = win->_nc_bkgd;
-    WINDOW_ATTRS(newscr) = WINDOW_ATTRS(win);
+    NewScreen(SP_PARM)->_nc_bkgd = win->_nc_bkgd;
+    WINDOW_ATTRS(NewScreen(SP_PARM)) = WINDOW_ATTRS(win);
 
     /* merge in change information from all subwindows of this window */
     wsyncdown(win);
@@ -122,7 +129,7 @@ wnoutrefresh(WINDOW *win)
      * windows).  Note that changing this formula will not break any code,
      * merely change the costs of various update cases.
      */
-    wide = (begx <= 1 && win->_maxx >= (newscr->_maxx - 1));
+    wide = (begx <= 1 && win->_maxx >= (NewScreen(SP_PARM)->_maxx - 1));
 #endif
 
     win->_flags &= ~_HASMOVED;
@@ -137,13 +144,13 @@ wnoutrefresh(WINDOW *win)
     /* limit(dst_col) */
     limit_x = win->_maxx;
     /* limit(src_col) */
-    if (limit_x > newscr->_maxx - begx)
-       limit_x = newscr->_maxx - begx;
+    if (limit_x > NewScreen(SP_PARM)->_maxx - begx)
+       limit_x = NewScreen(SP_PARM)->_maxx - begx;
 
     for (src_row = 0, dst_row = begy + win->_yoffset;
-        src_row <= win->_maxy && dst_row <= newscr->_maxy;
+        src_row <= win->_maxy && dst_row <= NewScreen(SP_PARM)->_maxy;
         src_row++, dst_row++) {
-       register struct ldat *nline = &newscr->_line[dst_row];
+       register struct ldat *nline = &(NewScreen(SP_PARM)->_line[dst_row]);
        register struct ldat *oline = &win->_line[src_row];
 
        if (oline->firstchar != _NOCHANGE) {
@@ -225,7 +232,8 @@ wnoutrefresh(WINDOW *win)
                     * this character.  Find the end of the character.
                     */
                    ++j;
-                   while (j <= newscr->_maxx && isWidecExt(nline->text[j])) {
+                   while (j <= NewScreen(SP_PARM)->_maxx &&
+                          isWidecExt(nline->text[j])) {
                        fix_right = j++;
                    }
                }
@@ -269,18 +277,18 @@ wnoutrefresh(WINDOW *win)
 
     if (win->_clear) {
        win->_clear = FALSE;
-       newscr->_clear = TRUE;
+       NewScreen(SP_PARM)->_clear = TRUE;
     }
 
     if (!win->_leaveok) {
-       newscr->_cury = win->_cury + win->_begy + win->_yoffset;
-       newscr->_curx = win->_curx + win->_begx;
+       NewScreen(SP_PARM)->_cury = win->_cury + win->_begy + win->_yoffset;
+       NewScreen(SP_PARM)->_curx = win->_curx + win->_begx;
     }
-    newscr->_leaveok = win->_leaveok;
+    NewScreen(SP_PARM)->_leaveok = win->_leaveok;
 
 #ifdef TRACE
     if (USE_TRACEF(TRACE_UPDATE)) {
-       _tracedump("newscr", newscr);
+       _tracedump("newscr", NewScreen(SP_PARM));
        _nc_unlock_global(tracef);
     }
 #endif /* TRACE */