blob: e1552c37cb485ac0429c496a66ef93fd9f743218 [file] [log] [blame]
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301.\"***************************************************************************
Steve Kondikae271bc2015-11-15 02:50:53 +01002.\" Copyright (c) 1998-2005,2010 Free Software Foundation, Inc. *
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05303.\" *
4.\" Permission is hereby granted, free of charge, to any person obtaining a *
5.\" copy of this software and associated documentation files (the *
6.\" "Software"), to deal in the Software without restriction, including *
7.\" without limitation the rights to use, copy, modify, merge, publish, *
8.\" distribute, distribute with modifications, sublicense, and/or sell *
9.\" copies of the Software, and to permit persons to whom the Software is *
10.\" furnished to do so, subject to the following conditions: *
11.\" *
12.\" The above copyright notice and this permission notice shall be included *
13.\" in all copies or substantial portions of the Software. *
14.\" *
15.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
16.\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
17.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
18.\" IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
19.\" DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
20.\" OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
21.\" THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
22.\" *
23.\" Except as contained in this notice, the name(s) of the above copyright *
24.\" holders shall not be used in advertising or otherwise to promote the *
25.\" sale, use or other dealings in this Software without prior written *
26.\" authorization. *
27.\"***************************************************************************
28.\"
Steve Kondikae271bc2015-11-15 02:50:53 +010029.\" $Id: curs_refresh.3x,v 1.15 2010/12/04 18:38:55 tom Exp $
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053030.TH curs_refresh 3X ""
31.na
32.hy 0
33.SH NAME
34\fBdoupdate\fR,
35\fBredrawwin\fR,
36\fBrefresh\fR,
37\fBwnoutrefresh\fR,
38\fBwredrawln\fR,
Steve Kondikae271bc2015-11-15 02:50:53 +010039\fBwrefresh\fR \- refresh \fBcurses\fR windows and lines
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053040.ad
41.hy
42.SH SYNOPSIS
43\fB#include <curses.h>\fR
44.sp
45\fBint refresh(void);\fR
46.br
47\fBint wrefresh(WINDOW *win);\fR
48.br
49\fBint wnoutrefresh(WINDOW *win);\fR
50.br
51\fBint doupdate(void);\fR
52.br
53\fBint redrawwin(WINDOW *win);\fR
54.br
55\fBint wredrawln(WINDOW *win, int beg_line, int num_lines);\fR
56.br
57.SH DESCRIPTION
58The \fBrefresh\fR and \fBwrefresh\fR routines (or \fBwnoutrefresh\fR and
59\fBdoupdate\fR) must be called to get actual output to the terminal, as other
60routines merely manipulate data structures.
61The routine \fBwrefresh\fR copies
62the named window to the physical terminal screen, taking into account what is
63already there to do optimizations.
64The \fBrefresh\fR routine is the
65same, using \fBstdscr\fR as the default window.
66Unless \fBleaveok\fR has been
67enabled, the physical cursor of the terminal is left at the location of the
68cursor for that window.
69.PP
70The \fBwnoutrefresh\fR and \fBdoupdate\fR routines allow multiple updates with
71more efficiency than \fBwrefresh\fR alone.
72In addition to all the window
73structures, \fBcurses\fR keeps two data structures representing the terminal
74screen: a physical screen, describing what is actually on the screen, and a
75virtual screen, describing what the programmer wants to have on the screen.
76.PP
77The routine \fBwrefresh\fR works by first calling \fBwnoutrefresh\fR, which
78copies the named window to the virtual screen, and then calling \fBdoupdate\fR,
79which compares the virtual screen to the physical screen and does the actual
80update.
81If the programmer wishes to output several windows at once, a series
82of calls to \fBwrefresh\fR results in alternating calls to \fBwnoutrefresh\fR
83and \fBdoupdate\fR, causing several bursts of output to the screen.
84By first
85calling \fBwnoutrefresh\fR for each window, it is then possible to call
86\fBdoupdate\fR once, resulting in only one burst of output, with fewer total
87characters transmitted and less CPU time used.
88If the \fIwin\fR argument to
89\fBwrefresh\fR is the global variable \fBcurscr\fR, the screen is immediately
90cleared and repainted from scratch.
91.PP
92The phrase "copies the named window to the virtual screen" above is ambiguous.
93What actually happens is that all \fItouched\fR (changed) lines in the window
94are copied to the virtual screen.
95This affects programs that use overlapping
96windows; it means that if two windows overlap, you can refresh them in either
97order and the overlap region will be modified only when it is explicitly
98changed.
99(But see the section on \fBPORTABILITY\fR below for a warning about
100exploiting this behavior.)
101.PP
102The \fBwredrawln\fR routine indicates to \fBcurses\fR that some screen lines
103are corrupted and should be thrown away before anything is written over them.
104It touches the indicated lines (marking them changed).
105The routine \fBredrawwin\fR() touches the entire window.
106.SH RETURN VALUE
107Routines that return an integer return \fBERR\fR upon failure, and \fBOK\fR
108(SVr4 only specifies "an integer value other than \fBERR\fR") upon successful
109completion.
110.PP
111X/Open does not define any error conditions.
112In this implementation
113.RS
114.TP 5
115\fBwnoutrefresh\fP
116returns an error
117if the window pointer is null, or
118if the window is really a pad.
119.TP 5
120\fBwredrawln\fP
121returns an error
122if the associated call to \fBtouchln\fP returns an error.
123.RE
124.SH NOTES
125Note that \fBrefresh\fR and \fBredrawwin\fR may be macros.
126.SH PORTABILITY
127The XSI Curses standard, Issue 4 describes these functions.
128.PP
129Whether \fBwnoutrefresh()\fR copies to the virtual screen the entire contents
130of a window or just its changed portions has never been well-documented in
131historic curses versions (including SVr4).
132It might be unwise to rely on
133either behavior in programs that might have to be linked with other curses
134implementations.
135Instead, you can do an explicit \fBtouchwin()\fR before the
136\fBwnoutrefresh()\fR call to guarantee an entire-contents copy anywhere.
137.SH SEE ALSO
Steve Kondikae271bc2015-11-15 02:50:53 +0100138\fBcurses\fR(3X),
139\fBcurs_outopts\fR(3X)
140\fBcurs_variables\fR(3X).