]> ncurses.scripts.mit.edu Git - ncurses.git/blob - doc/html/man/curs_kernel.3x.html
ncurses 6.2 - patch 20210619
[ncurses.git] / doc / html / man / curs_kernel.3x.html
1 <!--
2   ****************************************************************************
3   * Copyright 2018-2019,2020 Thomas E. Dickey                                *
4   * Copyright 1998-2016,2017 Free Software Foundation, Inc.                  *
5   *                                                                          *
6   * Permission is hereby granted, free of charge, to any person obtaining a  *
7   * copy of this software and associated documentation files (the            *
8   * "Software"), to deal in the Software without restriction, including      *
9   * without limitation the rights to use, copy, modify, merge, publish,      *
10   * distribute, distribute with modifications, sublicense, and/or sell       *
11   * copies of the Software, and to permit persons to whom the Software is    *
12   * furnished to do so, subject to the following conditions:                 *
13   *                                                                          *
14   * The above copyright notice and this permission notice shall be included  *
15   * in all copies or substantial portions of the Software.                   *
16   *                                                                          *
17   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
18   * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
19   * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
20   * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
21   * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
22   * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
23   * THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
24   *                                                                          *
25   * Except as contained in this notice, the name(s) of the above copyright   *
26   * holders shall not be used in advertising or otherwise to promote the     *
27   * sale, use or other dealings in this Software without prior written       *
28   * authorization.                                                           *
29   ****************************************************************************
30   * @Id: curs_kernel.3x,v 1.29 2020/10/17 23:22:35 tom Exp @
31 -->
32 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
33 <HTML>
34 <HEAD>
35 <meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
36 <meta name="generator" content="Manpage converted by man2html - see https://invisible-island.net/scripts/readme.html#others_scripts">
37 <TITLE>curs_kernel 3X</TITLE>
38 <link rel="author" href="mailto:bug-ncurses@gnu.org">
39 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
40 </HEAD>
41 <BODY>
42 <H1 class="no-header">curs_kernel 3X</H1>
43 <PRE>
44 <B><A HREF="curs_kernel.3X.html">curs_kernel(3X)</A></B>                                                <B><A HREF="curs_kernel.3X.html">curs_kernel(3X)</A></B>
45
46
47
48
49 </PRE><H2><a name="h2-NAME">NAME</a></H2><PRE>
50        <B>def_prog_mode</B>, <B>def_shell_mode</B>, <B>reset_prog_mode</B>, <B>reset_shell_mode</B>,
51        <B>resetty</B>, <B>savetty</B>, <B>getsyx</B>, <B>setsyx</B>, <B>ripoffline</B>, <B>curs_set</B>, <B>napms</B> - low-
52        level <B>curses</B> routines
53
54
55 </PRE><H2><a name="h2-SYNOPSIS">SYNOPSIS</a></H2><PRE>
56        <B>#include</B> <B>&lt;curses.h&gt;</B>
57
58        <B>int</B> <B>def_prog_mode(void);</B>
59        <B>int</B> <B>def_shell_mode(void);</B>
60
61        <B>int</B> <B>reset_prog_mode(void);</B>
62        <B>int</B> <B>reset_shell_mode(void);</B>
63
64        <B>int</B> <B>resetty(void);</B>
65        <B>int</B> <B>savetty(void);</B>
66
67        <B>void</B> <B>getsyx(int</B> <I>y</I><B>,</B> <B>int</B> <I>x</I><B>);</B>
68        <B>void</B> <B>setsyx(int</B> <I>y</I><B>,</B> <B>int</B> <I>x</I><B>);</B>
69
70        <B>int</B> <B>ripoffline(int</B> <I>line</I><B>,</B> <B>int</B> <B>(*</B><I>init</I><B>)(WINDOW</B> <B>*,</B> <B>int));</B>
71        <B>int</B> <B>curs_set(int</B> <I>visibility</I><B>);</B>
72        <B>int</B> <B>napms(int</B> <I>ms</I><B>);</B>
73
74
75 </PRE><H2><a name="h2-DESCRIPTION">DESCRIPTION</a></H2><PRE>
76        The following routines give low-level access to various <B>curses</B> capabil-
77        ities.  These routines typically are used inside library routines.
78
79
80 </PRE><H3><a name="h3-def_prog_mode_-def_shell_mode">def_prog_mode, def_shell_mode</a></H3><PRE>
81        The <B>def_prog_mode</B> and <B>def_shell_mode</B> routines save the current terminal
82        modes as the "program" (in <B>curses</B>) or "shell" (not in <B>curses</B>) state for
83        use by the <B>reset_prog_mode</B> and <B>reset_shell_mode</B> routines.  This is done
84        automatically  by <B>initscr</B>.  There is one such save area for each screen
85        context allocated by <B>newterm</B>.
86
87
88 </PRE><H3><a name="h3-reset_prog_mode_-reset_shell_mode">reset_prog_mode, reset_shell_mode</a></H3><PRE>
89        The <B>reset_prog_mode</B> and <B>reset_shell_mode</B> routines restore the  terminal
90        to  "program"  (in <B>curses</B>) or "shell" (out of <B>curses</B>) state.  These are
91        done automatically by <B><A HREF="curs_initscr.3X.html">endwin(3X)</A></B> and, after an <B>endwin</B>, by <B>doupdate</B>,  so
92        they normally are not called.
93
94
95 </PRE><H3><a name="h3-resetty_-savetty">resetty, savetty</a></H3><PRE>
96        The <B>resetty</B> and <B>savetty</B> routines save and restore the state of the ter-
97        minal modes.  <B>savetty</B> saves the current state in a buffer  and  <B>resetty</B>
98        restores the state to what it was at the last call to <B>savetty</B>.
99
100
101 </PRE><H3><a name="h3-getsyx">getsyx</a></H3><PRE>
102        The  <B>getsyx</B>  routine  returns  the  current  coordinates of the <I>virtual</I>
103        <I>screen</I> cursor in <I>y</I> and <I>x</I>.  If <B>leaveok</B> is currently <B>TRUE</B>, then <B>-1</B>,<B>-1</B>  is
104        returned.  If lines have been removed from the top of the screen, using
105        <B>ripoffline</B>, <I>y</I> and <I>x</I> include these lines; therefore, <I>y</I> and <I>x</I>  should  be
106        used only as arguments for <B>setsyx</B>.
107
108        Few applications will use this feature, most use <B>getyx</B> instead.
109
110
111 </PRE><H3><a name="h3-setsyx">setsyx</a></H3><PRE>
112        The  <B>setsyx</B> routine sets the <I>virtual</I> <I>screen</I> cursor to <I>y</I>, <I>x</I>.  If <I>y</I> and <I>x</I>
113        are both <B>-1</B>, then <B>leaveok</B> is set.  The two routines <B>getsyx</B>  and  <B>setsyx</B>
114        are  designed to be used by a library routine, which manipulates <B>curses</B>
115        windows but does not want to change the current position  of  the  pro-
116        gram's cursor.  The library routine would call <B>getsyx</B> at the beginning,
117        do its manipulation of its own windows, do a <B>wnoutrefresh</B> on  its  win-
118        dows, call <B>setsyx</B>, and then call <B>doupdate</B>.
119
120        Few applications will use this feature, most use <B>wmove</B> instead.
121
122
123 </PRE><H3><a name="h3-ripoffline">ripoffline</a></H3><PRE>
124        The  <B>ripoffline</B>  routine  provides  access  to  the  same facility that
125        <B>slk_init</B> [see <B><A HREF="curs_slk.3X.html">curs_slk(3X)</A></B>] uses to reduce  the  size  of  the  screen.
126        <B>ripoffline</B>  must be called before <B>initscr</B> or <B>newterm</B> is called, to pre-
127        pare these initial actions:
128
129        <B>o</B>   If <I>line</I> is positive, a line is removed from the top of <B>stdscr</B>.
130
131        <B>o</B>   if <I>line</I> is negative, a line is removed from the bottom.
132
133        When the resulting initialization is done inside <B>initscr</B>,  the  routine
134        <B>init</B> (supplied by the user) is called with two arguments:
135
136        <B>o</B>   a window pointer to the one-line window that has been allocated and
137
138        <B>o</B>   an integer with the number of columns in the window.
139
140        Inside  this  initialization  routine,  the integer variables <B>LINES</B> and
141        <B>COLS</B> (defined in <B>&lt;curses.h&gt;</B>) are not guaranteed to be accurate and <B>wre-</B>
142        <B>fresh</B> or <B>doupdate</B> must not be called.  It is allowable to call <B>wnoutre-</B>
143        <B>fresh</B> during the initialization routine.
144
145        <B>ripoffline</B> can be called up to five times  before  calling  <B>initscr</B>  or
146        <B>newterm</B>.
147
148
149 </PRE><H3><a name="h3-curs_set">curs_set</a></H3><PRE>
150        The  <B>curs_set</B>  routine  sets  the cursor state to invisible, normal, or
151        very visible for <B>visibility</B> equal to <B>0</B>, <B>1</B>, or <B>2</B> respectively.   If  the
152        terminal  supports  the <I>visibility</I> requested, the previous <I>cursor</I> state
153        is returned; otherwise, <B>ERR</B> is returned.
154
155
156 </PRE><H3><a name="h3-napms">napms</a></H3><PRE>
157        The <B>napms</B> routine is used to sleep for <I>ms</I> milliseconds.
158
159
160 </PRE><H2><a name="h2-RETURN-VALUE">RETURN VALUE</a></H2><PRE>
161        Except for <B>curs_set</B>, these routines always return <B>OK</B>.
162
163        <B>curs_set</B> returns the previous cursor state, or  <B>ERR</B>  if  the  requested
164        <I>visibility</I> is not supported.
165
166        X/Open defines no error conditions.  In this implementation
167
168        <B>def_prog_mode</B>, <B>def_shell_mode</B>, <B>reset_prog_mode</B>, <B>reset_shell_mode</B>
169             return an error if the terminal was not initialized, or if the I/O
170             call to obtain the terminal settings fails.
171
172        <B>ripoffline</B>
173             returns an error if the maximum number of ripped-off lines exceeds
174             the maximum (NRIPS = 5).
175
176
177 </PRE><H2><a name="h2-NOTES">NOTES</a></H2><PRE>
178        Note that <B>getsyx</B> is a macro, so <B>&amp;</B> is not necessary before the variables
179        <I>y</I> and <I>x</I>.
180
181        Older SVr4 man pages warn that the return value of  <B>curs_set</B>  "is  cur-
182        rently  incorrect".   This  implementation gets it right, but it may be
183        unwise to count on the correctness of the return value anywhere else.
184
185        Both ncurses and SVr4 will call <B>curs_set</B> in <B>endwin</B> if <B>curs_set</B> has been
186        called  to make the cursor other than normal, i.e., either invisible or
187        very visible.  There is no way for ncurses  to  determine  the  initial
188        cursor state to restore that.
189
190
191 </PRE><H2><a name="h2-PORTABILITY">PORTABILITY</a></H2><PRE>
192        The <I>virtual</I> <I>screen</I> functions <B>setsyx</B> and <B>getsyx</B> are not described in the
193        XSI Curses standard, Issue 4.  All other functions are as described  in
194        XSI Curses.
195
196        The  SVr4  documentation  describes  <B>setsyx</B> and <B>getsyx</B> as having return
197        type int.  This is misleading, as they are macros  with  no  documented
198        semantics for the return value.
199
200
201 </PRE><H2><a name="h2-SEE-ALSO">SEE ALSO</a></H2><PRE>
202        <B><A HREF="curses.3X.html">curses(3X)</A></B>,   <B><A HREF="curs_initscr.3X.html">curs_initscr(3X)</A></B>,   <B><A HREF="curs_outopts.3X.html">curs_outopts(3X)</A></B>,   <B><A HREF="curs_refresh.3X.html">curs_refresh(3X)</A></B>,
203        <B><A HREF="curs_scr_dump.3X.html">curs_scr_dump(3X)</A></B>, <B><A HREF="curs_slk.3X.html">curs_slk(3X)</A></B>, <B><A HREF="curs_variables.3X.html">curs_variables(3X)</A></B>.
204
205
206
207                                                                <B><A HREF="curs_kernel.3X.html">curs_kernel(3X)</A></B>
208 </PRE>
209 <div class="nav">
210 <ul>
211 <li><a href="#h2-NAME">NAME</a></li>
212 <li><a href="#h2-SYNOPSIS">SYNOPSIS</a></li>
213 <li><a href="#h2-DESCRIPTION">DESCRIPTION</a>
214 <ul>
215 <li><a href="#h3-def_prog_mode_-def_shell_mode">def_prog_mode, def_shell_mode</a></li>
216 <li><a href="#h3-reset_prog_mode_-reset_shell_mode">reset_prog_mode, reset_shell_mode</a></li>
217 <li><a href="#h3-resetty_-savetty">resetty, savetty</a></li>
218 <li><a href="#h3-getsyx">getsyx</a></li>
219 <li><a href="#h3-setsyx">setsyx</a></li>
220 <li><a href="#h3-ripoffline">ripoffline</a></li>
221 <li><a href="#h3-curs_set">curs_set</a></li>
222 <li><a href="#h3-napms">napms</a></li>
223 </ul>
224 </li>
225 <li><a href="#h2-RETURN-VALUE">RETURN VALUE</a></li>
226 <li><a href="#h2-NOTES">NOTES</a></li>
227 <li><a href="#h2-PORTABILITY">PORTABILITY</a></li>
228 <li><a href="#h2-SEE-ALSO">SEE ALSO</a></li>
229 </ul>
230 </div>
231 </BODY>
232 </HTML>