blob: eadcecef2cadfe6dca773ef6342b08c570471d5b [file] [log] [blame]
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301.\"***************************************************************************
micky3879b9f5e72025-07-08 18:04:53 -04002.\" Copyright 2020-2023,2024 Thomas E. Dickey *
3.\" Copyright 1998-2007,2010 Free Software Foundation, Inc. *
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05304.\" *
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.\"
micky3879b9f5e72025-07-08 18:04:53 -040030.\" $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 Kachhape6a01f52011-07-20 11:45:59 +053043.SH NAME
micky3879b9f5e72025-07-08 18:04:53 -040044\fB\%getyx\fP,
45\fB\%getparyx\fP,
46\fB\%getbegyx\fP,
47\fB\%getmaxyx\fP \-
48get \fIcurses\fR cursor and window coordinates
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053049.SH SYNOPSIS
micky3879b9f5e72025-07-08 18:04:53 -040050.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 Kachhape6a01f52011-07-20 11:45:59 +053058.SH DESCRIPTION
micky3879b9f5e72025-07-08 18:04:53 -040059The \fB\%getyx\fP macro places the current cursor position
60of the given window in the two integer variables \fIy\fP and \fIx\fP.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053061.PP
micky3879b9f5e72025-07-08 18:04:53 -040062If \fIwin\fP is a subwindow, the \fB\%getparyx\fP macro places the beginning
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053063coordinates of the subwindow relative to the parent window into two integer
micky3879b9f5e72025-07-08 18:04:53 -040064variables \fIy\fP and \fIx\fP.
65Otherwise, \fB\-1\fP is placed into \fIy\fP and \fIx\fP.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053066.PP
micky3879b9f5e72025-07-08 18:04:53 -040067Like \fB\%getyx\fP, the \fB\%getbegyx\fP and \fB\%getmaxyx\fP macros store
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053068the current beginning coordinates and size of the specified window.
69.SH RETURN VALUE
70The return values of these macros are undefined (i.e.,
71they should not be used as the right-hand side of assignment statements).
72.SH NOTES
73All of these interfaces are macros.
micky3879b9f5e72025-07-08 18:04:53 -040074A \*(``&\*('' is not necessary before the variables \fIy\fP and \fIx\fP.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053075.SH PORTABILITY
76The
micky3879b9f5e72025-07-08 18:04:53 -040077\fB\%getyx\fP,
78\fB\%getparyx\fP,
79\fB\%getbegyx\fP and
80\fB\%getmaxyx\fP
81macros are described in X/Open Curses, Issue 4.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053082.PP
83This implementation also provides functions
micky3879b9f5e72025-07-08 18:04:53 -040084\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
92for compatibility with older versions of \fIcurses\fP;
93see \fB\%curs_legacy\fP(3X).
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053094.PP
95Although X/Open Curses does not address this,
micky3879b9f5e72025-07-08 18:04:53 -040096many implementations provide members of the \fB\%WINDOW\fP structure
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053097containing values corresponding to these macros.
micky3879b9f5e72025-07-08 18:04:53 -040098For best portability, do not rely on using the data in \fB\%WINDOW\fP,
99since some implementations make \fB\%WINDOW\fP opaque (do not allow
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530100direct use of its members).
101.PP
102Besides the problem of opaque structures,
103the data stored in like-named members may not have like-values in
104different implementations.
micky3879b9f5e72025-07-08 18:04:53 -0400105For example, the \fB\%WINDOW._maxx\fP and \fB\%WINDOW._maxy\fP values
106in \fI\%ncurses\fP have
107(at least since release 1.8.1)
108differed by one from some other implementations.
109The difference is hidden by means of the macro \fB\%getmaxyx\fP.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530110.SH SEE ALSO
micky3879b9f5e72025-07-08 18:04:53 -0400111\fB\%curses\fP(3X),
112\fB\%curs_legacy\fP(3X),
113\fB\%curs_opaque\fP(3X)