blob: 177e7057ba8e87dd45e744d14fbece80f4a13b5e [file] [log] [blame]
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301.\"***************************************************************************
Steve Kondikae271bc2015-11-15 02:50:53 +01002.\" Copyright (c) 1998-2013,2015 Free Software Foundation, Inc. *
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05303.\" *
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.\"
Steve Kondikae271bc2015-11-15 02:50:53 +010029.\" Author: Thomas E. Dickey 1996-on
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053030.\"
Steve Kondikae271bc2015-11-15 02:50:53 +010031.\" $Id: resizeterm.3x,v 1.19 2015/06/06 23:38:18 tom Exp $
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053032.TH resizeterm 3X ""
33.SH NAME
34\fBis_term_resized\fR,
35\fBresize_term\fR,
Steve Kondikae271bc2015-11-15 02:50:53 +010036\fBresizeterm\fR \- change the curses terminal size
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053037.SH SYNOPSIS
38\fB#include <curses.h>\fR
39.sp
40\fBbool is_term_resized(int lines, int columns);\fR
41.br
42\fBint resize_term(int lines, int columns);\fR
43.br
44\fBint resizeterm(int lines, int columns);\fR
45.SH DESCRIPTION
Steve Kondikae271bc2015-11-15 02:50:53 +010046.PP
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053047This is an extension to the curses library.
48It provides callers with a hook into the \fBncurses\fR data to resize windows,
49primarily for use by programs running in an X Window terminal (e.g., xterm).
Steve Kondikae271bc2015-11-15 02:50:53 +010050.SS resizeterm
51.PP
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053052The function \fBresizeterm\fR resizes the standard and current windows
53to the specified dimensions, and adjusts other bookkeeping data used by
Steve Kondikae271bc2015-11-15 02:50:53 +010054the \fBncurses\fR library that record the window dimensions
55such as the \fBLINES\fP and \fBCOLS\fP variables.
56.SS resize_term
57.PP
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053058Most of the work is done by the inner function \fBresize_term\fR.
59The outer function \fBresizeterm\fR adds bookkeeping for the SIGWINCH handler.
60When resizing the windows,
61\fBresize_term\fR blank-fills the areas that are extended.
62The calling application should fill in these areas with appropriate data.
63The \fBresize_term\fR function attempts to resize all windows.
64However, due to the calling convention of pads,
65it is not possible to resize these
66without additional interaction with the application.
Steve Kondikae271bc2015-11-15 02:50:53 +010067.SS is_term_resized
68.PP
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053069A support function \fBis_term_resized\fR is provided so that applications
70can check if the \fBresize_term\fR function would modify the window structures.
Steve Kondikae271bc2015-11-15 02:50:53 +010071It returns \fBTRUE\fP if the windows would be modified, and \fBFALSE\fP otherwise.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053072.SH RETURN VALUE
Steve Kondikae271bc2015-11-15 02:50:53 +010073Except as noted, these functions return
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053074the integer \fBERR\fR upon failure and \fBOK\fR on success.
75They will fail if either of the dimensions are less than or equal to zero,
76or if an error occurs while (re)allocating memory for the windows.
77.SH NOTES
78While these functions are intended to be used to support a signal handler
79(i.e., for SIGWINCH), care should be taken to avoid invoking them in a
80context where \fBmalloc\fR or \fBrealloc\fR may have been interrupted,
81since it uses those functions.
82.PP
83If ncurses is configured to supply its own SIGWINCH handler,
Steve Kondikae271bc2015-11-15 02:50:53 +010084the \fBresizeterm\fR function \fBungetch\fP's a \fBKEY_RESIZE\fR which
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053085will be read on the next call to \fBgetch\fR.
86This is used to alert an application that the screen size has changed,
87and that it should repaint special features such as pads that cannot
88be done automatically.
89.PP
90If the environment variables \fBLINES\fP or \fBCOLUMNS\fP are set,
91this overrides the library's use of the window size obtained from
92the operating system.
93Thus, even if a SIGWINCH is received,
94no screen size change may be recorded.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053095.SH SEE ALSO
Steve Kondikae271bc2015-11-15 02:50:53 +010096\fBcurs_getch\fR(3X),
97\fBcurs_variables\fR(3X),
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053098\fBwresize\fR(3X).
99.SH AUTHOR
100Thomas Dickey (from an equivalent function written in 1988 for BSD curses).