Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 1 | .\"*************************************************************************** |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 2 | .\" Copyright (c) 1998-2013,2015 Free Software Foundation, Inc. * |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 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 | .\" |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 29 | .\" Author: Thomas E. Dickey 1996-on |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 30 | .\" |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 31 | .\" $Id: resizeterm.3x,v 1.19 2015/06/06 23:38:18 tom Exp $ |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 32 | .TH resizeterm 3X "" |
| 33 | .SH NAME |
| 34 | \fBis_term_resized\fR, |
| 35 | \fBresize_term\fR, |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 36 | \fBresizeterm\fR \- change the curses terminal size |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 37 | .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 Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 46 | .PP |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 47 | This is an extension to the curses library. |
| 48 | It provides callers with a hook into the \fBncurses\fR data to resize windows, |
| 49 | primarily for use by programs running in an X Window terminal (e.g., xterm). |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 50 | .SS resizeterm |
| 51 | .PP |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 52 | The function \fBresizeterm\fR resizes the standard and current windows |
| 53 | to the specified dimensions, and adjusts other bookkeeping data used by |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 54 | the \fBncurses\fR library that record the window dimensions |
| 55 | such as the \fBLINES\fP and \fBCOLS\fP variables. |
| 56 | .SS resize_term |
| 57 | .PP |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 58 | Most of the work is done by the inner function \fBresize_term\fR. |
| 59 | The outer function \fBresizeterm\fR adds bookkeeping for the SIGWINCH handler. |
| 60 | When resizing the windows, |
| 61 | \fBresize_term\fR blank-fills the areas that are extended. |
| 62 | The calling application should fill in these areas with appropriate data. |
| 63 | The \fBresize_term\fR function attempts to resize all windows. |
| 64 | However, due to the calling convention of pads, |
| 65 | it is not possible to resize these |
| 66 | without additional interaction with the application. |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 67 | .SS is_term_resized |
| 68 | .PP |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 69 | A support function \fBis_term_resized\fR is provided so that applications |
| 70 | can check if the \fBresize_term\fR function would modify the window structures. |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 71 | It returns \fBTRUE\fP if the windows would be modified, and \fBFALSE\fP otherwise. |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 72 | .SH RETURN VALUE |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 73 | Except as noted, these functions return |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 74 | the integer \fBERR\fR upon failure and \fBOK\fR on success. |
| 75 | They will fail if either of the dimensions are less than or equal to zero, |
| 76 | or if an error occurs while (re)allocating memory for the windows. |
| 77 | .SH NOTES |
| 78 | While 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 |
| 80 | context where \fBmalloc\fR or \fBrealloc\fR may have been interrupted, |
| 81 | since it uses those functions. |
| 82 | .PP |
| 83 | If ncurses is configured to supply its own SIGWINCH handler, |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 84 | the \fBresizeterm\fR function \fBungetch\fP's a \fBKEY_RESIZE\fR which |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 85 | will be read on the next call to \fBgetch\fR. |
| 86 | This is used to alert an application that the screen size has changed, |
| 87 | and that it should repaint special features such as pads that cannot |
| 88 | be done automatically. |
| 89 | .PP |
| 90 | If the environment variables \fBLINES\fP or \fBCOLUMNS\fP are set, |
| 91 | this overrides the library's use of the window size obtained from |
| 92 | the operating system. |
| 93 | Thus, even if a SIGWINCH is received, |
| 94 | no screen size change may be recorded. |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 95 | .SH SEE ALSO |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 96 | \fBcurs_getch\fR(3X), |
| 97 | \fBcurs_variables\fR(3X), |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 98 | \fBwresize\fR(3X). |
| 99 | .SH AUTHOR |
| 100 | Thomas Dickey (from an equivalent function written in 1988 for BSD curses). |