1curs_refresh(3X)                                              curs_refresh(3X)
2
3
4

NAME

6       doupdate, redrawwin, refresh, wnoutrefresh, wredrawln, wrefresh -
7       refresh curses windows and lines
8

SYNOPSIS

10       #include <curses.h>
11
12       int refresh(void);
13       int wrefresh(WINDOW *win);
14       int wnoutrefresh(WINDOW *win);
15       int doupdate(void);
16       int redrawwin(WINDOW *win);
17       int wredrawln(WINDOW *win, int beg_line, int num_lines);
18

DESCRIPTION

20       The refresh and wrefresh routines (or wnoutrefresh and  doupdate)  must
21       be called to get actual output to the terminal, as other routines mere‐
22       ly manipulate data structures.  The routine wrefresh copies  the  named
23       window to the physical terminal screen, taking into account what is al‐
24       ready there to do optimizations.  The refresh routine is the same,  us‐
25       ing stdscr as the default window.  Unless leaveok has been enabled, the
26       physical cursor of the terminal is left at the location of  the  cursor
27       for that window.
28
29       The wnoutrefresh and doupdate routines allow multiple updates with more
30       efficiency than wrefresh alone.  In addition to all the  window  struc‐
31       tures,  curses  keeps  two  data  structures  representing the terminal
32       screen: a physical screen, describing what is actually on  the  screen,
33       and  a  virtual screen, describing what the programmer wants to have on
34       the screen.
35
36       The routine wrefresh works by first calling wnoutrefresh, which  copies
37       the  named  window  to  the  virtual screen, and then calling doupdate,
38       which compares the virtual screen to the physical screen and  does  the
39       actual  update.   If the programmer wishes to output several windows at
40       once, a series of calls to wrefresh results  in  alternating  calls  to
41       wnoutrefresh  and  doupdate,  causing  several  bursts of output to the
42       screen.  By first calling wnoutrefresh for each window, it is then pos‐
43       sible  to  call  doupdate  once, resulting in only one burst of output,
44       with fewer total characters transmitted and less CPU time used.  If the
45       win  argument  to wrefresh is the global variable curscr, the screen is
46       immediately cleared and repainted from scratch.
47
48       The phrase "copies the named window to the virtual screen" above is am‐
49       biguous.   What actually happens is that all touched (changed) lines in
50       the window are copied to the virtual  screen.   This  affects  programs
51       that use overlapping windows; it means that if two windows overlap, you
52       can refresh them in either order and the overlap region will  be  modi‐
53       fied  only  when  it  is  explicitly  changed.  (But see the section on
54       PORTABILITY below for a warning about exploiting this behavior.)
55
56       The wredrawln routine indicates to curses that some  screen  lines  are
57       corrupted  and  should  be  thrown away before anything is written over
58       them.  It touches the indicated lines (marking them changed).  The rou‐
59       tine redrawwin() touches the entire window.
60

RETURN VALUE

62       Routines  that  return an integer return ERR upon failure, and OK (SVr4
63       only specifies "an integer value other than ERR") upon successful  com‐
64       pletion.
65
66       X/Open does not define any error conditions.  In this implementation
67
68              wnoutrefresh
69                   returns  an  error if the window pointer is null, or if the
70                   window is really a pad.
71
72              wredrawln
73                   returns an error if the associated call to touchln  returns
74                   an error.
75

NOTES

77       Note that refresh and redrawwin may be macros.
78

PORTABILITY

80       The XSI Curses standard, Issue 4 describes these functions.
81
82       Whether wnoutrefresh() copies to the virtual screen the entire contents
83       of a window or just its changed portions has never been well-documented
84       in  historic  curses  versions (including SVr4).  It might be unwise to
85       rely on either behavior in programs that might have to be  linked  with
86       other  curses  implementations.  Instead, you can do an explicit touch‐
87       win() before the wnoutrefresh() call to  guarantee  an  entire-contents
88       copy anywhere.
89

SEE ALSO

91       curses(3X), curs_outopts(3X) curs_variables(3X).
92
93
94
95                                                              curs_refresh(3X)
Impressum