1 /****************************************************************************
3 * SciTech OS Portability Manager Library
5 * ========================================================================
7 * The contents of this file are subject to the SciTech MGL Public
8 * License Version 1.0 (the "License"); you may not use this file
9 * except in compliance with the License. You may obtain a copy of
10 * the License at http://www.scitechsoft.com/mgl-license.txt
12 * Software distributed under the License is distributed on an
13 * "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
14 * implied. See the License for the specific language governing
15 * rights and limitations under the License.
17 * The Original Code is Copyright (C) 1991-1998 SciTech Software, Inc.
19 * The Initial Developer of the Original Code is SciTech Software, Inc.
20 * All Rights Reserved.
22 * ========================================================================
25 * Environment: 32-bit OS/2
27 * Description: Include file to include all OS/2 keyboard monitor stuff.
29 ****************************************************************************/
33 #define MONITOR_DEFAULT 0x0000
34 #define MONITOR_BEGIN 1
37 typedef SHANDLE HMONITOR;
38 typedef HMONITOR *PHMONITOR;
40 typedef struct _KEYPACKET {
57 typedef struct _MLNPACKET {
68 #define SF_SHIFTS 1 /* If set to 1, shift status returned without a character */
69 #define SF_NOTCHAR 2 /* 0 - Scan code is a character */
70 /* 1 - Scan code is not a character; */
71 /* instead it is an extended key code from the keyboard. */
72 #define SF_IMMEDIATE 32 /* If set to 1, immediate conversion requested */
73 #define SF_TYPEMASK 192 /* Has the following values: */
75 /* 01 - Final character; interim character flag is turned off */
76 /* 10 - Interim character */
77 /* 11 - Final character; interim character flag is turned on. */
80 #define MF_OPEN 1 /* open */
81 #define MF_CLOSE 2 /* close */
82 #define MF_FLUSH 4 /* is flush packet */
86 #define KF_NOTSQPACKET 1024 /* Don't put this packet in SQ buffer */
87 #define KF_ACCENTEDKEY 512 /* Key was translated using previous accent. */
88 #define KF_MULTIMAKE 256 /* Key was repeated make of a toggle key. */
89 #define KF_SECONDARYKEY 128 /* Previous scan code was the E0 prefix code. */
90 #define KF_KEYBREAK 64 /* This is the break of the key. */
91 #define KF_KEYTYPEMASK 63 /* Isolates the Key Type field of DDFlags. */
92 #define KF_UNDEFKEY 63 /* Key packet is undefined */
93 #define KF_SYSREQKEY 23 /* This key packet is the SysReq key (4990) */
94 #define KF_PRINTFLUSHKEY 22 /* This packet is Ct-Alt-PrtScr */
95 #define KF_PSPRINTECHOKEY 21 /* This packet is Ctl-P */
96 #define KF_PRINTECHOKEY 20 /* This packet is Ctl-PrtScr */
97 #define KF_PRTSCRKEY 19 /* This packet is PrtScr */
98 #define KF_PSBREAKKEY 18 /* This packet is Ctl-C */
99 #define KF_BREAKKEY 17 /* This packet is Ctl-Break */
100 #define KF_ACCENTKEY 16 /* This packet is an accent key */
101 #define KF_XRORPNOT 13 /* This packet is a Read or Peek Notification Pct. */
102 #define KF_MLNOTIFICATION 14 /* packet is a Multi-Layer NLS packet */
103 #define KF_HOTKEYPACKET 12 /* This packet is the hot key. */
104 #define KF_BADKEYCOMBO 11 /* Accent/char combo undefined, beep only. */
105 #define KF_WAKEUPKEY 10 /* This packet is one following PAUSEKEY */
106 #define KF_PSPAUSEKEY 9 /* This packet is Ctl-S */
107 #define KF_PAUSEKEY 8 /* This packet is Ctl-Numlock or PAUSE */
108 #define KF_SHIFTMASK 7 /* Key is a shift Key */
109 #define KF_DUMPKEY 6 /* This packet is Ctl-Numlock-NumLock */
110 #define KF_REBOOTKEY 5 /* This packet is Ctl-Alt-Del */
111 #define KF_RESENDCODE 4 /* This packet is resend code from controller */
112 #define KF_OVERRUNCODE 3 /* This packet is overrun code from controller */
113 #define KF_SECPREFIXCODE 2 /* This packet is E0/E1 scan code */
114 #define KF_ACKCODE 1 /* This packet is ack code from keyboard */
117 typedef struct _MONBUF {
123 #define RS_SYSREG 32768 /* Bit 15 SysReq key down */
124 #define RS_CAPSLOCK 16384 /* Bit 14 Caps Lock key down */
125 #define RS_NUMLOCK 8192 /* Bit 13 NumLock key down */
126 #define RS_SCROLLLOCK 4096 /* Bit 12 Scroll Lock key down */
127 #define RS_RALT 2048 /* Bit 11 Right Alt key down */
128 #define RS_RCONTROL 1024 /* Bit 10 Right Ctrl key down */
129 #define RS_LALT 512 /* Bit 9 Left Alt key down */
130 #define RS_LCONTROL 256 /* Bit 8 Left Ctrl key down */
131 #define RS_INSERT 128 /* Bit 7 Insert on */
132 #define RS_CAPS 64 /* Bit 6 Caps Lock on */
133 #define RS_NUM 32 /* Bit 5 NumLock on */
134 #define RS_SCROLL 16 /* Bit 4 Scroll Lock on */
135 #define RS_ALT 8 /* Bit 3 Either Alt key down */
136 #define RS_CONTROL 4 /* Bit 2 Either Ctrl key down */
137 #define RS_LSHIFT 2 /* Bit 1 Left Shift key down */
138 #define RS_RSHIFT 1 /* Bit 0 Right Shift key down */
141 #define CS_RCONTROL 91 /* Right Control */
142 #define CS_LSHIFT 42 /* Left Shift */
143 #define CS_RSHIFT 54 /* Right Shift */
144 #define CS_LALT 56 /* Left Alt */
145 #define CS_RALT 94 /* Right Alt */
148 /* DosMon* prototypes */
150 #define APIRET16 USHORT
153 #define DosMonOpen DOS16MONOPEN
154 #define DosMonClose DOS16MONCLOSE
155 #define DosMonReg DOS16MONREG
156 #define DosMonRead DOS16MONREAD
157 #define DosMonWrite DOS16MONWRITE
158 #define DosGetInfoSeg DOS16GETINFOSEG
161 APIRET16 APIENTRY16 DosMonOpen (PSZ pszDevName, PHMONITOR phmon);
162 APIRET16 APIENTRY16 DosMonClose (HMONITOR hmon);
163 APIRET16 APIENTRY16 DosMonReg (HMONITOR hmon, MONBUF *pbInBuf, /*MONBUF*/ULONG *pbOutBuf, USHORT fPosition, USHORT usIndex);
164 APIRET16 APIENTRY16 DosMonRead (PBYTE pbInBuf, USHORT fWait, PBYTE pbDataBuf, PUSHORT pcbData);
165 APIRET16 APIENTRY16 DosMonWrite (PBYTE pbOutBuf, PBYTE pbDataBuf, USHORT cbData);