1 | /* unikbd.h,v 1.2 2004/09/14 22:27:36 bird Exp */
|
---|
2 | /** @file
|
---|
3 | * Legalesy-free Unicode API interface for OS/2
|
---|
4 | * Interface definitions for basic Unicode API functions
|
---|
5 | *
|
---|
6 | * Written by bird
|
---|
7 | *
|
---|
8 | * This file is put into public domain. You are free to do
|
---|
9 | * literally anything you wish with it: modify, print, sell,
|
---|
10 | * rent, eat, throw out of window: in all (esp. in later)
|
---|
11 | * cases I am not responsible for any damage it causes.
|
---|
12 | */
|
---|
13 | #ifndef __UNIKBD_H__
|
---|
14 | #define __UNIKBD_H__
|
---|
15 |
|
---|
16 |
|
---|
17 | /*******************************************************************************
|
---|
18 | * Header Files *
|
---|
19 | *******************************************************************************/
|
---|
20 | #include <sys/cdefs.h>
|
---|
21 | #include <unidef.h>
|
---|
22 |
|
---|
23 | #if !defined(OS2_INCLUDED) && !defined(_OS2EMX_H)
|
---|
24 | #warning Including os2.h for you.
|
---|
25 | #include <os2.h>
|
---|
26 | #endif
|
---|
27 |
|
---|
28 |
|
---|
29 | /*******************************************************************************
|
---|
30 | * Defined Constants And Macros *
|
---|
31 | *******************************************************************************/
|
---|
32 | /** Linkage convetion for unikbd calls. */
|
---|
33 | #define KBDLINK APIENTRY
|
---|
34 |
|
---|
35 | #ifndef INCL_WININPUT
|
---|
36 | #define INCL_WININPUT
|
---|
37 | /** @group Virtual Key defines - duplicates of os2emx.h
|
---|
38 | * @{ */
|
---|
39 | #define VK_BUTTON1 0x0001
|
---|
40 | #define VK_BUTTON2 0x0002
|
---|
41 | #define VK_BUTTON3 0x0003
|
---|
42 | #define VK_BREAK 0x0004
|
---|
43 | #define VK_BACKSPACE 0x0005
|
---|
44 | #define VK_TAB 0x0006
|
---|
45 | #define VK_BACKTAB 0x0007
|
---|
46 | #define VK_NEWLINE 0x0008
|
---|
47 | #define VK_SHIFT 0x0009
|
---|
48 | #define VK_CTRL 0x000a
|
---|
49 | #define VK_ALT 0x000b
|
---|
50 | #define VK_ALTGRAF 0x000c
|
---|
51 | #define VK_PAUSE 0x000d
|
---|
52 | #define VK_CAPSLOCK 0x000e
|
---|
53 | #define VK_ESC 0x000f
|
---|
54 | #define VK_SPACE 0x0010
|
---|
55 | #define VK_PAGEUP 0x0011
|
---|
56 | #define VK_PAGEDOWN 0x0012
|
---|
57 | #define VK_END 0x0013
|
---|
58 | #define VK_HOME 0x0014
|
---|
59 | #define VK_LEFT 0x0015
|
---|
60 | #define VK_UP 0x0016
|
---|
61 | #define VK_RIGHT 0x0017
|
---|
62 | #define VK_DOWN 0x0018
|
---|
63 | #define VK_PRINTSCRN 0x0019
|
---|
64 | #define VK_INSERT 0x001a
|
---|
65 | #define VK_DELETE 0x001b
|
---|
66 | #define VK_SCRLLOCK 0x001c
|
---|
67 | #define VK_NUMLOCK 0x001d
|
---|
68 | #define VK_ENTER 0x001e
|
---|
69 | #define VK_SYSRQ 0x001f
|
---|
70 | #define VK_F1 0x0020
|
---|
71 | #define VK_F2 0x0021
|
---|
72 | #define VK_F3 0x0022
|
---|
73 | #define VK_F4 0x0023
|
---|
74 | #define VK_F5 0x0024
|
---|
75 | #define VK_F6 0x0025
|
---|
76 | #define VK_F7 0x0026
|
---|
77 | #define VK_F8 0x0027
|
---|
78 | #define VK_F9 0x0028
|
---|
79 | #define VK_F10 0x0029
|
---|
80 | #define VK_F11 0x002a
|
---|
81 | #define VK_F12 0x002b
|
---|
82 | #define VK_F13 0x002c
|
---|
83 | #define VK_F14 0x002d
|
---|
84 | #define VK_F15 0x002e
|
---|
85 | #define VK_F16 0x002f
|
---|
86 | #define VK_F17 0x0030
|
---|
87 | #define VK_F18 0x0031
|
---|
88 | #define VK_F19 0x0032
|
---|
89 | #define VK_F20 0x0033
|
---|
90 | #define VK_F21 0x0034
|
---|
91 | #define VK_F22 0x0035
|
---|
92 | #define VK_F23 0x0036
|
---|
93 | #define VK_F24 0x0037
|
---|
94 | #define VK_ENDDRAG 0x0038
|
---|
95 | #define VK_CLEAR 0x0039
|
---|
96 | #define VK_EREOF 0x003a
|
---|
97 | #define VK_PA1 0x003b
|
---|
98 | #define VK_ATTN 0x003c
|
---|
99 | #define VK_CRSEL 0x003d
|
---|
100 | #define VK_EXSEL 0x003e
|
---|
101 | #define VK_COPY 0x003f
|
---|
102 | #define VK_BLK1 0x0040
|
---|
103 | #define VK_BLK2 0x0041
|
---|
104 | #define VK_MENU VK_F10
|
---|
105 | #if defined (INCL_NLS)
|
---|
106 | #define VK_DBCSFIRST 0x0080
|
---|
107 | #define VK_DBCSLAST 0x00ff
|
---|
108 | #define VK_BIDI_FIRST 0x00e0
|
---|
109 | #define VK_BIDI_LAST 0x00ff
|
---|
110 | #endif /* INCL_NLS */
|
---|
111 | #define VK_USERFIRST 0x0100
|
---|
112 | #define VK_USERLAST 0x01ff
|
---|
113 | /** @} */
|
---|
114 | #endif /* !INCL_WININPUT */
|
---|
115 |
|
---|
116 |
|
---|
117 | /** @group Virtual Keys defines (Unikbd specific)
|
---|
118 | * @{ */
|
---|
119 | #define VK_PA2 0x0050
|
---|
120 | #define VK_PA3 0x0051
|
---|
121 | #define VK_GROUP 0x0052
|
---|
122 | #define VK_GROUPLOCK 0x0053
|
---|
123 | #define VK_APPL 0x0054
|
---|
124 | #define VK_WINLEFT 0x0055
|
---|
125 | #define VK_WINRIGHT 0x0056
|
---|
126 | #define VK_M_DOWNLEFT 0x0061
|
---|
127 | #define VK_M_DOWN 0x0062
|
---|
128 | #define VK_M_DOWNRIGHT 0x0063
|
---|
129 | #define VK_M_LEFT 0x0064
|
---|
130 | #define VK_M_CENTER 0x0065
|
---|
131 | #define VK_M_RIGHT 0x0066
|
---|
132 | #define VK_M_UPLEFT 0x0067
|
---|
133 | #define VK_M_UP 0x0068
|
---|
134 | #define VK_M_UPRIGHT 0x0069
|
---|
135 | #define VK_M_BUTTONLOCK 0x006A
|
---|
136 | #define VK_M_BUTTONRELEASE 0x006B
|
---|
137 | #define VK_M_DOUBLECLICK 0x006C
|
---|
138 | /** @} */
|
---|
139 |
|
---|
140 | /** @group Dead Key defines
|
---|
141 | * @{ */
|
---|
142 | #define DK_MIN 0x1000
|
---|
143 | #define DK_ACUTE 0x1001
|
---|
144 | #define DK_GRAVE 0x1002
|
---|
145 | #define DK_DIERESIS 0x1003
|
---|
146 | #define DK_UMLAUT 0x1003
|
---|
147 | #define DK_CIRCUMFLEX 0x1004
|
---|
148 | #define DK_TILDE 0x1005
|
---|
149 | #define DK_CEDILLA 0x1006
|
---|
150 | #define DK_MACRON 0x1007
|
---|
151 | #define DK_BREVE 0x1008
|
---|
152 | #define DK_OGONEK 0x1009
|
---|
153 | #define DK_DOT 0x100a
|
---|
154 | #define DK_BAR 0x100b
|
---|
155 | #define DK_RING 0x100c
|
---|
156 | #define DK_CARON 0x100d
|
---|
157 | #define DK_HACEK DK_CARON
|
---|
158 | #define DK_HUNGARUMLAUT 0x100e
|
---|
159 | #define DK_ACUTEDIA 0x100f
|
---|
160 | #define DK_PSILI 0x1010
|
---|
161 | #define DK_DASIA 0x1011
|
---|
162 | #define DK_OVERLINE 0x1012
|
---|
163 | #define DK_UNDERDOT 0x1013
|
---|
164 | #define DK_MAX 0x1fff
|
---|
165 | /** @} */
|
---|
166 |
|
---|
167 | /** @group Keyboard Shift and Effective flags.
|
---|
168 | * @{ */
|
---|
169 | #define KBD_SHIFT 0x00000001
|
---|
170 | #define KBD_CONTROL 0x00000002
|
---|
171 | #define KBD_ALT 0x00000004
|
---|
172 | #define KBD_ALTCTRLSHIFT 0x00000007
|
---|
173 | #define KBD_ALTGR 0x00000008
|
---|
174 | #define KBD_NLS1 0x00000010
|
---|
175 | #define KBD_NLS2 0x00000020
|
---|
176 | #define KBD_NLS3 0x00000040
|
---|
177 | #define KBD_NLS4 0x00000080
|
---|
178 | /** @} */
|
---|
179 |
|
---|
180 | /** @group Keyboard Shift and Effective flags - Japanese NLS usage
|
---|
181 | * @{ */
|
---|
182 | #define KBD_WIDE KBD_NLS1
|
---|
183 | #define KBD_KATAKANA KBD_NLS2
|
---|
184 | #define KBD_HIRAGANA KBD_NLS3
|
---|
185 | #define KBD_ROMANJI KBD_NLS4
|
---|
186 | /** @} */
|
---|
187 |
|
---|
188 | /** @group Keyboard Shift and Effective flags - Korean NLS usage
|
---|
189 | * @{ */
|
---|
190 | #define KBD_JAMO KBD_NLS2
|
---|
191 | #define KBD_HANGEUL KBD_NLS3
|
---|
192 | #define KBD_HANJACSR KBD_NLS4
|
---|
193 | /** @} */
|
---|
194 |
|
---|
195 | /** @group Keyboard Shift and Effective flags - Taiwan NLS usage */
|
---|
196 | #define KBD_PHONETIC KBD_NLS2
|
---|
197 | #define KBD_TSANGJYE KBD_NLS3
|
---|
198 | /** @} */
|
---|
199 |
|
---|
200 |
|
---|
201 | /** @group Keyboard Lock States
|
---|
202 | * @{ */
|
---|
203 | #define KBD_SCROLLLOCK 0x00000100
|
---|
204 | #define KBD_NUMLOCK 0x00000200
|
---|
205 | #define KBD_CAPSLOCK 0x00000400
|
---|
206 | #define KBD_EXTRALOCK 0x00000800
|
---|
207 | #define KBD_APPL 0x00001000
|
---|
208 | #define KBD_DBCS 0x00008000
|
---|
209 | /** @} */
|
---|
210 |
|
---|
211 | /** Bitmask for all the effective bits. */
|
---|
212 | #define KBD_EFFECTIVE 0x0000ffff
|
---|
213 |
|
---|
214 | /** @group Keyboard Shift States Left/Right separation.
|
---|
215 | * @{ */
|
---|
216 | #define KBD_LEFTSHIFT 0x00010000
|
---|
217 | #define KBD_RIGHTSHIFT 0x00020000
|
---|
218 | #define KBD_LEFTCONTROL 0x00040000
|
---|
219 | #define KBD_RIGHTCONTROL 0x00080000
|
---|
220 | #define KBD_LEFTALT 0x00100000
|
---|
221 | #define KBD_RIGHTALT 0x00200000
|
---|
222 | #define KBD_LEFTWINDOWS 0x00400000
|
---|
223 | #define KBD_RIGHTWINDOWS 0x00800000
|
---|
224 | /** @} */
|
---|
225 |
|
---|
226 | /** @group Keyboard LED and other status bits.
|
---|
227 | * @{ */
|
---|
228 | #define KBD_NOROMANJI 0x04000000
|
---|
229 | #define KBD_KANJI 0x08000000
|
---|
230 | #define KBD_DEADKEY 0x10000000
|
---|
231 | #define KBD_WAIT 0x20000000
|
---|
232 | #define KBD_HOLD 0x40000000
|
---|
233 | #define KBD_LOCK 0x80000000
|
---|
234 | /** @} */
|
---|
235 |
|
---|
236 | /** @group Make/Break/Repeat defines.
|
---|
237 | * @{ */
|
---|
238 | #define KEYEV_MAKEBREAK 0
|
---|
239 | #define KEYEV_MAKE 1
|
---|
240 | #define KEYEV_BREAK 2
|
---|
241 | #define KEYEV_REPEAT 3
|
---|
242 | /** @} */
|
---|
243 |
|
---|
244 | /** @group Keyboard Query Flags.
|
---|
245 | * @{ */
|
---|
246 | #define KBDF_DEFAULTVKEY 0x0001
|
---|
247 | #define KBDF_NOCTRLSHIFT 0x0002
|
---|
248 | #define KBDF_NOALTGR 0x0004
|
---|
249 | #define KBDF_SHIFTALTGR 0x0010
|
---|
250 | #define KBDF_DEADGOOD 0x0020
|
---|
251 | #define KBDF_DEADPRIVATE 0x0040
|
---|
252 | #define KBDF_SYSTEM 0x8000
|
---|
253 | #define KBDF_INTERNATIONAL 0x4000
|
---|
254 | #define KBDF_DVORAK 0x2000
|
---|
255 | #define KBDF_NATIONAL 0x1000
|
---|
256 | #define KBDF_LETTERKEYS 0x3000
|
---|
257 | #define KBDF_ISOKEYS 0x0800
|
---|
258 | /** @} */
|
---|
259 |
|
---|
260 | /** @group Keyboard layout flags (advisory only)
|
---|
261 | * @{ */
|
---|
262 | #define KBDF_LAYOUT101 0x0000
|
---|
263 | #define KBDF_LAYOUT102 0x0100
|
---|
264 | #define KBDF_LAYOUT106 0x0200
|
---|
265 | #define KBDF_LAYOUT103 0x0300
|
---|
266 | #define KBDF_LAYOUT100 0x0400
|
---|
267 | #define KBDF_LAYOUTS 0x0700
|
---|
268 | /** @} */
|
---|
269 |
|
---|
270 | /** @group UniResetShiftState types.
|
---|
271 | * @{ */
|
---|
272 | #define KEYEV_SET 0
|
---|
273 | #define KEYEV_RELEASE 1
|
---|
274 | #define KEYEV_ZERO 2
|
---|
275 | /** @} */
|
---|
276 |
|
---|
277 |
|
---|
278 |
|
---|
279 |
|
---|
280 | /*******************************************************************************
|
---|
281 | * Structures and Typedefs *
|
---|
282 | *******************************************************************************/
|
---|
283 | /** Translation table handle. */
|
---|
284 | typedef unsigned int KHAND;
|
---|
285 | /** Virtual scan code. */
|
---|
286 | typedef unsigned char VSCAN;
|
---|
287 | /** Virtual dead key. */
|
---|
288 | typedef unsigned short VDKEY;
|
---|
289 | /** Keyboard name. */
|
---|
290 | typedef UniChar KBDNAME;
|
---|
291 |
|
---|
292 | /** Keyboard shift states. */
|
---|
293 | typedef struct _USHIFTSTATE
|
---|
294 | {
|
---|
295 | /** Actual shift and lock state. */
|
---|
296 | ULONG Shift;
|
---|
297 | /** Effective shift and lock state. */
|
---|
298 | ULONG Effective;
|
---|
299 | /** Keyboard indicators. */
|
---|
300 | ULONG Led;
|
---|
301 | } USHIFTSTATE;
|
---|
302 |
|
---|
303 | /** Virtual key event. */
|
---|
304 | typedef struct _INKEYEVENT
|
---|
305 | {
|
---|
306 | /** Logical device (0=real). */
|
---|
307 | USHORT ldev;
|
---|
308 | /** Make/break indicator. */
|
---|
309 | BYTE makebreak;
|
---|
310 | /** Virtual scan code. */
|
---|
311 | VSCAN scan;
|
---|
312 | /** Timestamp. */
|
---|
313 | ULONG time;
|
---|
314 | } INKEYEVENT;
|
---|
315 |
|
---|
316 | /** Query keyboard structure. */
|
---|
317 | typedef struct _KEYBOARDINFO
|
---|
318 | {
|
---|
319 | /** Length of structure. */
|
---|
320 | ULONG len;
|
---|
321 | /** Keyboard architecture id. */
|
---|
322 | USHORT kbid;
|
---|
323 | /** Version number. */
|
---|
324 | USHORT version;
|
---|
325 | /** Normal language. */
|
---|
326 | BYTE language[2];
|
---|
327 | /** Normal country. */
|
---|
328 | BYTE country[2];
|
---|
329 | /** Flags (KBDF_). */
|
---|
330 | USHORT flags;
|
---|
331 | /** Reserved. */
|
---|
332 | USHORT resv;
|
---|
333 | /** Description of keyboard. */
|
---|
334 | UniChar description[32];
|
---|
335 | } KEYBOARDINFO;
|
---|
336 |
|
---|
337 |
|
---|
338 | /*******************************************************************************
|
---|
339 | * Internal Functions *
|
---|
340 | *******************************************************************************/
|
---|
341 | __BEGIN_DECLS
|
---|
342 | APIRET KBDLINK UniCreateKeyboard(KHAND * phKeyboard, const KBDNAME * puszName, ULONG ulMode);
|
---|
343 | APIRET KBDLINK UniDestroyKeyboard(KHAND hKeyboard);
|
---|
344 | APIRET KBDLINK UniQueryKeyboard(KHAND hKeyboard, KEYBOARDINFO * pKbdInfo);
|
---|
345 | APIRET KBDLINK UniResetShiftState(KHAND hKeyboard, USHIFTSTATE * pKbdStat, ULONG ulType);
|
---|
346 | APIRET KBDLINK UniUpdateShiftState(KHAND hKeyboard, USHIFTSTATE * pKbdStat, VSCAN uchScan, BYTE bMakeBreak);
|
---|
347 | APIRET KBDLINK UniTranslateKey(KHAND hKeyboard, ULONG ulEShift, VSCAN bScan, UniChar * puc, VDKEY * pusDeadKey, BYTE * pbScan);
|
---|
348 | APIRET KBDLINK UniTranslateDeadkey(KHAND hKeyboard, VDKEY usDead, UniChar ucIn, UniChar * pucOut, VDKEY * pusDeadKey);
|
---|
349 | APIRET KBDLINK UniUntranslateKey(KHAND hKeyboard, UniChar uc, VDKEY vdkey, VSCAN * pscan, ULONG * eshift);
|
---|
350 | __END_DECLS
|
---|
351 |
|
---|
352 | #endif
|
---|
353 |
|
---|
354 |
|
---|