dmusic/tests: Test IDirectMusic(Port)Download interfaces.
[wine.git] / include / kbd.h
blob9bbcd886b1c02054c585e7086700bb303d5c1e9b
1 /*
2 * Copyright 2022 RĂ©mi Bernon for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 #ifndef __WINE_KBD_H
20 #define __WINE_KBD_H
22 #include "windef.h"
24 #define KBDBASE 0
25 #define KBDSHIFT 1
26 #define KBDCTRL 2
27 #define KBDALT 4
28 #define KBDKANA 8
29 #define KBDROYA 0x10
30 #define KBDLOYA 0x20
31 #define KBDGRPSELTAP 0x80
33 #define WCH_NONE 0xf000
34 #define WCH_DEAD 0xf001
35 #define WCH_LGTR 0xf002
37 #define CAPLOK 0x01
38 #define SGCAPS 0x02
39 #define CAPLOKALTGR 0x04
40 #define KANALOK 0x08
41 #define GRPSELTAP 0x80
43 typedef struct
45 BYTE Vk;
46 BYTE ModBits;
47 } VK_TO_BIT, *PVK_TO_BIT;
49 typedef struct
51 VK_TO_BIT *pVkToBit;
52 WORD wMaxModBits;
53 BYTE ModNumber[];
54 } MODIFIERS, *PMODIFIERS;
56 #define TYPEDEF_VK_TO_WCHARS(n) \
57 typedef struct _VK_TO_WCHARS##n \
58 { \
59 BYTE VirtualKey; \
60 BYTE Attributes; \
61 WCHAR wch[n]; \
62 } VK_TO_WCHARS##n, *PVK_TO_WCHARS##n
64 TYPEDEF_VK_TO_WCHARS(1);
65 TYPEDEF_VK_TO_WCHARS(2);
66 TYPEDEF_VK_TO_WCHARS(3);
67 TYPEDEF_VK_TO_WCHARS(4);
68 TYPEDEF_VK_TO_WCHARS(5);
69 TYPEDEF_VK_TO_WCHARS(6);
70 TYPEDEF_VK_TO_WCHARS(7);
71 TYPEDEF_VK_TO_WCHARS(8);
72 TYPEDEF_VK_TO_WCHARS(9);
73 TYPEDEF_VK_TO_WCHARS(10);
75 typedef struct _VK_TO_WCHAR_TABLE
77 VK_TO_WCHARS1 *pVkToWchars;
78 BYTE nModifications;
79 BYTE cbSize;
80 } VK_TO_WCHAR_TABLE, *PVK_TO_WCHAR_TABLE;
82 typedef struct
84 DWORD dwBoth;
85 WCHAR wchComposed;
86 USHORT uFlags;
87 } DEADKEY, *PDEADKEY;
89 typedef struct
91 BYTE vsc;
92 WCHAR *pwsz;
93 } VSC_LPWSTR, *PVSC_LPWSTR;
95 typedef struct _VSC_VK
97 BYTE Vsc;
98 USHORT Vk;
99 } VSC_VK, *PVSC_VK;
101 #define TYPEDEF_LIGATURE(n) \
102 typedef struct _LIGATURE##n \
104 BYTE VirtualKey; \
105 WORD ModificationNumber; \
106 WCHAR wch[n]; \
107 } LIGATURE##n, *PLIGATURE##n;
109 TYPEDEF_LIGATURE(1)
110 TYPEDEF_LIGATURE(2)
111 TYPEDEF_LIGATURE(3)
112 TYPEDEF_LIGATURE(4)
113 TYPEDEF_LIGATURE(5)
115 typedef struct tagKbdLayer
117 MODIFIERS *pCharModifiers;
118 VK_TO_WCHAR_TABLE *pVkToWcharTable;
119 DEADKEY *pDeadKey;
120 VSC_LPWSTR *pKeyNames;
121 VSC_LPWSTR *pKeyNamesExt;
122 WCHAR **pKeyNamesDead;
123 USHORT *pusVSCtoVK;
124 BYTE bMaxVSCtoVK;
125 VSC_VK *pVSCtoVK_E0;
126 VSC_VK *pVSCtoVK_E1;
127 DWORD fLocaleFlags;
128 BYTE nLgMax;
129 BYTE cbLgEntry;
130 LIGATURE1 *pLigature;
131 DWORD dwType;
132 DWORD dwSubType;
133 } KBDTABLES, *PKBDTABLES;
135 #define KBD_VERSION 1
136 #define GET_KBD_VERSION(table) (HIWORD((table)->fLocaleFlags))
138 #ifndef KBD_TYPE
139 #define KBD_TYPE 4
140 #endif
142 #define KBDEXT (USHORT)0x0100
143 #define KBDMULTIVK (USHORT)0x0200
144 #define KBDSPECIAL (USHORT)0x0400
145 #define KBDNUMPAD (USHORT)0x0800
146 #define KBDUNICODE (USHORT)0x1000
147 #define KBDINJECTEDVK (USHORT)0x2000
148 #define KBDMAPPEDVK (USHORT)0x4000
149 #define KBDBREAK (USHORT)0x8000
151 #define VK__none_ 0xff
152 #define VK_ABNT_C1 0xc1
153 #define VK_ABNT_C2 0xc2
155 #if (KBD_TYPE <= 6)
156 #define _EQ(v4) (VK_##v4)
157 #if (KBD_TYPE == 1)
158 #define _NE(v1, v2, v3, v4, v5, v6) (VK_##v1)
159 #elif (KBD_TYPE == 2)
160 #define _NE(v1, v2, v3, v4, v5, v6) (VK_##v2)
161 #elif (KBD_TYPE == 3)
162 #define _NE(v1, v2, v3, v4, v5, v6) (VK_##v3)
163 #elif (KBD_TYPE == 4)
164 #define _NE(v1, v2, v3, v4, v5, v6) (VK_##v4)
165 #elif (KBD_TYPE == 5)
166 #define _NE(v1, v2, v3, v4, v5, v6) (VK_##v5)
167 #elif (KBD_TYPE == 6)
168 #define _NE(v1, v2, v3, v4, v5, v6) (VK_##v6)
169 #endif
170 #define T00 _EQ(_none_)
171 #define T01 _EQ(ESCAPE)
172 #define T02 '1'
173 #define T03 '2'
174 #define T04 '3'
175 #define T05 '4'
176 #define T06 '5'
177 #define T07 '6'
178 #define T08 '7'
179 #define T09 '8'
180 #define T0A '9'
181 #define T0B '0'
182 #define T0C _EQ(OEM_MINUS)
183 #define T0D _NE(OEM_PLUS,OEM_4, OEM_PLUS, OEM_PLUS, OEM_PLUS, OEM_PLUS)
184 #define T0E _EQ(BACK)
185 #define T0F _EQ(TAB)
186 #define T10 'Q'
187 #define T11 'W'
188 #define T12 'E'
189 #define T13 'R'
190 #define T14 'T'
191 #define T15 'Y'
192 #define T16 'U'
193 #define T17 'I'
194 #define T18 'O'
195 #define T19 'P'
196 #define T1A _NE(OEM_4, OEM_6, OEM_4, OEM_4, OEM_4, OEM_4)
197 #define T1B _NE(OEM_6, OEM_1, OEM_6, OEM_6, OEM_6, OEM_6)
198 #define T1C _EQ(RETURN)
199 #define T1D _EQ(LCONTROL)
200 #define T1E 'A'
201 #define T1F 'S'
202 #define T20 'D'
203 #define T21 'F'
204 #define T22 'G'
205 #define T23 'H'
206 #define T24 'J'
207 #define T25 'K'
208 #define T26 'L'
209 #define T27 _NE(OEM_1, OEM_PLUS, OEM_1, OEM_1, OEM_1, OEM_1)
210 #define T28 _NE(OEM_7, OEM_3, OEM_7, OEM_7, OEM_3, OEM_3)
211 #define T29 _NE(OEM_3, OEM_7, OEM_3, OEM_3, OEM_7, OEM_7)
212 #define T2A _EQ(LSHIFT)
213 #define T2B _EQ(OEM_5)
214 #define T2C 'Z'
215 #define T2D 'X'
216 #define T2E 'C'
217 #define T2F 'V'
218 #define T30 'B'
219 #define T31 'N'
220 #define T32 'M'
221 #define T33 _EQ(OEM_COMMA)
222 #define T34 _EQ(OEM_PERIOD)
223 #define T35 _EQ(OEM_2)
224 #define T36 _EQ(RSHIFT)
225 #define T37 _EQ(MULTIPLY)
226 #define T38 _EQ(LMENU)
227 #define T39 ' '
228 #define T3A _EQ(CAPITAL)
229 #define T3B _EQ(F1)
230 #define T3C _EQ(F2)
231 #define T3D _EQ(F3)
232 #define T3E _EQ(F4)
233 #define T3F _EQ(F5)
234 #define T40 _EQ(F6)
235 #define T41 _EQ(F7)
236 #define T42 _EQ(F8)
237 #define T43 _EQ(F9)
238 #define T44 _EQ(F10)
239 #define T45 _EQ(NUMLOCK)
240 #define T46 _EQ(SCROLL)
241 #define T47 _EQ(HOME)
242 #define T48 _EQ(UP)
243 #define T49 _EQ(PRIOR)
244 #define T4A _EQ(SUBTRACT)
245 #define T4B _EQ(LEFT)
246 #define T4C _EQ(CLEAR)
247 #define T4D _EQ(RIGHT)
248 #define T4E _EQ(ADD)
249 #define T4F _EQ(END)
250 #define T50 _EQ(DOWN)
251 #define T51 _EQ(NEXT)
252 #define T52 _EQ(INSERT)
253 #define T53 _EQ(DELETE)
254 #define T54 _EQ(SNAPSHOT)
255 #define T55 _EQ(_none_)
256 #define T56 _NE(OEM_102, HELP, OEM_102, OEM_102, _none_, OEM_PA2)
257 #define T57 _NE(F11, RETURN, F11, F11, _none_, HELP)
258 #define T58 _NE(F12, LEFT, F12, F12, _none_, OEM_102)
259 #define T59 _EQ(CLEAR)
260 #define T5A _EQ(OEM_WSCTRL)
261 #define T5B _EQ(OEM_FINISH)
262 #define T5C _EQ(OEM_JUMP)
263 #define T5D _EQ(EREOF)
264 #define T5E _EQ(OEM_BACKTAB)
265 #define T5F _EQ(OEM_AUTO)
266 #define T60 _EQ(_none_)
267 #define T61 _EQ(_none_)
268 #define T62 _EQ(ZOOM)
269 #define T63 _EQ(HELP)
270 #define T64 _EQ(F13)
271 #define T65 _EQ(F14)
272 #define T66 _EQ(F15)
273 #define T67 _EQ(F16)
274 #define T68 _EQ(F17)
275 #define T69 _EQ(F18)
276 #define T6A _EQ(F19)
277 #define T6B _EQ(F20)
278 #define T6C _EQ(F21)
279 #define T6D _EQ(F22)
280 #define T6E _EQ(F23)
281 #define T6F _EQ(OEM_PA3)
282 #define T70 _EQ(_none_)
283 #define T71 _EQ(OEM_RESET)
284 #define T72 _EQ(_none_)
285 #define T73 _EQ(ABNT_C1)
286 #define T74 _EQ(_none_)
287 #define T75 _EQ(_none_)
288 #define T76 _EQ(F24)
289 #define T77 _EQ(_none_)
290 #define T78 _EQ(_none_)
291 #define T79 _EQ(_none_)
292 #define T7A _EQ(_none_)
293 #define T7B _EQ(OEM_PA1)
294 #define T7C _EQ(TAB)
295 #define T7D _EQ(_none_)
296 #define T7E _EQ(ABNT_C2)
297 #define T7F _EQ(OEM_PA2)
298 #define X10 _EQ(MEDIA_PREV_TRACK)
299 #define X19 _EQ(MEDIA_NEXT_TRACK)
300 #define X1C _EQ(RETURN)
301 #define X1D _EQ(RCONTROL)
302 #define X20 _EQ(VOLUME_MUTE)
303 #define X21 _EQ(LAUNCH_APP2)
304 #define X22 _EQ(MEDIA_PLAY_PAUSE)
305 #define X24 _EQ(MEDIA_STOP)
306 #define X2E _EQ(VOLUME_DOWN)
307 #define X30 _EQ(VOLUME_UP)
308 #define X32 _EQ(BROWSER_HOME)
309 #define X35 _EQ(DIVIDE)
310 #define X37 _EQ(SNAPSHOT)
311 #define X38 _EQ(RMENU)
312 #define X46 _EQ(CANCEL)
313 #define X47 _EQ(HOME)
314 #define X48 _EQ(UP)
315 #define X49 _EQ(PRIOR)
316 #define X4B _EQ(LEFT)
317 #define X4D _EQ(RIGHT)
318 #define X4F _EQ(END)
319 #define X50 _EQ(DOWN)
320 #define X51 _NE(NEXT, F1, NEXT, NEXT, _none_, OEM_PA2)
321 #define X52 _EQ(INSERT)
322 #define X53 _EQ(DELETE)
323 #define X5B _EQ(LWIN)
324 #define X5C _EQ(RWIN)
325 #define X5D _EQ(APPS)
326 #define X5E _EQ(POWER)
327 #define X5F _EQ(SLEEP)
328 #define X65 _EQ(BROWSER_SEARCH)
329 #define X66 _EQ(BROWSER_FAVORITES)
330 #define X67 _EQ(BROWSER_REFRESH)
331 #define X68 _EQ(BROWSER_STOP)
332 #define X69 _EQ(BROWSER_FORWARD)
333 #define X6A _EQ(BROWSER_BACK)
334 #define X6B _EQ(LAUNCH_APP1)
335 #define X6C _EQ(LAUNCH_MAIL)
336 #define X6D _EQ(LAUNCH_MEDIA_SELECT)
337 #define Y1D _EQ(PAUSE)
338 #else
339 #error "Unsupported KBD_TYPE"
340 #endif
342 #endif /* __WINE_KBD_H */