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       int reset_prog_mode(void);
16       int reset_shell_mode(void);
17       int resetty(void);
18       int savetty(void);
19       void getsyx(int y, int x);
20       void setsyx(int y, int x);
21       int ripoffline(int line, int (*init)(WINDOW *, int));
22       int curs_set(int visibility);
23       int napms(int ms);
24

DESCRIPTION

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

RETURN VALUE

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

NOTES

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

PORTABILITY

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

SEE ALSO

140       curses(3X),   curs_initscr(3X),   curs_outopts(3X),   curs_refresh(3X),
141       curs_scr_dump(3X), curs_slk(3X), curs_variables(3X).
142
143
144
145                                                               curs_kernel(3X)
Impressum