curs_overlay(3X)
π NAME π
okay so bestie, welcome to curs_overlay β it's a page from the ncurses library-calls manual (that's the 3X section, iykyk), and it's all about three little functions: overlay, overwrite, and copywin. Their whole job? overlaying curses windows and manipulating them. That's it. That's the name. Slay. π
β¨ 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);
like, yes, they all return an int, and yes, they're all glued to <curses.h>. standard. π
πΈ DESCRIPTION πΈ
π¦ overlay, overwrite
So overlay and overwrite both take srcwin and slap it on top of dstwin. literally "here's my window, put it on your window." π«
And the tea is: scrwin and dstwin do not have to be the same size β like, they're not required to match at all. (also yes, that's scrwin in the original, a lil typo, we love her, she's the source window fr fr π). Only the text where the two windows actually overlap gets copied. Just the intersection. Nothing more.
The one thing that separates them:
overlayis non-destructive β blanks are not copied. β¨overwriteis destructive β blanks go through, no survivors. π
π§ copywin
copywin is the finer-granularity, main-character-energy version of the other two. It gives you way more control. Obsessed.
Same vibe as the prefresh routine: you specify a rectangle in the destination window β
(dminrow, dmincol)(dmaxrow, dmaxcol)
β and the upper-left-corner coordinates of the source window:
(sminrow, smincol)
And then: if the argument overlay is true, the copy is non-destructive, exactly like overlay. That's the whole switch. π«Ά
β RETURN VALUE β
These functions return OK on success and ERR on failure. Simple. Iconic.
In ncurses, they return ERR if:
- either of the window pointers are null, or
- any part of the window would be placed off-screen.
bestie please check your pointers, i am begging π
π NOTES π
overlay and overwrite may be implemented as macros. so like, don't get weird with them. lowkey important. π
π PORTABILITY π
X/Open Curses Issue 4 describes these functions. It specifies no error conditions for them. It adds const qualifiers to the arguments. And it further specifies their behavior in the presence of characters with multibyte renditions β which is not yet supported in this implementation, so, yeah, noted. π
SVr4 describes a successful return value only as βan integer value other than ERRβ. that's it. that's the whole description. the bar was on the floor and they left it there. π
π SEE ALSO π
curses(3X)curs_pad(3X)curs_refresh(3X)
and that's the page, bestie!! π«Ά this lil legend came from ncurses 6.6, dated 2025-01-18, and it's filed under curs_overlay(3X) β go forth and overlay responsibly β¨ππΈ
π¦ where this page comes from
- freebsd 14.5: base 14.5
- freebsd 15.1: base 15.1
- 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