legacy(3NCURSES)

πŸ“¦
version 6.4 Β· 2 versions
, in debian bookworm

πŸ’– 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 getattrs function returns the same attribute data as wattr_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 getbegy and getbegx functions return the same data as getbegyx. twin energy, no cap πŸ‘‘
  • The getcury and getcurx functions return the same data as getyx. same vibe, different font 🌸
  • The getmaxy and getmaxx functions return the same data as getmaxyx. iconic behavior honestly πŸ¦‹
  • The getpary and getparx functions return the same data as getparyx. 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
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms