.\" authorization. *
.\"***************************************************************************
.\"
-.\" $Id: curs_get_wch.3x,v 1.36 2024/03/23 20:00:03 tom Exp $
-.TH curs_get_wch 3X 2024-03-23 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls"
+.\" $Id: curs_get_wch.3x,v 1.41 2024/05/11 20:39:53 tom Exp $
+.TH curs_get_wch 3X 2024-05-11 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls"
.ie \n(.g \{\
.ds `` \(lq
.ds '' \(rq
\fBint mvget_wch(int \fIy\fP, int \fIx\fP, wint_t *\fIwch\fP);
\fBint mvwget_wch(WINDOW *\fIwin\fP, int \fIy\fP, int \fIx\fP, wint_t *\fIwch\fP);
.PP
-\fBint unget_wch(const wchar_t \fIwch\fP);
+\fBint unget_wch(const wchar_t \fIwc\fP);
.fi
.SH DESCRIPTION
.SS "Reading Characters"
.B \%wget_wch
-gathers a key stroke
-.I wch
-from the terminal keyboard associated with a
+gathers a key event from the terminal keyboard associated with a
.I curses
window
-.IR win ,
+.IR win ","
returning
.B OK
if a wide character is read,
When input is pending,
.B \%wget_wch
stores an integer
-identifying the key stroke in
-.IR wch ;
+identifying the key event in
+.IR wch ";"
for alphanumeric and punctuation keys,
this value corresponds to the character encoding used by the terminal.
-Use of the control key as a modifier often results in a distinct code.
+Use of the control key as a modifier,
+by holding it down while pressing and releasing another key,
+often results in a distinct code.
The behavior of other keys depends on whether
.I win
is in keypad mode;
then if the no-delay flag is set in the window
(see \fB\%nodelay\fP(3X)),
the function returns
-.BR ERR ;
+.BR ERR ";"
otherwise,
.I curses
waits until the terminal has input.
If \fB\%halfdelay\fP(3X)
has been called,
.I curses
-waits until a character is typed or the specified delay elapses.
+waits until input is available or the specified delay elapses.
.PP
If \fB\%echo\fP(3X) has been called,
and the window is not a pad,
to the window,
as with \fB\%wecho_wchar\fP(3X).
.bP
-If the window has been moved or modified since the last call to
+If the window
+.I win
+has been moved or modified since the last call to
\fB\%wrefresh\fP(3X),
.I curses
calls
-.BR \%wrefresh .
+.B \%wrefresh
+on it.
.PP
If
.I wch
is a carriage return and \fBnl\fP(3X) has been called,
.B \%wgetch
-stores the the character code for newline
-(line feed)
-in
+stores the the character code for line feed in
.I wch
instead.
.SS "Ungetting Characters"
places
.I wch
into the input queue to be returned by the next call to
-.BR \%wget_wch .
-A single input queue serves all windows.
+.BR \%wget_wch "."
+A single input queue serves all windows associated with the terminal.
.SH RETURN VALUE
.B \%wget_wch
returns
the
.I \%WINDOW
pointer is
-.BR NULL ,
+.BR NULL ","
or
.bP
its timeout expires without any data arriving,
in which case
.B \%errno
is set to
-.BR \%EINTR .
+.BR \%EINTR "."
.PP
-Functions with a \*(``mv\*('' prefix first perform cursor movement using
-\fB\%wmove\fP(3X) and fail if the position is outside the window,
-or
-(for \*(``mvw\*('' functions)
-if the
-.I win
-parameter is a null pointer.
+Functions prefixed with \*(``mv\*('' first perform cursor movement and
+fail if the position
+.RI ( y ,
+.IR x ")"
+is outside the window boundaries.
.PP
.B \%unget_wch
returns
parameter instead of the return value.
.PP
Unlike
-.BR \%ungetch ,
+.BR \%ungetch ","
.B \%unget_wch
-cannot distinguish function key codes
-.B \%wget_wch
-from conventional character codes.
+cannot distinguish function key codes from conventional character codes.
An application can overcome this limitation by pushing function key
codes with
.B \%ungetch
and subsequently checking the return value of
.B \%wget_wch
for a match with
-.BR \%KEY_CODE_YES .
+.BR \%KEY_CODE_YES "."
.SH EXTENSIONS
See the \*(``EXTENSIONS\*('' section of \fB\%wgetch\fP(3X).
.SH PORTABILITY
.B \%NCURSES_VERSION
preprocessor macro.
.PP
-X/Open Curses, Issue 4, describes these functions.
+X/Open Curses,
+Issue 4 describes these functions.
It specifies no error conditions for them.
.PP
See the \*(``PORTABILITY\*('' section of \fB\%wgetch\fP(3X) regarding
.B \%wget_wch
with signal handlers.
.SH SEE ALSO
+\fB\%curs_getch\fP(3X) describes comparable functions of the
+.I \%ncurses
+library in its non-wide-character configuration.
+.PP
\fB\%curses\fP(3X),
\fB\%curs_add_wch\fP(3X),
\fB\%curs_inopts\fP(3X),
\fB\%curs_move\fP(3X),
\fB\%curs_refresh\fP(3X)
-.PP
-\fB\%curs_getch\fP(3X) describes comparable functions of the
-.I \%ncurses
-library in its non-wide-character configuration.