]> ncurses.scripts.mit.edu Git - ncurses.git/blob - man/resizeterm.3x
ncurses 6.1 - patch 20190427
[ncurses.git] / man / resizeterm.3x
1 .\"***************************************************************************
2 .\" Copyright (c) 1998-2017,2018 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.25 2018/07/28 22:20:54 tom Exp $
32 .TH resizeterm 3X ""
33 .de bP
34 .ie n  .IP \(bu 4
35 .el    .IP \(bu 2
36 ..
37 .SH NAME
38 \fBis_term_resized\fR,
39 \fBresize_term\fR,
40 \fBresizeterm\fR \- change the curses terminal size
41 .SH SYNOPSIS
42 \fB#include <curses.h>\fR
43 .sp
44 \fBbool is_term_resized(int lines, int columns);\fR
45 .br
46 \fBint resize_term(int lines, int columns);\fR
47 .br
48 \fBint resizeterm(int lines, int columns);\fR
49 .SH DESCRIPTION
50 .PP
51 This is an extension to the curses library.
52 It provides callers with a hook into the \fBncurses\fR data to resize windows,
53 primarily for use by programs running in an X Window terminal (e.g., xterm).
54 .SS resizeterm
55 .PP
56 The function \fBresizeterm\fR resizes the standard and current windows
57 to the specified dimensions, and adjusts other bookkeeping data used by
58 the \fBncurses\fR library that record the window dimensions
59 such as the \fBLINES\fP and \fBCOLS\fP variables.
60 .SS resize_term
61 .PP
62 Most of the work is done by the inner function \fBresize_term\fR.
63 The outer function \fBresizeterm\fR adds bookkeeping
64 for the \fBSIGWINCH\fP handler.
65 When resizing the windows,
66 \fBresize_term\fR blank-fills the areas that are extended.
67 The calling application should fill in these areas with appropriate data.
68 The \fBresize_term\fR function attempts to resize all windows.
69 However, due to the calling convention of pads,
70 it is not possible to resize these
71 without additional interaction with the application.
72 .SS is_term_resized
73 .PP
74 A support function \fBis_term_resized\fR is provided so that applications
75 can check if the \fBresize_term\fR function would modify the window structures.
76 It returns \fBTRUE\fP if the windows would be modified,
77 and \fBFALSE\fP otherwise.
78 .SH RETURN VALUE
79 Except as noted, these functions return
80 the integer \fBERR\fR upon failure and \fBOK\fR on success.
81 They will fail if either of the dimensions are less than or equal to zero,
82 or if an error occurs while (re)allocating memory for the windows.
83 .SH NOTES
84 While these functions are intended to be used to support a signal handler
85 (i.e., for \fBSIGWINCH\fP), care should be taken to avoid invoking them in a
86 context where \fBmalloc\fR or \fBrealloc\fR may have been interrupted,
87 since it uses those functions.
88 .PP
89 If ncurses is configured to supply its own \fBSIGWINCH\fP handler,
90 .bP
91 on receipt of a \fBSIGWINCH\fP, the handler sets a flag
92 .bP
93 which is tested in \fBwgetch\fP(3X) and \fBdoupdate\fP,
94 .bP
95 in turn, calling the \fBresizeterm\fR function,
96 .bP
97 which \fBungetch\fP's a \fBKEY_RESIZE\fR which
98 will be read on the next call to \fBwgetch\fR.
99 .IP
100 The \fBKEY_RESIZE\fP alerts an application that the screen size has changed,
101 and that it should repaint special features such as pads that cannot
102 be done automatically.
103 .IP
104 Calling \fBresizeterm\fP or \fBresize_term\fP
105 directly from a signal handler is unsafe.
106 This indirect method is used to provide a safe way to resize the ncurses
107 data structures.
108 .PP
109 If the environment variables \fBLINES\fP or \fBCOLUMNS\fP are set,
110 this overrides the library's use of the window size obtained from
111 the operating system.
112 Thus, even if a \fBSIGWINCH\fP is received,
113 no screen size change may be recorded.
114 .SH PORTABILITY
115 .PP
116 It is possible to resize the screen with SVr4 curses,
117 by
118 .bP
119 exiting curses with \fBendwin\fP(3X) and
120 .bP
121 resuming using \fBrefresh\fP(3X).
122 .PP
123 Doing that clears the screen and is visually distracting.
124 .PP
125 This extension of ncurses was introduced in mid-1995.
126 It was adopted in NetBSD curses (2001) and PDCurses (2003).
127 .SH SEE ALSO
128 \fBcurs_getch\fR(3X),
129 \fBcurs_variables\fR(3X),
130 \fBwresize\fR(3X).
131 .SH AUTHOR
132 Thomas Dickey (from an equivalent function written in 1988 for BSD curses).