]> ncurses.scripts.mit.edu Git - ncurses.git/blob - man/resizeterm.3x
ncurses 6.0 - patch 20160319
[ncurses.git] / man / resizeterm.3x
1 .\"***************************************************************************
2 .\" Copyright (c) 1998-2013,2015 Free Software Foundation, Inc.              *
3 .\"                                                                          *
4 .\" Permission is hereby granted, free of charge, to any person obtaining a  *
5 .\" copy of this software and associated documentation files (the            *
6 .\" "Software"), to deal in the Software without restriction, including      *
7 .\" without limitation the rights to use, copy, modify, merge, publish,      *
8 .\" distribute, distribute with modifications, sublicense, and/or sell       *
9 .\" copies of the Software, and to permit persons to whom the Software is    *
10 .\" furnished to do so, subject to the following conditions:                 *
11 .\"                                                                          *
12 .\" The above copyright notice and this permission notice shall be included  *
13 .\" in all copies or substantial portions of the Software.                   *
14 .\"                                                                          *
15 .\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
16 .\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
17 .\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
18 .\" IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
19 .\" DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
20 .\" OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
21 .\" THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
22 .\"                                                                          *
23 .\" Except as contained in this notice, the name(s) of the above copyright   *
24 .\" holders shall not be used in advertising or otherwise to promote the     *
25 .\" sale, use or other dealings in this Software without prior written       *
26 .\" authorization.                                                           *
27 .\"***************************************************************************
28 .\"
29 .\" Author: Thomas E. Dickey 1996-on
30 .\"
31 .\" $Id: resizeterm.3x,v 1.21 2015/09/26 19:55:32 tom Exp $
32 .TH resizeterm 3X ""
33 .de bP
34 .IP \(bu 4
35 ..
36 .SH NAME
37 \fBis_term_resized\fR,
38 \fBresize_term\fR,
39 \fBresizeterm\fR \- change the curses terminal size
40 .SH SYNOPSIS
41 \fB#include <curses.h>\fR
42 .sp
43 \fBbool is_term_resized(int lines, int columns);\fR
44 .br
45 \fBint resize_term(int lines, int columns);\fR
46 .br
47 \fBint resizeterm(int lines, int columns);\fR
48 .SH DESCRIPTION
49 .PP
50 This is an extension to the curses library.
51 It provides callers with a hook into the \fBncurses\fR data to resize windows,
52 primarily for use by programs running in an X Window terminal (e.g., xterm).
53 .SS resizeterm
54 .PP
55 The function \fBresizeterm\fR resizes the standard and current windows
56 to the specified dimensions, and adjusts other bookkeeping data used by
57 the \fBncurses\fR library that record the window dimensions
58 such as the \fBLINES\fP and \fBCOLS\fP variables.
59 .SS resize_term
60 .PP
61 Most of the work is done by the inner function \fBresize_term\fR.
62 The outer function \fBresizeterm\fR adds bookkeeping for the SIGWINCH handler.
63 When resizing the windows,
64 \fBresize_term\fR blank-fills the areas that are extended.
65 The calling application should fill in these areas with appropriate data.
66 The \fBresize_term\fR function attempts to resize all windows.
67 However, due to the calling convention of pads,
68 it is not possible to resize these
69 without additional interaction with the application.
70 .SS is_term_resized
71 .PP
72 A support function \fBis_term_resized\fR is provided so that applications
73 can check if the \fBresize_term\fR function would modify the window structures.
74 It returns \fBTRUE\fP if the windows would be modified, and \fBFALSE\fP otherwise.
75 .SH RETURN VALUE
76 Except as noted, these functions return
77 the integer \fBERR\fR upon failure and \fBOK\fR on success.
78 They will fail if either of the dimensions are less than or equal to zero,
79 or if an error occurs while (re)allocating memory for the windows.
80 .SH NOTES
81 While these functions are intended to be used to support a signal handler
82 (i.e., for SIGWINCH), care should be taken to avoid invoking them in a
83 context where \fBmalloc\fR or \fBrealloc\fR may have been interrupted,
84 since it uses those functions.
85 .PP
86 If ncurses is configured to supply its own SIGWINCH handler,
87 .bP
88 on receipt of a SIGWINCH, the handler sets a flag
89 .bP
90 which is tested in \fBwgetch\fP and \fBdoupdate\fP,
91 .bP
92 in turn, calling the \fBresizeterm\fR function,
93 .bP
94 which \fBungetch\fP's a \fBKEY_RESIZE\fR which
95 will be read on the next call to \fBwgetch\fR.
96 .IP
97 The \fBKEY_RESIZE\fP alerts an application that the screen size has changed,
98 and that it should repaint special features such as pads that cannot
99 be done automatically.
100 .IP
101 Calling \fBresizeterm\fP or \fBresize_term\fP
102 directly from a signal handler is unsafe.
103 This indirect method is used to provide a safe way to resize the ncurses
104 data structures.
105 .PP
106 If the environment variables \fBLINES\fP or \fBCOLUMNS\fP are set,
107 this overrides the library's use of the window size obtained from
108 the operating system.
109 Thus, even if a SIGWINCH is received,
110 no screen size change may be recorded.
111 .SH PORTABILITY
112 .PP
113 It is possible to resize the screen with SVr4 curses,
114 by
115 .bP
116 exiting curses with \fBendwin\fP(3X) and
117 .bP
118 resuming using \fBrefresh\fP(3X).
119 .PP
120 Doing that clears the screen and is visually distracting.
121 .PP
122 This extension of ncurses was introduced in mid-1995.
123 It was adopted in NetBSD curses (2001) and PDCurses (2003).
124 .SH SEE ALSO
125 \fBcurs_getch\fR(3X),
126 \fBcurs_variables\fR(3X),
127 \fBwresize\fR(3X).
128 .SH AUTHOR
129 Thomas Dickey (from an equivalent function written in 1988 for BSD curses).