]> ncurses.scripts.mit.edu Git - ncurses.git/blob - man/curs_kernel.3x
ncurses 6.1 - patch 20190309
[ncurses.git] / man / curs_kernel.3x
1 .\"***************************************************************************
2 .\" Copyright (c) 1998-2017,2018 Free Software Foundation, Inc.              *
3 .\"                                                                          *
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 .\"
29 .\" $Id: curs_kernel.3x,v 1.26 2018/07/28 23:04:00 tom Exp $
30 .ie \n(.g .ds `` \(lq
31 .el       .ds `` ``
32 .ie \n(.g .ds '' \(rq
33 .el       .ds '' ''
34 .de bP
35 .ie n  .IP \(bu 4
36 .el    .IP \(bu 2
37 ..
38 .TH curs_kernel 3X ""
39 .na
40 .hy 0
41 .SH NAME
42 \fBdef_prog_mode\fR,
43 \fBdef_shell_mode\fR,
44 \fBreset_prog_mode\fR,
45 \fBreset_shell_mode\fR,
46 \fBresetty\fR,
47 \fBsavetty\fR,
48 \fBgetsyx\fR,
49 \fBsetsyx\fR,
50 \fBripoffline\fR,
51 \fBcurs_set\fR,
52 \fBnapms\fR \- low-level \fBcurses\fR routines
53 .ad
54 .hy
55 .SH SYNOPSIS
56 \fB#include <curses.h>\fR
57 .sp
58 \fBint def_prog_mode(void);\fR
59 .br
60 \fBint def_shell_mode(void);\fR
61 .br
62 \fBint reset_prog_mode(void);\fR
63 .br
64 \fBint reset_shell_mode(void);\fR
65 .br
66 \fBint resetty(void);\fR
67 .br
68 \fBint savetty(void);\fR
69 .br
70 \fBvoid getsyx(int \fP\fIy\fP\fB, int \fP\fIx\fP\fB);\fR
71 .br
72 \fBvoid setsyx(int \fP\fIy\fP\fB, int \fP\fIx\fP\fB);\fR
73 .br
74 \fBint ripoffline(int \fP\fIline\fP\fB, int (*\fP\fIinit\fP\fB)(WINDOW *, int));\fR
75 .br
76 \fBint curs_set(int \fP\fIvisibility\fP\fB);\fR
77 .br
78 \fBint napms(int \fP\fIms\fP\fB);\fR
79 .br
80 .SH DESCRIPTION
81 The following routines give low-level access
82 to various \fBcurses\fR capabilities.
83 These routines typically are used inside library routines.
84 .SS def_prog_mode, def_shell_mode
85 .PP
86 The \fBdef_prog_mode\fR and \fBdef_shell_mode\fR routines save the
87 current terminal modes as the "program" (in \fBcurses\fR) or "shell"
88 (not in \fBcurses\fR) state for use by the \fBreset_prog_mode\fR and
89 \fBreset_shell_mode\fR routines.
90 This is done automatically by \fBinitscr\fR.
91 There is one such save area for each screen context
92 allocated by \fBnewterm\fR.
93 .SS reset_prog_mode, reset_shell_mode
94 .PP
95 The \fBreset_prog_mode\fR and \fBreset_shell_mode\fR routines restore
96 the terminal to "program" (in \fBcurses\fR) or "shell" (out of
97 \fBcurses\fR) state.
98 These are done automatically by \fBendwin\fR(3X) and,
99 after an \fBendwin\fR, by \fBdoupdate\fR,
100 so they normally are not called.
101 .SS resetty, savetty
102 .PP
103 The \fBresetty\fR and \fBsavetty\fR routines save and restore the
104 state of the terminal modes.
105 \fBsavetty\fR saves the current state in
106 a buffer and \fBresetty\fR restores the state to what it was at the
107 last call to \fBsavetty\fR.
108 .SS getsyx
109 .PP
110 The \fBgetsyx\fR routine returns the current coordinates
111 of the \fIvirtual screen\fP cursor in \fIy\fR and \fIx\fR.
112 If \fBleaveok\fR is currently \fBTRUE\fR, then
113 \fB\-1\fR,\fB\-1\fR is returned.
114 If lines have been removed from the top of the
115 screen, using \fBripoffline\fR, \fIy\fR and \fIx\fR include these lines;
116 therefore, \fIy\fR and \fIx\fR should be used only as arguments for
117 \fBsetsyx\fR.
118 .PP
119 Few applications will use this feature,
120 most use \fBgetyx\fP instead.
121 .SS setsyx
122 .PP
123 The \fBsetsyx\fR routine sets
124 the \fIvirtual screen\fP cursor to \fIy\fR, \fIx\fR.
125 If \fIy\fR and \fIx\fR are both \fB\-1\fR, then
126 \fBleaveok\fR is set.
127 The two routines \fBgetsyx\fR and \fBsetsyx\fR
128 are designed to be used by a library routine, which manipulates
129 \fBcurses\fR windows but does not want to change the current position
130 of the program's cursor.
131 The library routine would call \fBgetsyx\fR
132 at the beginning, do its manipulation of its own windows, do a
133 \fBwnoutrefresh\fR on its windows, call \fBsetsyx\fR, and then call
134 \fBdoupdate\fR.
135 .PP
136 Few applications will use this feature,
137 most use \fBwmove\fP instead.
138 .SS ripoffline
139 .PP
140 The \fBripoffline\fR routine provides access to the same facility that
141 \fBslk_init\fR [see \fBcurs_slk\fR(3X)] uses to reduce the size of the
142 screen.
143 \fBripoffline\fR must be called before \fBinitscr\fR or
144 \fBnewterm\fR is called, to prepare these initial actions:
145 .bP
146 If \fIline\fR is positive, a line is removed from the top of \fBstdscr\fR.
147 .bP
148 if \fIline\fR is negative, a line is removed from the bottom.
149 .PP
150 When the resulting initialization is done inside \fBinitscr\fR, the
151 routine \fBinit\fR (supplied by the user) is called with two
152 arguments:
153 .bP
154 a window pointer to the one-line window that has been
155 allocated and
156 .bP
157 an integer with the number of columns in the window.
158 .PP
159 Inside this initialization routine, the integer variables \fBLINES\fR
160 and \fBCOLS\fR (defined in \fB<curses.h>\fR) are not guaranteed to be
161 accurate and \fBwrefresh\fR or \fBdoupdate\fR must not be called.
162 It is allowable to call \fBwnoutrefresh\fR during the initialization routine.
163 .PP
164 \fBripoffline\fR can be called up to five times before calling \fBinitscr\fR or
165 \fBnewterm\fR.
166 .SS curs_set
167 .PP
168 The \fBcurs_set\fR routine sets the cursor state to invisible,
169 normal, or very visible for \fBvisibility\fR equal to \fB0\fR,
170 \fB1\fR, or \fB2\fR respectively.
171 If the terminal supports the \fIvisibility\fR requested,
172 the previous \fIcursor\fR state is returned;
173 otherwise, \fBERR\fR is returned.
174 .SS napms
175 .PP
176 The \fBnapms\fR routine is used to sleep for \fIms\fR milliseconds.
177 .SH RETURN VALUE
178 Except for \fBcurs_set\fR, these routines always return \fBOK\fR.
179 .PP
180 \fBcurs_set\fR
181 returns the previous cursor state, or \fBERR\fR if the
182 requested \fIvisibility\fR is not supported.
183 .PP
184 X/Open defines no error conditions.
185 In this implementation
186 .TP 5
187 .na
188 .hy 0
189 \fBdef_prog_mode\fR, \fBdef_shell_mode\fR, \fBreset_prog_mode\fR, \fBreset_shell_mode\fR
190 .hy
191 .ad
192 return an error
193 if the terminal was not initialized, or
194 if the I/O call to obtain the terminal settings fails.
195 .TP 5
196 \fBripoffline\fP
197 returns an error if the maximum number of ripped-off lines
198 exceeds the maximum (NRIPS = 5).
199 .SH NOTES
200 Note that \fBgetsyx\fR is a macro, so \fB&\fR is not necessary before
201 the variables \fIy\fR and \fIx\fR.
202 .PP
203 Older SVr4 man pages warn that the return value
204 of \fBcurs_set\fR \*(``is currently incorrect\*(''.
205 This implementation gets it right, but it may be unwise to count
206 on the correctness of the return value anywhere else.
207 .PP
208 Both ncurses and SVr4 will call \fBcurs_set\fR in \fBendwin\fR
209 if \fBcurs_set\fR
210 has been called to make the cursor other than normal, i.e., either
211 invisible or very visible.
212 There is no way for ncurses to determine the initial cursor state to
213 restore that.
214 .SH PORTABILITY
215 The \fIvirtual screen\fP functions \fBsetsyx\fR and \fBgetsyx\fR
216 are not described in the XSI Curses standard, Issue 4.
217 All other functions are as described in XSI Curses.
218 .PP
219 The SVr4 documentation describes \fBsetsyx\fR and \fBgetsyx\fR
220 as having return type int.
221 This is misleading, as they are macros with no documented semantics
222 for the return value.
223 .SH SEE ALSO
224 \fBcurses\fR(3X),
225 \fBcurs_initscr\fR(3X),
226 \fBcurs_outopts\fR(3X),
227 \fBcurs_refresh\fR(3X),
228 \fBcurs_scr_dump\fR(3X),
229 \fBcurs_slk\fR(3X),
230 \fBcurs_variables\fR(3X).