curs_getyx(3X)
π NAME π
okay bestie, welcome to curs_getyx(3X) β the Library calls page that's literally all about grabbing cursor and window coordinates. The star lineup is getyx, getparyx, getbegyx, and getmaxyx, and their whole job is: get curses cursor and window coordinates. no cap π
getyx,getparyx,getbegyx,getmaxyxβ get curses cursor and window coordinates.
β¨ SYNOPSIS β¨
#include <curses.h>
void getyx(WINDOW *win, int y, int x);
void getbegyx(WINDOW *win, int y, int x);
void getmaxyx(WINDOW *win, int y, int x);
void getparyx(WINDOW *win, int y, int x);
π¦ DESCRIPTION π¦
These macros are your little coordinate besties for a curses window, win. They obtain the cursor position and bounds information of it, and honestly they ate:
getyxβ storeswin's cursor position in the variablesyandx.getmaxyxβ storeswin's maximum valid line and column dimensions inyandx, respectively. Those are one more than the corresponding maximum positions.getbegyxβ similarly stores the position ofwin's origin relative to that of the screen (forstdscr, these coordinates are always0).getparyxβ ifwinis a subwindow (seesubwin(3X)), this macro places the coordinates of its origin relative to its parent window intoyandx, and-1into both if it is not.
π RETURN VALUE π
π¨ bestie, no return values are defined for macros. Do not use them as the right-hand side of assignment statements. that's the whole warning, periodt.
π NOTES π
All of these interfaces are implemented as macros. An & operator is not necessary before the variables y and x. the way that saves you from typing one whole character πβ¨
π PORTABILITY π
- These macros are described in X/Open Curses Issue 4.
ncursesalso provides functionsgetbegy,getbegx,getcury,getcurx,getmaxy,getmaxx,getpary, andgetparxfor compatibility with System V curses that were not standardized; seecurs_legacy(3X).- Although X/Open Curses does not address the issue, many implementations expose members of the
WINDOWstructure containing values corresponding to these macros. Do not rely on their availability; some implementations makeWINDOWopaque (that is, they do not allow direct access to its members). - Besides the problem of opaque structures, the data stored in like-named members may not have values of the same meaning across different implementations. For example, the values of
WINDOW._maxxandWINDOW._maxyinncurseshave long differed by one from some other implementations. Thegetmaxyxmacro hides this difference.
lowkey iconic that one macro is out here hiding implementation drama for you π«Ά
π HISTORY π
4BSD(1980) introducedgetyx.SVr3(1987) addedgetbegyxandgetmaxyx.SVr3.1later that year suppliedgetparyx.
π SEE ALSO π
curses(3X)curs_legacy(3X)curs_opaque(3X)
π that's the whole page, bestie β brought to you by ncurses 6.6, dated 2026-03-14, and filed under curs_getyx(3X). mwah π
β¨
π¦ where this page comes from
- alpine 3.24: ncurses-doc 6.6_p20260516-r0 Β· X11
- Copyright 2020-2025,2026 Thomas E. Dickey
- Copyright 1998-2007,2010 Free Software Foundation, Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms