WGSKBD(3W)
NAME
wgskbd − set keyboard mode for graphics window type
SYNOPSIS
#include <window.h>
int wgskbd(fd,mode);
int fd;
int mode;
DESCRIPTION
fd is an integer file descriptor for an opened graphics window type device interface.
mode
A value of -1 inquires the current keyboard mode for the the graphics window. A value of 0, 1, or 2 sets the keyboard mode to that value.
DISCUSSION
This routine sets or inquires the keyboard mode for a graphics window type. The keyboard mode determines the type of processing done by the window type on input data prior to supplying the data to the application. The default mode is 0. Whenever the mode is changed, any data in the input queue is flushed.
When used to set the keyboard mode, wgskbd has the side effect of resetting all winput_conf(3W) settings to defaults which are dependent upon mode. See winput_conf(3W). In addition, wgskbd calls ioctl(2) to modify the line discipline for the window as follows (see tty(4) for details).
ICANON disabled
BRKINT enabled
VTIME 0
VMIN 1, 2, or sizeof(struct event_code), depending on whether mode is 0, 1, or 2, respectively.
Other than the side effect of resetting winput_conf(3W) settings, wgskbd has no effect if input routing is in effect for this window.
Mode 0
If mode has the value 0, ASCII mode is enabled wherein data is processed as per the normal keyboard input model for graphics windows, essentially that of a Term0 window in transmit functions mode (see the "Window System Input" and "Graphics Softkeys" chapters of the HP Windows/9000 Programmer’s Manual). Note the window must be selected for keycodes to be available via fd.
Mode 2
If mode has the value of 2, the window type is put into packetized input mode as described in the winput_read(3W) man entry. Using a value of 2 is only supported in conjunction with winput_read(3W).
Whenever the keyboard mode is set to 2, a button press over that window will not cause that window to be moved automatically to the top and/or selected as would normally happen with a window. If this behavior is desired, the application can simulate it when appropriate button events are detected. The WMIUICONFIG environment variable should be interrogated using wminquire(3W) to determine which buttons cause the top and/or select, and whether the action is select only or top-and-select.
Mode 1
If mode has the value 1, the window type is put into 2-byte mode. A complete description of this mode follows. NOTE: This discussion only applies to non-Katakana ITF keyboards.
First are some definitions for terms used later - these are all essentially key-types: Modifier keys are the keys labeled CTRL, Shift (2), and Extend char (2). A Normal key is any key that has a single ASCII character for a label; some have two labels (unshifted and shifted). Also included is the key labeled DEL/ESC. A Special key is any key which is not a Normal key or Modifier key (this includes such things as keys labeled with words, function keys, cursor keys, and blank keys). An Npad key is any key which is part of the numeric keypad (18 keys grouped together on the right side of the ITF keyboard) and the 4 unlabeled keys above it. A Roman8 key is any Normal key which is not also an Npad key, or the DEL/ESC key. Any given key may be in more than one of these sets; for example, the key labeled 0 in the numeric keypad is both a Normal key and an Npad key.
When a read is done on fd, keycode information is returned in 2-byte packets; all reads should be in multiples of two. The packet looks like:
struct gr_key_code {
unsigned char control_byte;
unsigned char data_byte;
};
The control_byte is a bit field interpreted by the following values:
K_SHIFT_B Shift Bit
K_CONTROL_B Control Bit
K_META_B Meta (Extend Left)
K_EXTEND_B Extend (Extend Right)
K_NPAD Number Pad Key
K_SPECIAL Special Keys
The K_NPAD and the K_SPECIAL flags indicate the type of key being pressed (see definitions for Npad and Special above).
The K_SHIFT_B, K_CONTROL_B, K_META_B, and K_EXTEND_B flags are keycode (data_byte) modifiers, and are the result of combination keypresses (multiple keys simultaneously). K_SHIFT_B applies to either Shift key being used; K_META_B applies to the Extend char key to the left of the spacebar; K_EXTEND_B applies to the Extend char to the right of the spacebar.
The data_byte for K_SPECIAL keys is not ASCII data. A complete list of #defines for these is provided in <window.h>. Any of the keypress modifiers can be applied to these keys, and no mapping is done; that is, the value of data_byte is independent of the modifier.
The data_byte for K_NPAD keys can be either Special (K_SPECIAL) or Normal. Any of the keypress modifiers can be applied to these keys also, and no mapping is done.
The data_byte for Normal keys (not K_SPECIAL or K_NPAD) is mapped according to the following rules:
(1) If no modifiers are present, the data_byte is ASCII, and the value is mapped to the appropriate shifted or unshifted value, determined by the current Capsmode state (initially unshifted, see below for discussion of the Capsmode toggle).
(2) If the K_SHIFT_B modifier is set, the data_byte is mapped to the appropriate shifted or unshifted value, determined on the current Capsmode state.
(3) If the K_CONTROL_B modifier is set, no mapping is done to reflect this.
(4) If the K_META_B modifier is set, no mapping is done to reflect this.
(5) If the K_EXTEND_B modifier is set and the key is a Roman8 key, the data_byte is mapped to the appropriate Roman-8 character (either shifted or unshifted depending on the K_SHIFT_B modifier and the Capsmode state). (see "Series 300 System Console" in HP-UX Concepts and Tutorials: Facilities for Series 200, 300, and 500 for the ITF keyboard layout, and roman8(7) for data_byte values). If the key is not a Roman8 key, no mapping of the data_byte is done.
There are some special cases that should be noted:
(1) The graphics window type maintains the Capsmode state for the Normal keys which can be capitalized (alphabetic and some Roman-8 characters). Initially this state is off, or unshifted. The state is toggled by the Caps key, which returns either K_CAPS_ON or K_CAPS_OFF in data_byte when pressed, depending on the state. If the state is off, keys which can be capitalized are mapped to their down-shifted value, and are up-shifted when typed with a Shift key. If the state is on, such keys are mapped to their up-shifted value, and when typed with a Shift key are mapped to their down-shifted value.
(2) Pressing the Break key (or the Break key with any modifier except K_SHIFT_B) will cause the graphics window type to emit a gr_key_code with both the control_byte and the data_byte being null (0). Additionally, a TIOCBREAK ioctl call will be issued which will send a SIGINT to the user process if it has done a setpgrp(2) properly, otherwise the user process will only see the null gr_key_code.
(3) The K_SHIFT_B modifier cannot be read with the Select key - this keypress is intercepted by the window system and cannot be used.
(4) The K_CONTROL_B modifier applied to arrow-keys are intercepted by the window system, and will cause the sprite to move; then these keycodes are passed on to the user process.
HARDWARE DEPENDENCIES
Series 300:
Each packet of information sent in mode 2 has a time-stamp specifying exactly when the event or keypress occurred. Most of the time, packets will be time-ordered in the queue; that is, packets are ordered in the sequence in which they occurred−oldest first, latest last. However, the window processes locator data before keypress data; so in rare instances, it is possible that a locator data packet may precede a keypress packet, even though the keypress occurred before the locator packet. Nevertheless, the time-stamps are correct for both packets; thus the application can still determine the exact order of keypresses or events by looking at the time-stamp.
Series 500:
This routine is not supported on Series 500. None of the winput_∗ routines is supported either.
SEE ALSO
winput_conf(3W),winput_read(3W),winput_setroute(3W).
DIAGNOSTICS
A return of -1 indicates failure; otherwise the current mode is returned. See errno(2) for more information.
Hewlett-Packard Company — May 11, 2021