1resizeterm(3X)                                                  resizeterm(3X)
2
3
4

NAME

6       is_term_resized,  resize_term,  resizeterm - change the curses terminal
7       size
8

SYNOPSIS

10       #include <curses.h>
11
12       bool is_term_resized(int lines, int columns);
13       int resize_term(int lines, int columns);
14       int resizeterm(int lines, int columns);
15

DESCRIPTION

17       This is an extension to the curses library.  It provides callers with a
18       hook into the ncurses data to resize windows, primarily for use by pro‐
19       grams running in an X Window terminal (e.g., xterm).
20
21   resizeterm
22       The function resizeterm resizes the standard and current windows to the
23       specified  dimensions,  and  adjusts other bookkeeping data used by the
24       ncurses library that record the window dimensions such as the LINES and
25       COLS variables.
26
27   resize_term
28       Most  of the work is done by the inner function resize_term.  The outer
29       function resizeterm adds bookkeeping for the  SIGWINCH  handler.   When
30       resizing  the  windows,  resize_term  blank-fills  the  areas  that are
31       extended.  The calling application should  fill  in  these  areas  with
32       appropriate data.  The resize_term function attempts to resize all win‐
33       dows.  However, due to the calling convention of pads, it is not possi‐
34       ble  to  resize  these without additional interaction with the applica‐
35       tion.
36
37   is_term_resized
38       A support function is_term_resized is provided so that applications can
39       check  if  the resize_term function would modify the window structures.
40       It returns TRUE if the windows would be modified, and FALSE otherwise.
41

RETURN VALUE

43       Except as noted, these functions return the integer  ERR  upon  failure
44       and OK on success.  They will fail if either of the dimensions are less
45       than or equal to zero, or if an error occurs while (re)allocating  mem‐
46       ory for the windows.
47

NOTES

49       While  these functions are intended to be used to support a signal han‐
50       dler (i.e., for SIGWINCH), care should be taken to avoid invoking  them
51       in  a  context where malloc or realloc may have been interrupted, since
52       it uses those functions.
53
54       If ncurses is configured to supply its own SIGWINCH handler,
55
56       ·   on receipt of a SIGWINCH, the handler sets a flag
57
58       ·   which is tested in wgetch(3X) and doupdate,
59
60       ·   in turn, calling the resizeterm function,
61
62       ·   which ungetch's a KEY_RESIZE which will be read on the next call to
63           wgetch.
64
65           The  KEY_RESIZE  alerts  an  application  that  the screen size has
66           changed, and that it should repaint special features such  as  pads
67           that cannot be done automatically.
68
69           Calling resizeterm or resize_term directly from a signal handler is
70           unsafe.  This indirect method is used to  provide  a  safe  way  to
71           resize the ncurses data structures.
72
73       If  the  environment variables LINES or COLUMNS are set, this overrides
74       the library's use of the window size obtained from the  operating  sys‐
75       tem.   Thus,  even if a SIGWINCH is received, no screen size change may
76       be recorded.
77

PORTABILITY

79       It is possible to resize the screen with SVr4 curses, by
80
81       ·   exiting curses with endwin(3X) and
82
83       ·   resuming using refresh(3X).
84
85       Doing that clears the screen and is visually distracting.
86
87       This extension of ncurses was introduced in mid-1995.  It  was  adopted
88       in NetBSD curses (2001) and PDCurses (2003).
89

SEE ALSO

91       curs_getch(3X), curs_variables(3X), wresize(3X).
92

AUTHOR

94       Thomas  Dickey  (from  an  equivalent  function written in 1988 for BSD
95       curses).
96
97
98
99                                                                resizeterm(3X)
Impressum