1resizeterm(3X) resizeterm(3X)
2
3
4
6 is_term_resized, resize_term, resizeterm - change the curses terminal
7 size
8
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
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). The function
20 resizeterm resizes the standard and current windows to the specified
21 dimensions, and adjusts other bookkeeping data used by the ncurses
22 library that record the window dimensions.
23
24 Most of the work is done by the inner function resize_term. The outer
25 function resizeterm adds bookkeeping for the SIGWINCH handler. When
26 resizing the windows, resize_term blank-fills the areas that are
27 extended. The calling application should fill in these areas with
28 appropriate data. The resize_term function attempts to resize all win‐
29 dows. However, due to the calling convention of pads, it is not possi‐
30 ble to resize these without additional interaction with the applica‐
31 tion.
32
33 A support function is_term_resized is provided so that applications can
34 check if the resize_term function would modify the window structures.
35 It returns TRUE if the windows would be modified, and FALSE otherwise.
36
38 Except as notes, these function return the integer ERR upon failure and
39 OK on success. They will fail if either of the dimensions are less
40 than or equal to zero, or if an error occurs while (re)allocating mem‐
41 ory for the windows.
42
44 While these functions are intended to be used to support a signal han‐
45 dler (i.e., for SIGWINCH), care should be taken to avoid invoking them
46 in a context where malloc or realloc may have been interrupted, since
47 it uses those functions.
48
49 If ncurses is configured to supply its own SIGWINCH handler, the
50 resizeterm function ungetch's a KEY_RESIZE which will be read on the
51 next call to getch. This is used to alert an application that the
52 screen size has changed, and that it should repaint special features
53 such as pads that cannot be done automatically.
54
55 If the environment variables LINES or COLUMNS are set, this overrides
56 the library's use of the window size obtained from the operating sys‐
57 tem. Thus, even if a SIGWINCH is received, no screen size change may
58 be recorded. In that case, no KEY_RESIZE is queued for the next call
59 to getch; an ERR will be returned instead.
60
62 wresize(3X).
63
65 Thomas Dickey (from an equivalent function written in 1988 for BSD
66 curses).
67
68
69
70 resizeterm(3X)