1 .\"***************************************************************************
2 .\" Copyright (c) 2002-2017,2018 Free Software Foundation, Inc. *
4 .\" Permission is hereby granted, free of charge, to any person obtaining a *
5 .\" copy of this software and associated documentation files (the *
6 .\" "Software"), to deal in the Software without restriction, including *
7 .\" without limitation the rights to use, copy, modify, merge, publish, *
8 .\" distribute, distribute with modifications, sublicense, and/or sell *
9 .\" copies of the Software, and to permit persons to whom the Software is *
10 .\" furnished to do so, subject to the following conditions: *
12 .\" The above copyright notice and this permission notice shall be included *
13 .\" in all copies or substantial portions of the Software. *
15 .\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
16 .\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
17 .\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
18 .\" IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
19 .\" DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
20 .\" OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
21 .\" THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
23 .\" Except as contained in this notice, the name(s) of the above copyright *
24 .\" holders shall not be used in advertising or otherwise to promote the *
25 .\" sale, use or other dealings in this Software without prior written *
27 .\"***************************************************************************
29 .\" $Id: curs_get_wch.3x,v 1.11 2018/07/28 22:20:54 tom Exp $
30 .TH curs_get_wch 3X ""
42 \fBunget_wch\fR \- get (or push back) a wide character from curses terminal keyboard
46 \fB#include <curses.h>\fR
48 \fBint get_wch(wint_t *\fR\fIwch\fR\fB);\fR
50 \fBint wget_wch(WINDOW *\fR\fIwin\fR\fB, wint_t *\fR\fIwch\fR\fB);\fR
52 \fBint mvget_wch(int \fR\fIy\fR\fB, int \fR\fIx\fR\fB, wint_t *\fR\fIwch\fR\fB);\fR
54 \fBint mvwget_wch(WINDOW *\fR\fIwin\fR\fB, int \fR\fIy\fR\fB, int \fR\fIx\fR\fB, wint_t *\fR\fIwch\fR\fB);\fR
56 \fBint unget_wch(const wchar_t \fR\fIwch\fR\fB);\fR
63 functions read a character
64 from the terminal associated with the current or specified window.
66 if no input is waiting, the value \fBERR\fR is returned.
68 the program waits until the system passes text through to the program.
69 Depending on the setting of \fBcbreak\fR,
70 this is after one character (cbreak mode),
71 or after the first newline (nocbreak mode).
73 the program waits until the user types a character or the specified
74 timeout interval has elapsed.
76 Unless \fBnoecho\fR has been set,
77 these routines echo the character into the designated window.
79 If the window is not a pad and has been moved or modified since the
80 last call to \fBwrefresh\fR,
81 \fBwrefresh\fR will be called before another character is read.
83 If \fBkeypad\fR is enabled,
84 these functions respond to
85 the pressing of a function key by setting the object pointed to by
87 to the keycode assigned to the function key,
88 and returning \fBKEY_CODE_YES\fR.
89 If a character (such as escape) that could be the
90 beginning of a function key is received, curses sets a timer.
92 of the sequence does arrive within the designated time, curses passes through
93 the character; otherwise, curses returns the function key value.
95 reason, many terminals experience a delay between the time a user presses
96 the escape key and the time the escape is returned to the program.
98 The keycodes returned by these functions are the same as those
99 returned by \fBwgetch\fP:
101 The predefined function
102 keys are listed in \fB<curses.h>\fR as macros with values outside the range
104 Their names begin with \fBKEY_\fR.
106 Other (user-defined) function keys
107 which may be defined using \fBdefine_key\fP(3X) have no names,
108 but also are expected to have values outside the range of 8-bit characters.
112 function pushes the wide character
114 back onto the head of the input queue, so the wide character
115 is returned by the next call to
118 one character is guaranteed.
121 too many times without an intervening call to
123 the operation may fail.
128 includes the header file
131 Applications should not define the escape key by itself as a single-character
138 \fBmvwget_wch\fR, applications should
145 Depending on the state of the tty driver when each character
146 is typed, the program may produce undesirable results.
148 All functions except \fBwget_wch\fR and \fBunget_wch\fR
156 functions successfully
157 report the pressing of a function key, they return
159 When they successfully report a wide character, they return
161 Otherwise, they return
164 Upon successful completion,
168 Otherwise, the function returns
171 Functions with a "mv" prefix first perform a cursor movement using
172 \fBwmove\fP, and return an error if the position is outside the window,
173 or if the window pointer is null.
176 \fBcurs_getch\fR(3X),
177 \fBcurs_ins_wch\fR(3X),
178 \fBcurs_inopts\fR(3X),
180 \fBcurs_refresh\fR(3X)