Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 1 | .\"*************************************************************************** |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 2 | .\" Copyright 2020-2023,2024 Thomas E. Dickey * |
| 3 | .\" Copyright 1998-2007,2010 Free Software Foundation, Inc. * |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 4 | .\" * |
| 5 | .\" Permission is hereby granted, free of charge, to any person obtaining a * |
| 6 | .\" copy of this software and associated documentation files (the * |
| 7 | .\" "Software"), to deal in the Software without restriction, including * |
| 8 | .\" without limitation the rights to use, copy, modify, merge, publish, * |
| 9 | .\" distribute, distribute with modifications, sublicense, and/or sell * |
| 10 | .\" copies of the Software, and to permit persons to whom the Software is * |
| 11 | .\" furnished to do so, subject to the following conditions: * |
| 12 | .\" * |
| 13 | .\" The above copyright notice and this permission notice shall be included * |
| 14 | .\" in all copies or substantial portions of the Software. * |
| 15 | .\" * |
| 16 | .\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * |
| 17 | .\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * |
| 18 | .\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * |
| 19 | .\" IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * |
| 20 | .\" DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * |
| 21 | .\" OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * |
| 22 | .\" THE USE OR OTHER DEALINGS IN THE SOFTWARE. * |
| 23 | .\" * |
| 24 | .\" Except as contained in this notice, the name(s) of the above copyright * |
| 25 | .\" holders shall not be used in advertising or otherwise to promote the * |
| 26 | .\" sale, use or other dealings in this Software without prior written * |
| 27 | .\" authorization. * |
| 28 | .\"*************************************************************************** |
| 29 | .\" |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 30 | .\" $Id: curs_getyx.3x,v 1.44 2024/04/20 21:20:07 tom Exp $ |
| 31 | .TH curs_getyx 3X 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" |
| 32 | .ie \n(.g \{\ |
| 33 | .ds `` \(lq |
| 34 | .ds '' \(rq |
| 35 | .\} |
| 36 | .el \{\ |
| 37 | .ie t .ds `` `` |
| 38 | .el .ds `` "" |
| 39 | .ie t .ds '' '' |
| 40 | .el .ds '' "" |
| 41 | .\} |
| 42 | . |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 43 | .SH NAME |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 44 | \fB\%getyx\fP, |
| 45 | \fB\%getparyx\fP, |
| 46 | \fB\%getbegyx\fP, |
| 47 | \fB\%getmaxyx\fP \- |
| 48 | get \fIcurses\fR cursor and window coordinates |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 49 | .SH SYNOPSIS |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 50 | .nf |
| 51 | \fB#include <curses.h> |
| 52 | .PP |
| 53 | \fBvoid getyx(WINDOW *\fIwin\fP, int \fIy\fP, int \fIx\fP); |
| 54 | \fBvoid getparyx(WINDOW *\fIwin\fP, int \fIy\fP, int \fIx\fP); |
| 55 | \fBvoid getbegyx(WINDOW *\fIwin\fP, int \fIy\fP, int \fIx\fP); |
| 56 | \fBvoid getmaxyx(WINDOW *\fIwin\fP, int \fIy\fP, int \fIx\fP); |
| 57 | .fi |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 58 | .SH DESCRIPTION |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 59 | The \fB\%getyx\fP macro places the current cursor position |
| 60 | of the given window in the two integer variables \fIy\fP and \fIx\fP. |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 61 | .PP |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 62 | If \fIwin\fP is a subwindow, the \fB\%getparyx\fP macro places the beginning |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 63 | coordinates of the subwindow relative to the parent window into two integer |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 64 | variables \fIy\fP and \fIx\fP. |
| 65 | Otherwise, \fB\-1\fP is placed into \fIy\fP and \fIx\fP. |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 66 | .PP |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 67 | Like \fB\%getyx\fP, the \fB\%getbegyx\fP and \fB\%getmaxyx\fP macros store |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 68 | the current beginning coordinates and size of the specified window. |
| 69 | .SH RETURN VALUE |
| 70 | The return values of these macros are undefined (i.e., |
| 71 | they should not be used as the right-hand side of assignment statements). |
| 72 | .SH NOTES |
| 73 | All of these interfaces are macros. |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 74 | A \*(``&\*('' is not necessary before the variables \fIy\fP and \fIx\fP. |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 75 | .SH PORTABILITY |
| 76 | The |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 77 | \fB\%getyx\fP, |
| 78 | \fB\%getparyx\fP, |
| 79 | \fB\%getbegyx\fP and |
| 80 | \fB\%getmaxyx\fP |
| 81 | macros are described in X/Open Curses, Issue 4. |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 82 | .PP |
| 83 | This implementation also provides functions |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 84 | \fB\%getbegx\fP, |
| 85 | \fB\%getbegy\fP, |
| 86 | \fB\%getcurx\fP, |
| 87 | \fB\%getcury\fP, |
| 88 | \fB\%getmaxx\fP, |
| 89 | \fB\%getmaxy\fP, |
| 90 | \fB\%getparx\fP and |
| 91 | \fB\%getpary\fP |
| 92 | for compatibility with older versions of \fIcurses\fP; |
| 93 | see \fB\%curs_legacy\fP(3X). |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 94 | .PP |
| 95 | Although X/Open Curses does not address this, |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 96 | many implementations provide members of the \fB\%WINDOW\fP structure |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 97 | containing values corresponding to these macros. |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 98 | For best portability, do not rely on using the data in \fB\%WINDOW\fP, |
| 99 | since some implementations make \fB\%WINDOW\fP opaque (do not allow |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 100 | direct use of its members). |
| 101 | .PP |
| 102 | Besides the problem of opaque structures, |
| 103 | the data stored in like-named members may not have like-values in |
| 104 | different implementations. |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 105 | For example, the \fB\%WINDOW._maxx\fP and \fB\%WINDOW._maxy\fP values |
| 106 | in \fI\%ncurses\fP have |
| 107 | (at least since release 1.8.1) |
| 108 | differed by one from some other implementations. |
| 109 | The difference is hidden by means of the macro \fB\%getmaxyx\fP. |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 110 | .SH SEE ALSO |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 111 | \fB\%curses\fP(3X), |
| 112 | \fB\%curs_legacy\fP(3X), |
| 113 | \fB\%curs_opaque\fP(3X) |