]> ncurses.scripts.mit.edu Git - ncurses.git/blob - doc/html/man/curs_refresh.3x.html
ncurses 5.3
[ncurses.git] / doc / html / man / curs_refresh.3x.html
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
2 <!-- 
3   ****************************************************************************
4   * Copyright (c) 1998,2000,2001 Free Software Foundation, Inc.              *
5   *                                                                          *
6   * Permission is hereby granted, free of charge, to any person obtaining a  *
7   * copy of this software and associated documentation files (the            *
8   * "Software"), to deal in the Software without restriction, including      *
9   * without limitation the rights to use, copy, modify, merge, publish,      *
10   * distribute, distribute with modifications, sublicense, and/or sell       *
11   * copies of the Software, and to permit persons to whom the Software is    *
12   * furnished to do so, subject to the following conditions:                 *
13   *                                                                          *
14   * The above copyright notice and this permission notice shall be included  *
15   * in all copies or substantial portions of the Software.                   *
16   *                                                                          *
17   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
18   * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
19   * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
20   * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
21   * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
22   * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
23   * THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
24   *                                                                          *
25   * Except as contained in this notice, the name(s) of the above copyright   *
26   * holders shall not be used in advertising or otherwise to promote the     *
27   * sale, use or other dealings in this Software without prior written       *
28   * authorization.                                                           *
29   ****************************************************************************
30   * @Id: curs_refresh.3x,v 1.10 2001/11/03 18:57:12 tom Exp @
31 -->
32 <HTML>
33 <HEAD>
34 <TITLE>curs_refresh 3x</TITLE>
35 <link rev=made href="mailto:bug-ncurses@gnu.org">
36 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
37 </HEAD>
38 <BODY>
39 <H1>curs_refresh 3x</H1>
40 <HR>
41 <PRE>
42 <!-- Manpage converted by man2html 3.0.1 -->
43
44 </PRE>
45 <H2>NAME</H2><PRE>
46        <STRONG>doupdate</STRONG>,  <STRONG>redrawwin</STRONG>,  <STRONG>refresh</STRONG>,  <STRONG>wnoutrefresh</STRONG>,  <STRONG>wredrawln</STRONG>,
47        <STRONG>wrefresh</STRONG> - refresh <STRONG>curses</STRONG> windows and lines
48
49
50 </PRE>
51 <H2>SYNOPSIS</H2><PRE>
52        <STRONG>#include</STRONG> <STRONG>&lt;curses.h&gt;</STRONG>
53
54        <STRONG>int</STRONG> <STRONG>refresh(void);</STRONG>
55        <STRONG>int</STRONG> <STRONG>wrefresh(WINDOW</STRONG> <STRONG>*win);</STRONG>
56        <STRONG>int</STRONG> <STRONG>wnoutrefresh(WINDOW</STRONG> <STRONG>*win);</STRONG>
57        <STRONG>int</STRONG> <STRONG>doupdate(void);</STRONG>
58        <STRONG>int</STRONG> <STRONG>redrawwin(WINDOW</STRONG> <STRONG>*win);</STRONG>
59        <STRONG>int</STRONG> <STRONG>wredrawln(WINDOW</STRONG> <STRONG>*win,</STRONG> <STRONG>int</STRONG> <STRONG>beg_line,</STRONG> <STRONG>int</STRONG> <STRONG>num_lines);</STRONG>
60
61
62 </PRE>
63 <H2>DESCRIPTION</H2><PRE>
64        The <STRONG>refresh</STRONG> and <STRONG>wrefresh</STRONG>  routines  (or  <STRONG>wnoutrefresh</STRONG>  and
65        <STRONG>doupdate</STRONG>)  must be called to get actual output to the ter-
66        minal, as other routines  merely  manipulate  data  struc-
67        tures.   The  routine  <STRONG>wrefresh</STRONG> copies the named window to
68        the physical terminal screen, taking into account what  is
69        already there to do optimizations.  The <STRONG>refresh</STRONG> routine is
70        the same, using <STRONG>stdscr</STRONG>  as  the  default  window.   Unless
71        <STRONG>leaveok</STRONG>  has been enabled, the physical cursor of the ter-
72        minal is left at the location of the cursor for that  win-
73        dow.
74
75        The  <STRONG>wnoutrefresh</STRONG>  and  <STRONG>doupdate</STRONG>  routines  allow multiple
76        updates with more  efficiency  than  <STRONG>wrefresh</STRONG>  alone.   In
77        addition  to  all  the window structures, <STRONG>curses</STRONG> keeps two
78        data structures representing the terminal screen: a physi-
79        cal screen, describing what is actually on the screen, and
80        a virtual screen, describing what the programmer wants  to
81        have on the screen.
82
83        The  routine <STRONG>wrefresh</STRONG> works by first calling <STRONG>wnoutrefresh</STRONG>,
84        which copies the named window to the virtual  screen,  and
85        then  calling  <STRONG>doupdate</STRONG>, which compares the virtual screen
86        to the physical screen and does the actual update.  If the
87        programmer  wishes  to  output  several windows at once, a
88        series of calls to <STRONG>wrefresh</STRONG> results in  alternating  calls
89        to  <STRONG>wnoutrefresh</STRONG>  and  <STRONG>doupdate</STRONG>, causing several bursts of
90        output to the screen.  By first calling  <STRONG>wnoutrefresh</STRONG>  for
91        each  window,  it  is then possible to call <STRONG>doupdate</STRONG> once,
92        resulting in only one burst of output,  with  fewer  total
93        characters transmitted and less CPU time used.  If the <EM>win</EM>
94        argument to <STRONG>wrefresh</STRONG> is the global  variable  <STRONG>curscr</STRONG>,  the
95        screen  is immediately cleared and repainted from scratch.
96
97        The phrase "copies the named window to the virtual screen"
98        above  is  ambiguous.   What  actually happens is that all
99        <EM>touched</EM> (changed) lines in the window are  copied  to  the
100        virtual  screen.   This affects programs that use overlap-
101        ping windows; it means that if two  windows  overlap,  you
102        can  refresh  them  in either order and the overlap region
103        will be modified only when it is explicitly changed.  (But
104        see  the  section on <STRONG>PORTABILITY</STRONG> below for a warning about
105        exploiting this behavior.)
106
107        The <STRONG>wredrawln</STRONG> routine indicates to <STRONG>curses</STRONG> that some screen
108        lines  are corrupted and should be thrown away before any-
109        thing is written over  them.   It  touches  the  indicated
110        lines  (marking  them  changed).   The routine <STRONG>redrawwin</STRONG>()
111        touches the entire window.
112
113
114 </PRE>
115 <H2>RETURN VALUE</H2><PRE>
116        Routines that return an integer return <STRONG>ERR</STRONG>  upon  failure,
117        and  <STRONG>OK</STRONG>  (SVr4 only specifies "an integer value other than
118        <STRONG>ERR</STRONG>") upon successful completion.
119
120
121 </PRE>
122 <H2>NOTES</H2><PRE>
123        Note that <STRONG>refresh</STRONG> and <STRONG>redrawwin</STRONG> may be macros.
124
125
126 </PRE>
127 <H2>PORTABILITY</H2><PRE>
128        The XSI Curses standard, Issue  4  describes  these  func-
129        tions.
130
131        Whether  <STRONG>wnoutrefresh()</STRONG>  copies  to the virtual screen the
132        entire contents of a window or just its  changed  portions
133        has never been well-documented in historic curses versions
134        (including SVr4).  It might be unwise to  rely  on  either
135        behavior  in  programs  that  might have to be linked with
136        other curses implementations.   Instead,  you  can  do  an
137        explicit  <STRONG>touchwin()</STRONG>  before  the  <STRONG>wnoutrefresh()</STRONG>  call to
138        guarantee an entire-contents copy anywhere.
139
140
141 </PRE>
142 <H2>SEE ALSO</H2><PRE>
143        <STRONG><A HREF="ncurses.3x.html">curses(3x)</A></STRONG>, <STRONG><A HREF="curs_outopts.3x.html">curs_outopts(3x)</A></STRONG>
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165 </PRE>
166 <HR>
167 <ADDRESS>
168 Man(1) output converted with
169 <a href="http://www.oac.uci.edu/indiv/ehood/man2html.html">man2html</a>
170 </ADDRESS>
171 </BODY>
172 </HTML>