curs_touch(3X)
β¨ curs_touch β the manual page for curs_touch(3X) β¨
okay bestie, sit down, hydrate, because we're talking about curs_touch(3X), a genuine library call from the ncurses girlies π
and honestly? it's giving "who touched my window" in the best way possible.
πΈ NAME πΈ
touchwin, touchline, untouchwin, wtouchln, is_linetouched, is_wintouched β the whole squad that controls terminal output refresh in a curses window π«Ά
β¨ SYNOPSIS β¨
#include <curses.h>
int touchline(WINDOW *win, int start, int count);
int touchwin(WINDOW *win);
int wtouchln(WINDOW *win, int y, int n, int changed);
int untouchwin(WINDOW *win);
bool is_linetouched(WINDOW *win, int line);
bool is_wintouched(WINDOW *win);
π DESCRIPTION π
so here's the tea, bestie β
The touchwin and touchline routines throw away all optimization information about which parts of the window have been touched, by pretending that the entire window has been drawn on. iconic behavior, honestly. this is sometimes necessary when you're using overlapping windows, because a change to one window affects the other window, but the records of which lines have been changed in the other window do not reflect the change. rude of them, but okay.
The touchline routine only pretends that count lines have been changed, beginning with line start. a little more chill, a little more precise π
The untouchwin routine marks all lines in the window as unchanged since the last call to wrefresh. it's the "no thoughts, head empty, nothing happened here" of curses functions.
The wtouchln routine makes n lines in the window, starting at line y, look as if they have (changed=1) or have not (changed=0) been changed since the last call to wrefresh. you're literally gaslighting the window, and it's working β¨
The is_linetouched and is_wintouched routines return TRUE if the specified line/window was modified since the last call to wrefresh; otherwise they return FALSE. and plot twist β is_linetouched also returns ERR if line is not valid for the given window. drama! π
π₯ RETURN VALUE π₯
Functions returning integers return ERR upon failure and OK upon success. the classic duo. the Sam and Frodo of curses.
In ncurses, specifically:
is_linetouched- returns
ERRif the window pointer is null, or if the line number is outside the window boundaries. - The constant
ERRis distinct fromTRUEandFALSE, which are the normal return values of this function. Because the function returns abool, returningERR(which is neitherTRUEnorFALSE) may not be supported by the compiler. so likeβ¦ that's a whole situation π« - To provide error-checking and also match the X/Open function prototype, the
ERRis provided by a macro namedis_linetouched. The actual function returnsFALSEwhen it detects an error. sneaky but slay.
- returns
wtouchln- returns
ERRif the window pointer is null, or if the line number is outside the window boundaries.
- returns
π¦ NOTES π¦
All of these functions except wtouchln may be implemented as macros. so don't come for them if they're not "real" functions, bestie, that's just how they roll π
π PORTABILITY π
X/Open Curses Issue 4 describes these functions. It specifies no error conditions for them. so like, do what you want, I guess π
SVr4 describes a successful return value β except where "otherwise noted" β as "an integer value other than ERR".
SVr4 does not check win to ensure that it is not a null pointer. not it being reckless π
π HISTORY π
- SVr2 (1984) introduced
touchwin. a legend was born π - SVr3 (1987) added
touchline. SVr3.1 later that year suppliedis_linetouched,is_wintouched,untouchwin, andwtouchln. the whole crew assembled β¨
π SEE ALSO π
curses(3X)curs_refresh(3X)curs_variables(3X)
and that's the whole page, bestie!! this was curs_touch(3X) from ncurses 6.6, dated 2025-01-18 π«Ά go forth and touch your windows (affectionately), you absolute main character πβ¨πΈ
π¦ where this page comes from
- alpine 3.24: ncurses-doc 6.6_p20260516-r0 Β· X11
- arch rolling: ncurses 6.6-2 Β· MIT-open-group
- fedora 44: ncurses-devel 6.6-1.fc44 Β· MIT-open-group
- fedora 44: ncurses-devel 6.6-1.fc44 Β· MIT-open-group
- Copyright 2018-2024,2025 Thomas E. Dickey
- Copyright 1998-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