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