Debian Codegraph @

upstream/opensuse-tumbleweed/man3/getyx.3ncurses

raw
1 .\"***************************************************************************
2 .\" Copyright 2020-2025,2026 Thomas E. Dickey *
3 .\" Copyright 1998-2007,2010 Free Software Foundation, Inc. *
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 .\"
30 .\" $Id: curs_getyx.3x,v 1.56 2026/03/14 19:44:20 tom Exp $
31 .TH getyx 3NCURSES 2026-03-14 "ncurses 6.6" "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 .
43 .SH NAME
44 \fB\%getyx\fP,
45 \fB\%getparyx\fP,
46 \fB\%getbegyx\fP,
47 \fB\%getmaxyx\fP \-
48 get \fIcurses\fR cursor and window coordinates
49 .SH SYNOPSIS
50 .nf
51 \fB#include <ncursesw/curses.h>
52 .PP
53 \fBvoid getyx(WINDOW *\fIwin\fP, int \fIy\fP, int \fIx\fP);
54 \fBvoid getbegyx(WINDOW *\fIwin\fP, int \fIy\fP, int \fIx\fP);
55 \fBvoid getmaxyx(WINDOW *\fIwin\fP, int \fIy\fP, int \fIx\fP);
56 .PP
57 \fBvoid getparyx(WINDOW *\fIwin\fP, int \fIy\fP, int \fIx\fP);
58 .fi
59 .SH DESCRIPTION
60 These macros obtain the cursor position and bounds information of a
61 .I curses
62 window
63 .IR win "."
64 .B \%getyx
65 stores
66 .IR win "'s"
67 cursor position in the variables
68 .I y
69 and
70 .IR x "."
71 .B \%getmaxyx
72 stores
73 .IR win "'s"
74 maximum valid line and column dimensions in
75 .I y
76 and
77 .IR x ","
78 respectively.
79 Those are one more than the corresponding maximum positions.
80 .B \%getbegyx
81 similarly stores the position of
82 .IR win "'s"
83 origin relative to that of the screen
84 (for
85 .BR stdscr ","
86 these coordinates are always
87 .BR 0 ")."
88 .PP
89 If
90 .I win
91 is a subwindow
92 (see \fB\%subwin\fP(3NCURSES)),
93 the
94 .B \%getparyx
95 macro places the coordinates of its origin relative to its parent window
96 into
97 .I y
98 and
99 .IR x ","
100 and
101 .B \-1
102 into both if it is not.
103 .SH RETURN VALUE
104 No return values are defined for macros.
105 Do not use them as the right-hand side of assignment statements.
106 .SH NOTES
107 All of these interfaces are implemented as macros.
108 An \*(``&\*('' operator is not necessary before the variables
109 .I y
110 and
111 .IR x "."
112 .SH PORTABILITY
113 These macros are described in X/Open Curses Issue\ 4.
114 .PP
115 .I \%ncurses
116 also provides functions
117 .IR \%getbegy ","
118 .IR \%getbegx ","
119 .IR \%getcury ","
120 .IR \%getcurx ","
121 .IR \%getmaxy ","
122 .IR \%getmaxx ","
123 .IR \%getpary ","
124 and
125 .I \%getparx
126 for compatibility with System\ V
127 .I curses
128 that were not standardized;
129 .\" even by SVID 4
130 see \fB\%legacy\fP(3NCURSES).
131 .PP
132 Although X/Open Curses does not address the issue,
133 many implementations expose members of the
134 .I \%WINDOW
135 structure containing values corresponding to these macros.
136 Do not rely on their availability;
137 some implementations make
138 .I \%WINDOW
139 opaque
140 (that is,
141 they do not allow direct access to its members).
142 .PP
143 Besides the problem of opaque structures,
144 the data stored in like-named members may not have values of the same
145 meaning across different implementations.
146 For example,
147 the values of
148 .I \%WINDOW._maxx
149 and
150 .I \%WINDOW._maxy
151 in
152 .I \%ncurses
153 have long
154 .\" (at least since its initial release, 1.8.1)
155 differed by one from some other implementations.
156 The
157 .I \%getmaxyx
158 macro hides this difference.
159 .SH HISTORY
160 4BSD (1980)
161 introduced
162 .IR \%getyx "."
163 .PP
164 SVr3 (1987)
165 added
166 .I \%getbegyx
167 and
168 .IR \%getmaxyx "."
169 SVr3.1 later that year supplied
170 .IR \%getparyx "."
171 .SH SEE ALSO
172 \fB\%ncurses\fP(3NCURSES),
173 \fB\%legacy\fP(3NCURSES),
174 \fB\%opaque\fP(3NCURSES)