xref: /titanic_41/usr/src/man/man3xcurses/get_wch.3xcurses (revision dc41c81f4872a0d4ce52a59cd88a576aeb49183a)
te
Copyright (c) 1990, 1995 by Mortice Kern Systems Inc. All Rights Reserved Portions Copyright (c) 1996, Sun Microsystems, Inc. All Rights Reserved
The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
GET_WCH 3XCURSES "Jun 5, 2002"
NAME
get_wch, wget_wch, mvget_wch, mvwget_wch - get a wide character from terminal
SYNOPSIS

cc [ flag... ] file... -I /usr/xpg4/include  -L  /usr/xpg4/lib \e
 -R  /usr/xpg4/lib  -lcurses  [ library... ]

c89 [ flag... ] file... -lcurses [ library... ]

#include <curses.h>

int get_wch(wint_t *ch);

int wget_wch(WINDOW *win, wint_t *ch);

int mvget_wch(int y, int x, wint_t *ch);

int mvwget_wch(WINDOW *win, int y, int x, wint_t *ch);
DESCRIPTION

The get_wch() and wget_wch() functions get a wide character from the terminal associated with the window stdscr or window win, respectively. The mvget_wch() and mvwget_wch() functions move the cursor to the position specified in stdscr or win, respectively, then get a character.

If the window is not a pad and has been changed since the last call to refresh(3XCURSES), get_wch() calls refresh() to update the window before the next character is read.

The setting of certain functions affects the behavior of the get_wch() set of functions. For example, if cbreak(3XCURSES) is set, characters typed by the user are immediately processed. If halfdelay(3XCURSES) is set, get_wch() waits until a character is typed or returns ERR if no character is typed within the specified timeout period. This timeout can also be specified for individual windows with the delay parameter of timeout(3XCURSES) A negative value waits for input; a value of 0 returns ERR if no input is ready; a positive value blocks until input arrives or the time specified expires (in which case ERR is returned). If nodelay(3XCURSES) is set, ERR is returned if no input is waiting; if not set, get_wch() waits until input arrives. Each character will be echoed to the window unless noecho(3XCURSES) has been set.

If keypad handling is enabled ( keypad(3XCURSES) is TRUE), the token for the function key (a KEY_ value) is stored in the object pointed to by ch and KEY_CODE_YES is returned. If a character is received that could be the beginning of a function key (for example, ESC), an inter-byte timer is set. If the remainder of the sequence is not received before the time expires, the character is passed through; otherwise, the value of the function key is returned. If notimeout() is set, the inter-byte timer is not used.

The ESC key is typically a prefix key used with function keys and should not be used as a single character.

See the getch(3XCURSES) manual page for a list of tokens for function keys that are returned by the get_wch() set of functions if keypad handling is enabled (Some terminals may not support all tokens).

PARAMETERS
ch

Is a pointer to a wide integer where the returned wide character or KEY_ value can be stored.

win

Is a pointer to the window associated with the terminal from which the character is to be read.

y

Is the y (row) coordinate for the position of the character to be read.

x

Is the x (column) coordinate for the position of the character to be read.

RETURN VALUES

When these functions successfully report the pressing of a function key, they return KEY_CODE_YES. When they successfully report a wide character, they return OK. Otherwise, they return ERR.

ERRORS

None.

ATTRIBUTES

See attributes(5) for descriptions of the following attributes:

ATTRIBUTE TYPE ATTRIBUTE VALUE
Interface Stability Standard
MT-Level Unsafe
SEE ALSO

cbreak(3XCURSES), echo(3XCURSES), halfdelay(3XCURSES), keypad(3XCURSES), libcurses(3XCURSES), nodelay(3XCURSES), notimeout(3XCURSES), raw(3XCURSES), timeout(3XCURSES), attributes(5), standards(5)