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
17       int redrawwin(WINDOW *win);
18       int wredrawln(WINDOW *win, int beg_line, int num_lines);
19

DESCRIPTION

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

RETURN VALUE

76       Routines  that  return an integer return ERR upon failure, and OK (SVr4
77       only specifies "an integer value other than ERR") upon successful  com‐
78       pletion.
79
80       X/Open does not define any error conditions.  In this implementation
81
82          wnoutrefresh
83               returns  an error if the window pointer is null, or if the win‐
84               dow is really a pad.
85
86          wredrawln
87               returns an error if the associated call to touchln  returns  an
88               error.
89

NOTES

91       Note that refresh and redrawwin may be macros.
92

PORTABILITY

94       The XSI Curses standard, Issue 4 describes these functions.
95
96       Whether  wnoutrefresh  copies to the virtual screen the entire contents
97       of a window or just its changed portions has never been well-documented
98       in  historic  curses  versions (including SVr4).  It might be unwise to
99       rely on either behavior in programs that might have to be  linked  with
100       other curses implementations.  Instead, you can do an explicit touchwin
101       before the wnoutrefresh call to guarantee an entire-contents copy  any‐
102       where.
103

SEE ALSO

105       curses(3X), curs_outopts(3X) curs_variables(3X).
106
107
108
109                                                              curs_refresh(3X)
Impressum