resetty, savetty, getsyx, setsyx, ripoffline, curs_set, napms - low-
level curses routines
void getsyx(int y, int x);
void setsyx(int y, int x);
int ripoffline(int line, int (*init)(WINDOW *, int));
int curs_set(int visibility);
int napms(int ms);
The following routines give low-level access to various curses capabil-
ities. Theses routines typically are used inside library routines.
The def_prog_mode and def_shell_mode routines save the current terminal
modes as the "program" (in curses) or "shell" (not in curses) state for
use by the reset_prog_mode and reset_shell_mode routines. This is done
automatically by initscr. There is one such save area for each screen
context allocated by newterm().
The reset_prog_mode and reset_shell_mode routines restore the terminal
to "program" (in curses) or "shell" (out of curses) state. These are
done automatically by endwin and, after an endwin, by doupdate, so they
normally are not called.
The resetty and savetty routines save and restore the state of the ter-
minal modes. savetty saves the current state in a buffer and resetty
restores the state to what it was at the last call to savetty.
The getsyx routine returns the current coordinates of the virtual
screen cursor in y and x. If leaveok is currently TRUE, then -1,-1 is
returned. If lines have been removed from the top of the screen, using
ripoffline, y and x include these lines; therefore, y and x should be
used only as arguments for setsyx.
The setsyx routine sets the virtual screen cursor to y, x. If y and x
are both -1, then leaveok is set. The two routines getsyx and setsyx
are designed to be used by a library routine, which manipulates curses
windows but does not want to change the current position of the pro-
gram's cursor. The library routine would call getsyx at the beginning,
do its manipulation of its own windows, do a wnoutrefresh on its win-
dows, call setsyx, and then call doupdate.
The ripoffline routine provides access to the same facility that
slk_init [see slk(3NCURSES)] uses to reduce the size of the screen.
ripoffline must be called before initscr or newterm is called. If line
The curs_set routine sets the cursor state is set to invisible, normal,
or very visible for visibility equal to 0, 1, or 2 respectively. If
the terminal supports the visibility requested, the previous cursor
state is returned; otherwise, ERR is returned.
The napms routine is used to sleep for ms milliseconds.
Except for curs_set, these routines always return OK.
curs_set returns the previous cursor state, or ERR if the requested
visibility is not supported.
X/Open defines no error conditions. In this implementation
def_prog_mode, def_shell_mode, reset_prog_mode, reset_shell_mode
return an error if the terminal was not initialized, or if
the I/O call to obtain the terminal settings fails.
returns an error if the maximum number of ripped-off lines
exceeds the maximum (NRIPS = 5).
Note that getsyx is a macro, so & is not necessary before the variables
y and x.
Older SVr4 man pages warn that the return value of curs_set "is cur-
rently incorrect". This implementation gets it right, but it may be
unwise to count on the correctness of the return value anywhere else.
Both ncurses and SVr4 will call curs_set in endwin if curs_set has been
called to make the cursor other than normal, i.e., either invisible or
very visible. There is no way for ncurses to determine the initial
cursor state to restore that.
The functions setsyx and getsyx are not described in the XSI Curses
standard, Issue 4. All other functions are as described in XSI Curses.
The SVr4 documentation describes setsyx and getsyx as having return
type int. This is misleading, as they are macros with no documented se-
mantics for the return value.
ncurses(3NCURSES), initscr(3NCURSES), outopts(3NCURSES), re-
fresh(3NCURSES), scr_dump(3NCURSES), slk(3NCURSES)
Man Pages Copyright Respective Owners. Site Copyright (C) 1994 - 2013
All Rights Reserved.