1curs_window(3X)                                                curs_window(3X)
2
3
4

NAME

6       newwin, delwin, mvwin, subwin, derwin, mvderwin, dupwin, wsyncup,
7       syncok, wcursyncup, wsyncdown - create curses windows
8

SYNOPSIS

10       #include <curses.h>
11
12       WINDOW *newwin(
13             int nlines, int ncols,
14             int begin_y, int begin_x);
15       int delwin(WINDOW *win);
16       int mvwin(WINDOW *win, int y, int x);
17       WINDOW *subwin(WINDOW *orig,
18             int nlines, int ncols,
19             int begin_y, int begin_x);
20       WINDOW *derwin(WINDOW *orig,
21             int nlines, int ncols,
22             int begin_y, int begin_x);
23       int mvderwin(WINDOW *win, int par_y, int par_x);
24       WINDOW *dupwin(WINDOW *win);
25       void wsyncup(WINDOW *win);
26       int syncok(WINDOW *win, bool bf);
27       void wcursyncup(WINDOW *win);
28       void wsyncdown(WINDOW *win);
29

DESCRIPTION

31   newwin
32       Calling newwin creates and returns a pointer to a new window  with  the
33       given  number  of lines and columns.  The upper left-hand corner of the
34       window is at
35              line begin_y,
36              column begin_x
37
38       If either nlines or ncols is zero, they default to
39              LINES - begin_y and
40              COLS - begin_x.
41
42       A new full-screen window is created by calling newwin(0,0,0,0).
43
44       Regardless of the function  used  for  creating  a  new  window  (e.g.,
45       newwin, subwin, derwin, newpad), rather than a duplicate (with dupwin),
46       all of the window modes are initialized to the default  values.   These
47       functions set window modes after a window is created:
48
49              idcok, idlok, immedok, keypad, leaveok, nodelay, scrollok,
50              setscrreg, syncok, wbkgdset, wbkgrndset, and wtimeout
51
52   delwin
53       Calling delwin deletes the named window, freeing all memory  associated
54       with  it  (it does not actually erase the window's screen image).  Sub‐
55       windows must be deleted before the main window can be deleted.
56
57   mvwin
58       Calling mvwin moves the window so that the upper left-hand corner is at
59       position  (x,  y).   If  the  move would cause the window to be off the
60       screen, it is an error and the window is not moved.  Moving  subwindows
61       is allowed, but should be avoided.
62
63   subwin
64       Calling  subwin  creates and returns a pointer to a new window with the
65       given number of lines, nlines, and columns, ncols.  The  window  is  at
66       position (begin_y, begin_x) on the screen.  The subwindow shares memory
67       with the window orig, so that changes made to one  window  will  affect
68       both  windows.  When using this routine, it is necessary to call touch‐
69       win or touchline on orig before calling wrefresh on the subwindow.
70
71   derwin
72       Calling derwin is the same as calling subwin, except that  begin_y  and
73       begin_x  are  relative to the origin of the window orig rather than the
74       screen.  There is no difference between the subwindows and the  derived
75       windows.
76
77       Calling  mvderwin moves a derived window (or subwindow) inside its par‐
78       ent window.  The screen-relative  parameters  of  the  window  are  not
79       changed.  This routine is used to display different parts of the parent
80       window at the same physical position on the screen.
81
82   dupwin
83       Calling dupwin creates an exact duplicate of the window win.
84
85   wsyncup
86       Calling wsyncup touches all locations in  ancestors  of  win  that  are
87       changed  in  win.   If  syncok is called with second argument TRUE then
88       wsyncup is called automatically whenever there is a change in the  win‐
89       dow.
90
91   wsyncdown
92       The  wsyncdown  routine  touches  each  location  in  win that has been
93       touched in any of its ancestor windows.  This routine is called by wre‐
94       fresh, so it should almost never be necessary to call it manually.
95
96   wcursyncup
97       The  routine  wcursyncup updates the current cursor position of all the
98       ancestors of the window to reflect the current cursor position  of  the
99       window.
100

RETURN VALUE

102       Routines that return an integer return the integer ERR upon failure and
103       OK (SVr4 only specifies "an integer value other than  ERR")  upon  suc‐
104       cessful completion.
105
106       Routines that return pointers return NULL on error.
107
108       X/Open defines no error conditions.  In this implementation
109
110       delwin
111            returns  an  error if the window pointer is null, or if the window
112            is the parent of another window.
113
114       derwin
115            returns an error if the parent window pointer is null, or  if  any
116            of  its  ordinates  or dimensions is negative, or if the resulting
117            window does not fit inside the parent window.
118
119       dupwin
120            returns an error if the window pointer is null.
121
122            This implementation also maintains a list of windows,  and  checks
123            that  the pointer passed to delwin is one that it created, return‐
124            ing an error if it was not..
125
126       mvderwin
127            returns an error if the window pointer is null, or if some part of
128            the window would be placed off-screen.
129
130       mvwin
131            returns  an  error if the window pointer is null, or if the window
132            is really a pad, or if some part of the  window  would  be  placed
133            off-screen.
134
135       newwin
136            will  fail if either of its beginning ordinates is negative, or if
137            either the number of lines or columns is negative.
138
139       syncok
140            returns an error if the window pointer is null.
141
142       subwin
143            returns an error if the parent window pointer is null, or  if  any
144            of  its  ordinates  or dimensions is negative, or if the resulting
145            window does not fit inside the parent window.
146
147       The functions which return a window pointer may also fail if  there  is
148       insufficient  memory  for  its data structures.  Any of these functions
149       will fail if the screen has not been initialized, i.e., with initscr or
150       newterm.
151

NOTES

153       If  many small changes are made to the window, the wsyncup option could
154       degrade performance.
155
156       Note that syncok may be a macro.
157

BUGS

159       The subwindow functions (subwin, derwin, mvderwin, wsyncup,  wsyncdown,
160       wcursyncup,  syncok)  are flaky, incompletely implemented, and not well
161       tested.
162
163       The System V curses documentation is very unclear  about  what  wsyncup
164       and  wsyncdown  actually do.  It seems to imply that they are only sup‐
165       posed to touch exactly  those  lines  that  are  affected  by  ancestor
166       changes.  The language here, and the behavior of the curses implementa‐
167       tion, is patterned on the XPG4 curses standard.  The weaker  XPG4  spec
168       may result in slower updates.
169

PORTABILITY

171       The XSI Curses standard, Issue 4 describes these functions.
172

SEE ALSO

174       curses(3X), curs_refresh(3X), curs_touch(3X), curs_variables(3X)
175
176
177
178                                                               curs_window(3X)
Impressum