]> ncurses.scripts.mit.edu Git - ncurses.git/blob - man/curs_getyx.3x
ncurses 5.9 - patch 20140809
[ncurses.git] / man / curs_getyx.3x
1 .\"***************************************************************************
2 .\" Copyright (c) 1998-2007,2010 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 .\" $Id: curs_getyx.3x,v 1.18 2010/12/04 18:36:44 tom Exp $
30 .TH curs_getyx 3X ""
31 .SH NAME
32 \fBgetyx\fR,
33 \fBgetparyx\fR,
34 \fBgetbegyx\fR,
35 \fBgetmaxyx\fR \- get \fBcurses\fR cursor and window coordinates
36 .SH SYNOPSIS
37 \fB#include <curses.h>\fR
38 .sp
39 \fBvoid getyx(WINDOW *win, int y, int x);\fR
40 .br
41 \fBvoid getparyx(WINDOW *win, int y, int x);\fR
42 .br
43 \fBvoid getbegyx(WINDOW *win, int y, int x);\fR
44 .br
45 \fBvoid getmaxyx(WINDOW *win, int y, int x);\fR
46 .br
47 .SH DESCRIPTION
48 The \fBgetyx\fR macro places the current cursor position of the given window in
49 the two integer variables \fIy\fR and \fIx\fR.
50 .PP
51 If \fIwin\fR is a subwindow, the \fBgetparyx\fR macro places the beginning
52 coordinates of the subwindow relative to the parent window into two integer
53 variables \fIy\fR and \fIx\fR.
54 Otherwise, \fB\-1\fR is placed into \fIy\fR and \fIx\fR.
55 .PP
56 Like \fBgetyx\fR, the \fBgetbegyx\fR and \fBgetmaxyx\fR macros store
57 the current beginning coordinates and size of the specified window.
58 .SH RETURN VALUE
59 The return values of these macros are undefined (i.e.,
60 they should not be used as the right-hand side of assignment statements).
61 .SH NOTES
62 All of these interfaces are macros.
63 A "\fB&\fR" is not necessary before the variables \fIy\fR and \fIx\fR.
64 .SH PORTABILITY
65 The
66 \fBgetyx\fR,
67 \fBgetparyx\fR,
68 \fBgetbegyx\fR and
69 \fBgetmaxyx\fR
70 macros are described in the XSI Curses standard, Issue 4.
71 .PP
72 This implementation also provides functions
73 \fBgetbegx\fR,
74 \fBgetbegy\fR,
75 \fBgetcurx\fR,
76 \fBgetcury\fR,
77 \fBgetmaxx\fR,
78 \fBgetmaxy\fR,
79 \fBgetparx\fR and
80 \fBgetpary\fR
81 for compatibility with older versions of curses.
82 .PP
83 Although X/Open Curses does not address this,
84 many implementations provide members of the WINDOW structure
85 containing values corresponding to these macros.
86 For best portability, do not rely on using the data in WINDOW,
87 since some implementations make WINDOW opaque (do not allow
88 direct use of its members).
89 .PP
90 Besides the problem of opaque structures,
91 the data stored in like-named members may not have like-values in
92 different implementations.
93 For example, the WINDOW._maxx and WINDOW._maxy values in ncurses
94 have (at least since release 1.8.1) differed by one from some
95 other implementations.
96 The difference is hidden by means of the macro \fBgetmaxyx\fP.
97 .SH SEE ALSO
98 \fBcurses\fR(3X),
99 \fBcurs_legacy\fR(3X),
100 \fBcurs_opaque\fR(3X)