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