]> ncurses.scripts.mit.edu Git - ncurses.git/blob - man/curs_refresh.3x
ncurses 4.2
[ncurses.git] / man / curs_refresh.3x
1 .\" $Id: curs_refresh.3x,v 1.6 1997/11/29 20:11:26 tom Exp $
2 .TH curs_refresh 3X ""
3 .SH NAME
4 \fBrefresh\fR, \fBwrefresh\fR, \fBwnoutrefresh\fR,
5 \fBdoupdate\fR, \fBredrawwin\fR, \fBwredrawln\fR - refresh
6 \fBcurses\fR windows and lines
7 .SH SYNOPSIS
8 \fB#include <curses.h>\fR
9
10 \fBint refresh(void);\fR
11 .br
12 \fBint wrefresh(WINDOW *win);\fR
13 .br
14 \fBint wnoutrefresh(WINDOW *win);\fR
15 .br
16 \fBint doupdate(void);\fR
17 .br
18 \fBint redrawwin(WINDOW *win);\fR
19 .br
20 \fBint wredrawln(WINDOW *win, int beg_line, int num_lines);\fR
21 .br
22 .SH DESCRIPTION
23 The \fBrefresh\fR and \fBwrefresh\fR routines (or \fBwnoutrefresh\fR and
24 \fBdoupdate\fR) must be called to get actual output to the terminal, as other
25 routines merely manipulate data structures.  The routine \fBwrefresh\fR copies
26 the named window to the physical terminal screen, taking into account what is
27 already there in order to do optimizations.  The \fBrefresh\fR routine is the
28 same, using \fBstdscr\fR as the default window.  Unless \fBleaveok\fR has been
29 enabled, the physical cursor of the terminal is left at the location of the
30 cursor for that window.
31
32 The \fBwnoutrefresh\fR and \fBdoupdate\fR routines allow multiple updates with
33 more efficiency than \fBwrefresh\fR alone.  In addition to all the window
34 structures, \fBcurses\fR keeps two data structures representing the terminal
35 screen: a physical screen, describing what is actually on the screen, and a
36 virtual screen, describing what the programmer wants to have on the screen.
37
38 The routine \fBwrefresh\fR works by first calling \fBwnoutrefresh\fR, which
39 copies the named window to the virtual screen, and then calling \fBdoupdate\fR,
40 which compares the virtual screen to the physical screen and does the actual
41 update.  If the programmer wishes to output several windows at once, a series
42 of calls to \fBwrefresh\fR results in alternating calls to \fBwnoutrefresh\fR
43 and \fBdoupdate\fR, causing several bursts of output to the screen.  By first
44 calling \fBwnoutrefresh\fR for each window, it is then possible to call
45 \fBdoupdate\fR once, resulting in only one burst of output, with fewer total
46 characters transmitted and less CPU time used.  If the \fIwin\fR argument to
47 \fBwrefresh\fR is the global variable \fBcurscr\fR, the screen is immediately
48 cleared and repainted from scratch.
49
50 The phrase "copies the named window to the virtual screen" above is ambiguous.
51 What actually happens is that all \fItouched\fR (changed) lines in the window
52 are copied to the virtual screen.  This affects programs that use overlapping
53 windows; it means that if two windows overlap, you can refresh them in either
54 order and the overlap region will be modified only when it is explicitly
55 changed.  (But see the section on \fBPORTABILITY\fR below for a warning about
56 exploiting this behavior.)
57
58 The \fBwredrawln\fR routine indicates to \fBcurses\fR that some screen lines
59 are corrupted and should be thrown away before anything is written over them.
60 It touches the indicated lines (marking them changed).
61 The routine \fBredrawwin\fR() touches the entire window.
62 .SH RETURN VALUE
63 Routines that return an integer return \fBERR\fR upon failure, and \fBOK\fR
64 (SVr4 only specifies "an integer value other than \fBERR\fR") upon successful
65 completion.
66 .SH NOTES
67 Note that \fBrefresh\fR and \fBredrawwin\fR may be macros.
68 .SH PORTABILITY
69 The XSI Curses standard, Issue 4 describes these functions.
70
71 Whether \fBwnoutrefresh()\fR copies to the virtual screen the entire contents
72 of a window or just its changed portions has never been well-documented in
73 historic curses versions (including SVr4).  It might be unwise to rely on
74 either behavior in programs that might have to be linked with other curses
75 implementations.  Instead, you can do an explicit \fBtouchwin()\fR before the
76 \fBwnoutrefresh()\fR call to guarantee an entire-contents copy anywhere.
77 .SH SEE ALSO
78 \fBcurses\fR(3X), \fBcurs_outopts\fR(3X)
79 .\"#
80 .\"# The following sets edit modes for GNU EMACS
81 .\"# Local Variables:
82 .\"# mode:nroff
83 .\"# fill-column:79
84 .\"# End: