overlay(3NCURSES)
β¨ overlay β the manual page, but make it make sense β¨
okay so bestie, we're in section 3NCURSES of the ncurses manual and today's topic is overlaying windows like the absolute main character you are π
π NAME π
overlay, overwrite, copywin β overlay curses windows and manipulate them π¦
πΈ SYNOPSIS πΈ
#include <curses.h>
int overlay(const WINDOW *srcwin, WINDOW *dstwin);
int overwrite(const WINDOW *srcwin, WINDOW *dstwin);
int copywin(const WINDOW *srcwin, WINDOW *dstwin, int sminrow,
int smincol, int dminrow, int dmincol, int dmaxrow,
int dmaxcol, int overlay);
π DESCRIPTION π
π«Ά overlay, overwrite
So the overlay and overwrite routines literally just plop srcwin on top of dstwin. That's the whole vibe.
And no, scrwin and dstwin do NOT have to be the same size, bestie β only the text where the two windows overlap gets copied. Slay.
The one (1) difference:
overlayis non-destructive β blanks are not copied πoverwriteis destructive π
π§ copywin
copywin is giving finer granularity of control over overlay and overwrite. Like, it's the deluxe version.
Just like in the prefresh routine, you specify a rectangle in the destination window:
- upper-left-ish corner:
(dminrow, dmincol) - other corner:
(dmaxrow, dmaxcol) - and the upper-left-corner coordinates of the source window:
(sminrow, smincol)
If the argument overlay is true, then the copying is non-destructive, exactly as in overlay. periodt β¨
π₯ RETURN VALUE π₯
These functions return OK on success and ERR on failure. no in-between, no grey area, it's giving binary π
In ncurses, they return ERR if
- either of the window pointers are null, or
- any part of the window would be placed off-screen.
literally if you yeet a window off the edge of the screen it's an ERR, be careful bestie π
π NOTES π
overlay and overwrite may be implemented as macros. iykyk π«Ά
π PORTABILITY π
X/Open Curses Issue 4 describes these functions. It specifies no error conditions for them. It adds const qualifiers to the arguments. It further specifies their behavior in the presence of characters with multibyte renditions β which is not yet supported in this implementation, ngl π
SVr4 describes a successful return value only as "an integer value other than ERR". iconic vagueness π
β SEE ALSO β
ncurses(3NCURSES)pad(3NCURSES)refresh(3NCURSES)
and that's the whole page, bestie π this was ncurses 6.6, dated 2025-01-18, and it's the overlay(3NCURSES) page β go forth and overlay responsibly, mwah πβ¨π¦
π¦ 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 2020-2024,2025 Thomas E. Dickey
- Copyright 1998-2013,2015 Free Software Foundation, Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms