1curs_kernel(3X)                                                curs_kernel(3X)
2
3
4

NAME

6       def_prog_mode, def_shell_mode, reset_prog_mode, reset_shell_mode,
7       resetty, savetty, getsyx, setsyx, ripoffline, curs_set, napms - low-
8       level curses routines
9

SYNOPSIS

11       #include <curses.h>
12
13       int def_prog_mode(void);
14       int def_shell_mode(void);
15
16       int reset_prog_mode(void);
17       int reset_shell_mode(void);
18
19       int resetty(void);
20       int savetty(void);
21
22       void getsyx(int y, int x);
23       void setsyx(int y, int x);
24
25       int ripoffline(int line, int (*init)(WINDOW *, int));
26       int curs_set(int visibility);
27       int napms(int ms);
28

DESCRIPTION

30       The following routines give low-level access to various curses capabil‐
31       ities.  These routines typically are used inside library routines.
32
33   def_prog_mode, def_shell_mode
34       The def_prog_mode and def_shell_mode routines save the current terminal
35       modes as the “program” (in curses) or “shell” (not in curses) state for
36       use by the reset_prog_mode and reset_shell_mode routines.  This is done
37       automatically  by initscr.  There is one such save area for each screen
38       context allocated by newterm.
39
40   reset_prog_mode, reset_shell_mode
41       The reset_prog_mode and reset_shell_mode routines restore the  terminal
42       to  “program”  (in curses) or “shell” (out of curses) state.  These are
43       done automatically by endwin(3X) and, after an endwin, by doupdate,  so
44       they normally are not called.
45
46   resetty, savetty
47       The resetty and savetty routines save and restore the state of the ter‐
48       minal modes.  savetty saves the current state in a buffer  and  resetty
49       restores the state to what it was at the last call to savetty.
50
51   getsyx
52       The  getsyx  routine  returns  the  current  coordinates of the virtual
53       screen cursor in y and x.  If leaveok is currently TRUE, then -1,-1  is
54       returned.  If lines have been removed from the top of the screen, using
55       ripoffline, y and x include these lines; therefore, y and x  should  be
56       used only as arguments for setsyx.
57
58       Few applications will use this feature, most use getyx instead.
59
60   setsyx
61       The  setsyx routine sets the virtual screen cursor to y, x.  If y and x
62       are both -1, then leaveok is set.  The two routines getsyx  and  setsyx
63       are  designed to be used by a library routine, which manipulates curses
64       windows but does not want to change the current position  of  the  pro‐
65       gram's cursor.  The library routine would call getsyx at the beginning,
66       do its manipulation of its own windows, do a wnoutrefresh on  its  win‐
67       dows, call setsyx, and then call doupdate.
68
69       Few applications will use this feature, most use wmove instead.
70
71   ripoffline
72       The  ripoffline  routine  provides  access  to  the  same facility that
73       slk_init [see curs_slk(3X)] uses to reduce  the  size  of  the  screen.
74       ripoffline  must be called before initscr or newterm is called, to pre‐
75       pare these initial actions:
76
77       •   If line is positive, a line is removed from the top of stdscr.
78
79       •   if line is negative, a line is removed from the bottom.
80
81       When the resulting initialization is done inside initscr,  the  routine
82       init (supplied by the user) is called with two arguments:
83
84       •   a window pointer to the one-line window that has been allocated and
85
86       •   an integer with the number of columns in the window.
87
88       Inside  this  initialization  routine,  the integer variables LINES and
89       COLS (defined in <curses.h>) are not guaranteed to be accurate and wre‐
90       fresh or doupdate must not be called.  It is allowable to call wnoutre‐
91       fresh during the initialization routine.
92
93       ripoffline can be called up to five times  before  calling  initscr  or
94       newterm.
95
96   curs_set
97       The  curs_set  routine  sets  the cursor state to invisible, normal, or
98       very visible for visibility equal to 0, 1, or 2 respectively.   If  the
99       terminal  supports  the visibility requested, the previous cursor state
100       is returned; otherwise, ERR is returned.
101
102   napms
103       The napms routine is used to sleep for ms milliseconds.
104

RETURN VALUE

106       Except for curs_set, these routines always return OK.
107
108       curs_set returns the previous cursor state, or  ERR  if  the  requested
109       visibility is not supported.
110
111       X/Open defines no error conditions.  In this implementation
112
113       def_prog_mode, def_shell_mode, reset_prog_mode, reset_shell_mode
114            return an error if the terminal was not initialized, or if the I/O
115            call to obtain the terminal settings fails.
116
117       ripoffline
118            returns an error if the maximum number of ripped-off lines exceeds
119            the maximum (NRIPS = 5).
120

NOTES

122       Note that getsyx is a macro, so & is not necessary before the variables
123       y and x.
124
125       Older SVr4 man pages warn that the return value of  curs_set  “is  cur‐
126       rently  incorrect”.   This  implementation gets it right, but it may be
127       unwise to count on the correctness of the return value anywhere else.
128
129       Both ncurses and SVr4 will call curs_set in endwin if curs_set has been
130       called  to make the cursor other than normal, i.e., either invisible or
131       very visible.  There is no way for ncurses  to  determine  the  initial
132       cursor state to restore that.
133

PORTABILITY

135       The virtual screen functions setsyx and getsyx are not described in the
136       XSI Curses standard, Issue 4.  All other functions are as described  in
137       XSI Curses.
138
139       The  SVr4  documentation  describes  setsyx and getsyx as having return
140       type int.  This is misleading, as they are macros  with  no  documented
141       semantics for the return value.
142

SEE ALSO

144       curses(3X),   curs_initscr(3X),   curs_outopts(3X),   curs_refresh(3X),
145       curs_scr_dump(3X), curs_slk(3X), curs_variables(3X).
146
147
148
149                                                               curs_kernel(3X)
Impressum