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 getattrs function returns the same attribute data</> as wattr_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 getbegy and getbegx functions return the same data as getbegyx. periodt. ✨
  • the getcury and getcurx functions return the same data as getyx. πŸ’–
  • the getmaxy and getmaxx functions return the same data as getmaxyx. πŸŽ€
  • the getpary and getparx functions return the same data as getparyx. πŸ¦‹

πŸ‘‘ 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