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   setsyx
55       The  setsyx routine sets the virtual screen cursor to y, x.  If y and x
56       are both -1, then leaveok is set.  The two routines getsyx  and  setsyx
57       are  designed to be used by a library routine, which manipulates curses
58       windows but does not want to change the current position  of  the  pro‐
59       gram's cursor.  The library routine would call getsyx at the beginning,
60       do its manipulation of its own windows, do a wnoutrefresh on  its  win‐
61       dows, call setsyx, and then call doupdate.
62
63   ripoffline
64       The  ripoffline  routine  provides  access  to  the  same facility that
65       slk_init [see curs_slk(3X)] uses to reduce  the  size  of  the  screen.
66       ripoffline  must be called before initscr or newterm is called, to pre‐
67       pare these initial actions:
68
69       ·   If line is positive, a line is removed from the top of stdscr.
70
71       ·   if line is negative, a line is removed from the bottom.
72
73       When the resulting initialization is done inside initscr,  the  routine
74       init (supplied by the user) is called with two arguments:
75
76       ·   a window pointer to the one-line window that has been allocated and
77
78       ·   an integer with the number of columns in the window.
79
80       Inside  this  initialization  routine,  the integer variables LINES and
81       COLS (defined in <curses.h>) are not guaranteed to be accurate and wre‐
82       fresh or doupdate must not be called.  It is allowable to call wnoutre‐
83       fresh during the initialization routine.
84
85       ripoffline can be called up to five times  before  calling  initscr  or
86       newterm.
87
88   curs_set
89       The  curs_set  routine  sets  the cursor state to invisible, normal, or
90       very visible for visibility equal to 0, 1, or 2 respectively.   If  the
91       terminal  supports  the visibility requested, the previous cursor state
92       is returned; otherwise, ERR is returned.
93
94   napms
95       The napms routine is used to sleep for ms milliseconds.
96

RETURN VALUE

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

NOTES

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

PORTABILITY

127       The  functions  setsyx  and  getsyx are not described in the XSI Curses
128       standard, Issue 4.  All other functions are as described in XSI Curses.
129
130       The SVr4 documentation describes setsyx and  getsyx  as  having  return
131       type int. This is misleading, as they are macros with no documented se‐
132       mantics for the return value.
133

SEE ALSO

135       curses(3X),   curs_initscr(3X),   curs_outopts(3X),   curs_refresh(3X),
136       curs_scr_dump(3X), curs_slk(3X), curs_variables(3X).
137
138
139
140                                                               curs_kernel(3X)
Impressum