legacy(3NCURSES)
π legacy(3NCURSES) π
okay bestie, welcome to the legacy corner of the 3NCURSES manual β this is the group of lil functions that get your curses cursor and window coordinates, or your window attributes, and they've been around since forever. they're old, they're comfy, they're kinda iconic ngl π«Ά
β¨ 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 πΈ
so these legacy functions are literally just the simpler girlies compared to the X/Open curses functions. same vibes, less ceremony. here's the tea on each one π
- the
getattrsfunction returns the same attribute data</> aswattr_get.
BUT β and this is the plot twist β getattrs hands you back an int (which is actually a chtype), while wattr_get gives you the current color pair through a separate parameter</>. and in the wide-character library configuration</>, color pairs might not even fit into a chtype, so wattr_get is the only way to actually obtain the color info. so like, getattrs is cute but it's not giving you the full picture, yk? π
and because getattrs returns the attributes in a single parameter, there'd be no way for an application to tell that apart from ERR (a -1). π so heads up: if the window parameter is null, getattrs returns A_NORMAL (zero).
- the
getbegyandgetbegxfunctions return the same data asgetbegyx. periodt. β¨ - the
getcuryandgetcurxfunctions return the same data asgetyx. π - the
getmaxyandgetmaxxfunctions return the same data asgetmaxyx. π - the
getparyandgetparxfunctions return the same data asgetparyx. π¦
π RETURN VALUE π
except as noted (looking at you, getattrs π), these functions return an int, or ERR if the window parameter is null. no cap.
π PORTABILITY π
these functions were supported on Version 7, BSD or System V implementations. and the way that none of those implementations checked the window parameter? yeah. iconic in a chaotic way π
also 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. they said "we're keeping the legacy behavior" and honestly, respect. π
π«Ά SEE ALSO π«Ά
ncurses(3NCURSES)getyx(3NCURSES)opaque(3NCURSES)
k that's the whole page bestie, go forth and get those coordinates π
β¨ this was ncurses 6.6, dated 2025-02-15, and it's the legacy(3NCURSES) manual β mwah, love u, bye ππ
π¦ where this page comes from
- ubuntu resolute: ncurses-doc 6.6+20251231-1 Β· MIT/X11
- ubuntu stonking: ncurses-doc 6.6+20260608-2 Β· MIT/X11
- Copyright 2019-2024,2025 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