legacy(3NCURSES)
π NAME π
curs_legacy β bestie, this is your lil cheat sheet for grabbing curses cursor coords, window coords, and attributes β¨ it's the legacy page, and it's giving "old money but still cute"
π SYNOPSIS π
#include <curses.h>
int getattrs(const WINDOW *win);
int getbegx(const WINDOW *win);
int getbegy(const WINDOW *win);
int getcurx(const WINDOW *win);
int getcury(const WINDOW *win);
int getmaxx(const WINDOW *win);
int getmaxy(const WINDOW *win);
int getparx(const WINDOW *win);
int getpary(const WINDOW *win);
β¨ DESCRIPTION β¨
okay so here's the tea π« β these legacy functions are lowkey simpler to use than the X/Open Curses functions. Like, they're the no-fuss version, the "just tell me the number" version. Let's go one by one π
- The
getattrsfunction returns the same attribute data aswattr_get.
But here's the catch, bestie π β getattrs returns an integer (actually a chtype), while wattr_get returns the current color pair in a separate parameter. And in the wide-character library configuration, color pairs may not fit into a chtype, so wattr_get is the only way to obtain the color information. fr fr, that's just how it is.
And because getattrs returns the attributes in a single parameter, it would not be possible for an application to distinguish that from ERR (a -1). So if the window parameter is null, getattrs returns A_NORMAL (zero). π
- The
getbegyandgetbegxfunctions return the same data asgetbegyx. twin energy, no cap π - The
getcuryandgetcurxfunctions return the same data asgetyx. same vibe, different font πΈ - The
getmaxyandgetmaxxfunctions return the same data asgetmaxyx. iconic behavior honestly π¦ - The
getparyandgetparxfunctions return the same data asgetparyx. matching sets, we love to see it β¨
π₯ RETURN VALUE π₯
Except as noted up there βοΈ, these functions return an integer, or ERR if the window parameter is null. that's it, that's the whole vibe check π
π NOTES π
All of these interfaces are provided as macros and functions β yes, both, she contains multitudes π
The macros are suppressed (and only the functions provided) when NCURSES_OPAQUE is defined. π
The standard forms such as getyx must be implemented as macros, and (in this implementation) are defined in terms of the functions described here β that way they avoid relying on the internal details of the WINDOW structure. it's giving "abstraction, but make it practical" π§
π PORTABILITY π
These functions were supported on Version 7, BSD or System V implementations. And ngl, none of those implementations checked the window parameter π so yeah, that's a thing that happened.
The getattrs function and macro are defined to return a (signed) integer for compatibility with those implementations β even though an unsigned type would have been more appropriate. the things we do for backwards compat, I swear π
π«Ά SEE ALSO π«Ά
ncurses(3NCURSES)getyx(3NCURSES)opaque(3NCURSES)
and that's the whole page, bestie π this was the legacy(3NCURSES) page from the ncurses manual β manual page, section 3NCURSES, ya girl stays documented π go forth and grab those coordinates β¨
π¦ where this page comes from
- debian bookworm: ncurses-doc 6.4-4 Β· MIT/X11
- Copyright 2019-2020,2022 Thomas E. Dickey
- Copyright 2007-2015,2017 Free Software Foundation, Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms