diff --git a/reactos/lib/kbdru/kbdru.c b/reactos/lib/kbdru/kbdru.c index 759d0bf724c..49bc74486d5 100644 --- a/reactos/lib/kbdru/kbdru.c +++ b/reactos/lib/kbdru/kbdru.c @@ -14,8 +14,12 @@ #ifdef _M_IA64 #define ROSDATA static __declspec(allocate(".data")) #else +#ifdef _MSC_VER #pragma data_seg(".data") #define ROSDATA static +#else +#define ROSDATA static __attribute__((section(".data"))) +#endif #endif #define VK_EMPTY 0xff /* The non-existent VK */ @@ -31,50 +35,6 @@ #define SHFT_INVALID 0x0F -/* Thanks to http://asp.flaaten.dk/pforum/keycode/keycode.htm */ -#ifndef VK_OEM_1 -#define VK_OEM_1 0xba -#endif -#ifndef VK_OEM_PLUS -#define VK_OEM_PLUS 0xbb -#endif -#ifndef VK_OEM_COMMA -#define VK_OEM_COMMA 0xbc -#endif -#ifndef VK_OEM_MINUS -#define VK_OEM_MINUS 0xbd -#endif -#ifndef VK_OEM_PERIOD -#define VK_OEM_PERIOD 0xbe -#endif -#ifndef VK_OEM_2 -#define VK_OEM_2 0xbf -#endif -#ifndef VK_OEM_3 -#define VK_OEM_3 0xc0 -#endif -#ifndef VK_OEM_4 -#define VK_OEM_4 0xdb -#endif -#ifndef VK_OEM_5 -#define VK_OEM_5 0xdc -#endif -#ifndef VK_OEM_6 -#define VK_OEM_6 0xdd -#endif -#ifndef VK_OEM_7 -#define VK_OEM_7 0xde -#endif -#ifndef VK_OEM_8 -#define VK_OEM_8 0xdf -#endif -#ifndef VK_OEM_AX -#define VK_OEM_AX 0xe1 -#endif -#ifndef VK_OEM_102 -#define VK_OEM_102 0xe1 -#endif - ROSDATA USHORT scancode_to_vk[] = { /* Numbers Row */ /* - 00 - */ @@ -203,13 +163,7 @@ ROSDATA VK_TO_BIT modifier_keys[] = { { 0, 0 } }; -typedef struct _mymod { - PVOID mod_keys; - WORD maxmod; - BYTE mod_max[7]; -} INTERNAL_KBD_MODIFIERS; - -ROSDATA INTERNAL_KBD_MODIFIERS modifier_bits[] = { +ROSDATA MODIFIERS modifier_bits = { modifier_keys, 3, { 0, 1, 2, 3, 0, 0, 0xC0 } /* Modifier bit order, NONE, SHIFT, CTRL, ALT, MENU, SHIFT + MENU, CTRL + MENU */ @@ -219,99 +173,99 @@ ROSDATA INTERNAL_KBD_MODIFIERS modifier_bits[] = { #define CAPS KSHIFT /* Caps -> shift */ ROSDATA VK_TO_WCHARS2 key_to_chars_2mod[] = { - {VK_OEM_3, CAPS, 0x451, 0x401}, - { '1', NOCAPS, '1', '!' }, - { '3', NOCAPS, '3', 0x2116 }, - { '4', NOCAPS, '4', ';' }, - { '5', NOCAPS, '5', '%' }, - { '7', NOCAPS, '7', '?' }, - { '8', NOCAPS, '8', '*' }, - { '9', NOCAPS, '9', '(' }, - { '0', NOCAPS, '0', ')' }, - { VK_OEM_PLUS, NOCAPS, '=', '+' }, + {VK_OEM_3, CAPS, {0x451, 0x401} }, + { '1', NOCAPS, {'1', '!'} }, + { '3', NOCAPS, {'3', 0x2116} }, + { '4', NOCAPS, {'4', ';'} }, + { '5', NOCAPS, {'5', '%'} }, + { '7', NOCAPS, {'7', '?'} }, + { '8', NOCAPS, {'8', '*'} }, + { '9', NOCAPS, {'9', '('} }, + { '0', NOCAPS, {'0', ')'} }, + { VK_OEM_PLUS, NOCAPS, {'=', '+'} }, /* First letter row */ - { 'Q', CAPS, 0x439, 0x419 }, - { 'W', CAPS, 0x446, 0x426 }, - { 'E', CAPS, 0x443, 0x423 }, - { 'R', CAPS, 0x43a, 0x41a }, - { 'T', CAPS, 0x435, 0x415 }, - { 'Y', CAPS, 0x43d, 0x41d }, - { 'U', CAPS, 0x433, 0x413 }, - { 'I', CAPS, 0x448, 0x428 }, - { 'O', CAPS, 0x449, 0x429 }, - { 'P', CAPS, 0x437, 0x417 }, - { VK_OEM_4, CAPS, 0x445, 0x425 }, - { VK_OEM_6, CAPS, 0x44a, 0x42a }, + { 'Q', CAPS, {0x439, 0x419} }, + { 'W', CAPS, {0x446, 0x426} }, + { 'E', CAPS, {0x443, 0x423} }, + { 'R', CAPS, {0x43a, 0x41a} }, + { 'T', CAPS, {0x435, 0x415} }, + { 'Y', CAPS, {0x43d, 0x41d} }, + { 'U', CAPS, {0x433, 0x413} }, + { 'I', CAPS, {0x448, 0x428} }, + { 'O', CAPS, {0x449, 0x429} }, + { 'P', CAPS, {0x437, 0x417} }, + { VK_OEM_4, CAPS, {0x445, 0x425} }, + { VK_OEM_6, CAPS, {0x44a, 0x42a} }, /* Second letter row */ - { 'A', CAPS, 0x444, 0x424 }, - { 'S', CAPS, 0x44b, 0x42b }, - { 'D', CAPS, 0x432, 0x412 }, - { 'F', CAPS, 0x430, 0x410 }, - { 'G', CAPS, 0x43f, 0x41f }, - { 'H', CAPS, 0x440, 0x420 }, - { 'J', CAPS, 0x43e, 0x41e }, - { 'K', CAPS, 0x43b, 0x41b }, - { 'L', CAPS, 0x434, 0x414 }, - { VK_OEM_1, CAPS, 0x436, 0x416 }, - { VK_OEM_7, CAPS, 0x44d, 0x42d }, + { 'A', CAPS, {0x444, 0x424} }, + { 'S', CAPS, {0x44b, 0x42b} }, + { 'D', CAPS, {0x432, 0x412} }, + { 'F', CAPS, {0x430, 0x410} }, + { 'G', CAPS, {0x43f, 0x41f} }, + { 'H', CAPS, {0x440, 0x420} }, + { 'J', CAPS, {0x43e, 0x41e} }, + { 'K', CAPS, {0x43b, 0x41b} }, + { 'L', CAPS, {0x434, 0x414} }, + { VK_OEM_1, CAPS, {0x436, 0x416} }, + { VK_OEM_7, CAPS, {0x44d, 0x42d} }, /* Third letter row */ - { 'Z', CAPS, 0x44f, 0x42f }, - { 'X', CAPS, 0x447, 0x427 }, - { 'C', CAPS, 0x441, 0x421 }, - { 'V', CAPS, 0x43c, 0x41c }, - { 'B', CAPS, 0x438, 0x418 }, - { 'N', CAPS, 0x442, 0x422 }, - { 'M', CAPS, 0x44c, 0x42c }, - { VK_OEM_COMMA,CAPS, 0x431, 0x411 }, - { VK_OEM_PERIOD,CAPS, 0x44e, 0x42e }, - { VK_OEM_2, NOCAPS, '.', ',' }, + { 'Z', CAPS, {0x44f, 0x42f} }, + { 'X', CAPS, {0x447, 0x427} }, + { 'C', CAPS, {0x441, 0x421} }, + { 'V', CAPS, {0x43c, 0x41c} }, + { 'B', CAPS, {0x438, 0x418} }, + { 'N', CAPS, {0x442, 0x422} }, + { 'M', CAPS, {0x44c, 0x42c} }, + { VK_OEM_COMMA,CAPS, {0x431, 0x411} }, + { VK_OEM_PERIOD,CAPS, {0x44e, 0x42e} }, + { VK_OEM_2, NOCAPS, {'.', ','} }, /* Specials */ - { 0x6e, NOCAPS, ',', ','}, - { VK_TAB, NOCAPS, 9, 9}, - { VK_ADD, NOCAPS, '+', '+' }, - { VK_DIVIDE, NOCAPS, '/', '/' }, - { VK_MULTIPLY, NOCAPS, '*', '*' }, - { VK_SUBTRACT, NOCAPS, '-', '-' }, + { 0x6e, NOCAPS, {',', ','} }, + { VK_TAB, NOCAPS, {9, 9} }, + { VK_ADD, NOCAPS, {'+', '+'} }, + { VK_DIVIDE, NOCAPS, {'/', '/'} }, + { VK_MULTIPLY, NOCAPS, {'*', '*'} }, + { VK_SUBTRACT, NOCAPS, {'-', '-'} }, { 0, 0 } }; ROSDATA VK_TO_WCHARS3 key_to_chars_3mod[] = { /* Normal, Shifted, Ctrl */ /* Legacy (telnet-style) ascii escapes */ - { VK_OEM_5, NOCAPS, 0x5c,0x2f, 0x1c }, - { VK_OEM_102, NOCAPS, 0x5c,0x2f, 0x1c }, - { VK_BACK, NOCAPS, 0x8, 0x8, 0x7f }, - { VK_ESCAPE, NOCAPS, 0x1b, 0x1b, 0x1b }, - { VK_RETURN,NOCAPS, '\r', '\r', '\n' }, - { VK_SPACE, NOCAPS, ' ', ' ', ' ' }, - { VK_CANCEL, NOCAPS, 0x03, 0x03, 0x03 }, + { VK_OEM_5, NOCAPS, {0x5c, 0x2f, 0x1c} }, + { VK_OEM_102, NOCAPS, {0x5c, 0x2f, 0x1c} }, + { VK_BACK, NOCAPS, {0x8, 0x8, 0x7f} }, + { VK_ESCAPE, NOCAPS, {0x1b, 0x1b, 0x1b} }, + { VK_RETURN, NOCAPS, {'\r', '\r', '\n'} }, + { VK_SPACE, NOCAPS, {' ', ' ', ' '} }, + { VK_CANCEL, NOCAPS, {0x03, 0x03, 0x03} }, { 0,0 } }; ROSDATA VK_TO_WCHARS4 key_to_chars_4mod[] = { /* Normal, Shifted, Ctrl, Ctrl-Alt */ /* Legacy Ascii generators */ - { '2', NOCAPS, '2', '\"', WCH_NONE,0}, - { '6', NOCAPS, '6', ':', WCH_NONE,0x001e}, - { VK_OEM_MINUS, NOCAPS, 0x2d, '_', WCH_NONE, 0x001f}, // different '-' + { '2', NOCAPS, {'2', '\"', WCH_NONE, 0} }, + { '6', NOCAPS, {'6', ':', WCH_NONE, 0x001e} }, + { VK_OEM_MINUS, NOCAPS, {0x2d, '_', WCH_NONE, 0x001f} }, // different '-' { 0, 0 } }; ROSDATA VK_TO_WCHARS1 keypad_numbers[] = { - { VK_NUMPAD0, 0, '0' }, - { VK_NUMPAD1, 0, '1' }, - { VK_NUMPAD2, 0, '2' }, - { VK_NUMPAD3, 0, '3' }, - { VK_NUMPAD4, 0, '4' }, - { VK_NUMPAD5, 0, '5' }, - { VK_NUMPAD6, 0, '6' }, - { VK_NUMPAD7, 0, '7' }, - { VK_NUMPAD8, 0, '8' }, - { VK_NUMPAD9, 0, '9' }, + { VK_NUMPAD0, 0, {'0'} }, + { VK_NUMPAD1, 0, {'1'} }, + { VK_NUMPAD2, 0, {'2'} }, + { VK_NUMPAD3, 0, {'3'} }, + { VK_NUMPAD4, 0, {'4'} }, + { VK_NUMPAD5, 0, {'5'} }, + { VK_NUMPAD6, 0, {'6'} }, + { VK_NUMPAD7, 0, {'7'} }, + { VK_NUMPAD8, 0, {'8'} }, + { VK_NUMPAD9, 0, {'9'} }, { 0,0 } }; @@ -410,7 +364,7 @@ ROSDATA VSC_LPWSTR extended_key_names[] = { /* Finally, the master table */ ROSDATA KBDTABLES keyboard_layout_table = { /* modifier assignments */ - (PMODIFIERS)&modifier_bits, + &modifier_bits, /* character from vk tables */ vk_to_wchar_master_table, diff --git a/reactos/lib/kbdse/kbdse.c b/reactos/lib/kbdse/kbdse.c index 9addb8facdb..e11f9655ccd 100644 --- a/reactos/lib/kbdse/kbdse.c +++ b/reactos/lib/kbdse/kbdse.c @@ -13,8 +13,12 @@ #ifdef _M_IA64 #define ROSDATA static __declspec(allocate(".data")) #else +#ifdef _MSC_VER #pragma data_seg(".data") #define ROSDATA static +#else +#define ROSDATA static __attribute__((section(".data"))) +#endif #endif #define VK_EMPTY 0xff /* The non-existent VK */ @@ -30,47 +34,6 @@ #define SHFT_INVALID 0x0F -/* Thanks to http://asp.flaaten.dk/pforum/keycode/keycode.htm */ -#ifndef VK_OEM_1 -#define VK_OEM_1 0xba -#endif -#ifndef VK_OEM_PLUS -#define VK_OEM_PLUS 0xbb -#endif -#ifndef VK_OEM_COMMA -#define VK_OEM_COMMA 0xbc -#endif -#ifndef VK_OEM_MINUS -#define VK_OEM_MINUS 0xbd -#endif -#ifndef VK_OEM_PERIOD -#define VK_OEM_PERIOD 0xbe -#endif -#ifndef VK_OEM_2 -#define VK_OEM_2 0xbf -#endif -#ifndef VK_OEM_3 -#define VK_OEM_3 0xc0 -#endif -#ifndef VK_OEM_4 -#define VK_OEM_4 0xdb -#endif -#ifndef VK_OEM_5 -#define VK_OEM_5 0xdc -#endif -#ifndef VK_OEM_6 -#define VK_OEM_6 0xdd -#endif -#ifndef VK_OEM_7 -#define VK_OEM_7 0xde -#endif -#ifndef VK_OEM_8 -#define VK_OEM_8 0xdf -#endif -#ifndef VK_OEM_102 -#define VK_OEM_102 0xe1 -#endif - ROSDATA USHORT scancode_to_vk[] = { /* Numbers Row */ /* - 00 - */ @@ -199,13 +162,7 @@ ROSDATA VK_TO_BIT modifier_keys[] = { { 0, 0 } }; -typedef struct _mymod { - PVOID mod_keys; - WORD maxmod; - BYTE mod_max[7]; -} INTERNAL_KBD_MODIFIERS; - -ROSDATA INTERNAL_KBD_MODIFIERS modifier_bits[] = { +ROSDATA MODIFIERS modifier_bits = { modifier_keys, 6, { 0, 1, 2, 4, SHFT_INVALID, SHFT_INVALID, 3 } /* Modifier bit order, NONE, SHIFT, CTRL, ALT, MENU, SHIFT + MENU, CTRL + MENU */ @@ -217,68 +174,68 @@ ROSDATA INTERNAL_KBD_MODIFIERS modifier_bits[] = { ROSDATA VK_TO_WCHARS2 key_to_chars_2mod[] = { /* The numbers */ - { '1', NOCAPS, '1', '!' }, + { '1', NOCAPS, {'1', '!'} }, /* Ctrl-2 generates NUL */ /* First letter row */ - { 'Q', CAPS, 'q', 'Q' }, - { 'W', CAPS, 'w', 'W' }, - { 'R', CAPS, 'r', 'R' }, - { 'T', CAPS, 't', 'T' }, - { 'Y', CAPS, 'y', 'Y' }, - { 'U', CAPS, 'u', 'U' }, - { 'I', CAPS, 'i', 'I' }, - { 'O', CAPS, 'o', 'O' }, - { 'P', CAPS, 'p', 'P' }, + { 'Q', CAPS, {'q', 'Q'} }, + { 'W', CAPS, {'w', 'W'} }, + { 'R', CAPS, {'r', 'R'} }, + { 'T', CAPS, {'t', 'T'} }, + { 'Y', CAPS, {'y', 'Y'} }, + { 'U', CAPS, {'u', 'U'} }, + { 'I', CAPS, {'i', 'I'} }, + { 'O', CAPS, {'o', 'O'} }, + { 'P', CAPS, {'p', 'P'} }, /* Second letter row */ - { 'A', CAPS, 'a', 'A' }, - { 'S', CAPS, 's', 'S' }, - { 'D', CAPS, 'd', 'D' }, - { 'F', CAPS, 'f', 'F' }, - { 'G', CAPS, 'g', 'G' }, - { 'H', CAPS, 'h', 'H' }, - { 'J', CAPS, 'j', 'J' }, - { 'K', CAPS, 'k', 'K' }, - { 'L', CAPS, 'l', 'L' }, + { 'A', CAPS, {'a', 'A'} }, + { 'S', CAPS, {'s', 'S'} }, + { 'D', CAPS, {'d', 'D'} }, + { 'F', CAPS, {'f', 'F'} }, + { 'G', CAPS, {'g', 'G'} }, + { 'H', CAPS, {'h', 'H'} }, + { 'J', CAPS, {'j', 'J'} }, + { 'K', CAPS, {'k', 'K'} }, + { 'L', CAPS, {'l', 'L'} }, /* Third letter row */ - { 'Z', CAPS, 'z', 'Z' }, - { 'X', CAPS, 'x', 'X' }, - { 'C', CAPS, 'c', 'C' }, - { 'V', CAPS, 'v', 'V' }, - { 'B', CAPS, 'b', 'B' }, - { 'N', CAPS, 'n', 'N' }, + { 'Z', CAPS, {'z', 'Z'} }, + { 'X', CAPS, {'x', 'X'} }, + { 'C', CAPS, {'c', 'C'} }, + { 'V', CAPS, {'v', 'V'} }, + { 'B', CAPS, {'b', 'B'} }, + { 'N', CAPS, {'n', 'N'} }, /* Specials */ - { VK_OEM_4, NOCAPS, WCH_DEAD, WCH_DEAD}, - { VK_OEM_7, CAPS, 0xe4,0xc4}, - { VK_OEM_3, CAPS, 0xf6, 0xd6 }, + { VK_OEM_4, NOCAPS, {WCH_DEAD, WCH_DEAD} }, + { VK_OEM_7, CAPS, {0xe4,0xc4} }, + { VK_OEM_3, CAPS, {0xf6, 0xd6} }, - { VK_OEM_COMMA, CAPS, ',', ';' }, - { VK_OEM_PERIOD, CAPS, '.', ':' }, - { VK_OEM_2, NOCAPS, '\'', '*' }, + { VK_OEM_COMMA, CAPS, {',', ';'} }, + { VK_OEM_PERIOD, CAPS, {'.', ':'} }, + { VK_OEM_2, NOCAPS, {'\'', '*'} }, - { VK_DECIMAL, NOCAPS, ',',','}, - { VK_TAB, NOCAPS, '\t', '\t' }, - { VK_ADD, NOCAPS, '+', '+' }, - { VK_DIVIDE, NOCAPS, '/', '/' }, - { VK_MULTIPLY, NOCAPS, '*', '*' }, - { VK_SUBTRACT, NOCAPS, '-', '-' }, + { VK_DECIMAL, NOCAPS, {',',','} }, + { VK_TAB, NOCAPS, {'\t', '\t'} }, + { VK_ADD, NOCAPS, {'+', '+'} }, + { VK_DIVIDE, NOCAPS, {'/', '/'} }, + { VK_MULTIPLY, NOCAPS, {'*', '*'} }, + { VK_SUBTRACT, NOCAPS, {'-', '-'} }, { 0, 0 } }; ROSDATA VK_TO_WCHARS3 key_to_chars_3mod[] = { /* Normal, Shifted, Ctrl */ /* Legacy (telnet-style) ascii escapes */ - {VK_OEM_6, CAPS, 0xe5,0xc5, 0x1d /* GS */ }, - { VK_OEM_5, NOCAPS, 0xa7,0xbd, 0x1c /* FS */ }, - { VK_OEM_MINUS, NOCAPS, '-', '_', 0x1f /* US */ }, - { VK_RETURN,NOCAPS, '\r', '\r', '\n' }, + {VK_OEM_6, CAPS, {0xe5,0xc5, 0x1d /* GS */} }, + { VK_OEM_5, NOCAPS, {0xa7,0xbd, 0x1c /* FS */} }, + { VK_OEM_MINUS, NOCAPS, {'-', '_', 0x1f /* US */} }, + { VK_RETURN,NOCAPS, {'\r', '\r', '\n'} }, - { VK_BACK, NOCAPS, '\b', '\b', 0x7f }, - { VK_ESCAPE, NOCAPS, 0x1b, 0x1b, 0x1b }, - { VK_SPACE, NOCAPS, ' ', ' ', ' ' }, - { VK_CANCEL, NOCAPS, 0x03, 0x03, 0x03 }, + { VK_BACK, NOCAPS, {'\b', '\b', 0x7f} }, + { VK_ESCAPE, NOCAPS, {0x1b, 0x1b, 0x1b} }, + { VK_SPACE, NOCAPS, {' ', ' ', ' '} }, + { VK_CANCEL, NOCAPS, {0x03, 0x03, 0x03} }, { 0,0 } }; @@ -287,40 +244,40 @@ ROSDATA VK_TO_WCHARS4 key_to_chars_4mod[] = { /* Normal, Shifted, Ctrl, Ctrl-Alt */ /* Legacy Ascii generators */ - { '2', NOCAPS, '2', '\"', WCH_NONE,'@'}, - { '3', NOCAPS, '3', '#', WCH_NONE, 0x00a3}, - { '4', NOCAPS, '4', 0xa4, WCH_NONE, '$'}, - { '5', NOCAPS, '5', '%', WCH_NONE, 0x00ac}, - { '7', NOCAPS, '7', '/', WCH_NONE, '{' }, - { '8', NOCAPS, '8', '(', WCH_NONE, '[' }, - { '9', NOCAPS, '9', ')', WCH_NONE, ']' }, - { '0', NOCAPS, '0', '=', WCH_NONE, '}' }, - { VK_OEM_PLUS ,NOCAPS, '+', '?', WCH_NONE, '\\' }, - { 'E', CAPS, 'e', 'E' , WCH_NONE, 0x00ac}, - { VK_OEM_1 ,NOCAPS, 0xa8, '^', 0x001d, '~' }, - { 'M', CAPS, 'm', 'M', WCH_NONE, 0x00b5 }, - {VK_OEM_102, NOCAPS, '<', '>' ,0x001c,'|'}, + { '2', NOCAPS, {'2', '\"', WCH_NONE,'@'} }, + { '3', NOCAPS, {'3', '#', WCH_NONE, 0x00a3} }, + { '4', NOCAPS, {'4', 0xa4, WCH_NONE, '$'} }, + { '5', NOCAPS, {'5', '%', WCH_NONE, 0x00ac} }, + { '7', NOCAPS, {'7', '/', WCH_NONE, '{'} }, + { '8', NOCAPS, {'8', '(', WCH_NONE, '['} }, + { '9', NOCAPS, {'9', ')', WCH_NONE, ']'} }, + { '0', NOCAPS, {'0', '=', WCH_NONE, '}'} }, + { VK_OEM_PLUS ,NOCAPS, {'+', '?', WCH_NONE, '\\'} }, + { 'E', CAPS, {'e', 'E' , WCH_NONE, 0x00ac} }, + { VK_OEM_1 ,NOCAPS, {0xa8, '^', 0x001d, '~'} }, + { 'M', CAPS, {'m', 'M', WCH_NONE, 0x00b5} }, + {VK_OEM_102, NOCAPS, {'<', '>' ,0x001c,'|'} }, { 0, 0 } }; ROSDATA VK_TO_WCHARS5 key_to_chars_5mod[] = { /* Normal, Shifted, Ctrl, Ctrl-Alt, C-S-x */ - { '6', NOCAPS, '6', '&', WCH_NONE, WCH_NONE, 0x1e /* RS */ }, + { '6', NOCAPS, {'6', '&', WCH_NONE, WCH_NONE, 0x1e /* RS */} }, { 0, 0 } }; ROSDATA VK_TO_WCHARS1 keypad_numbers[] = { - { VK_DECIMAL, 0, '.' }, - { VK_NUMPAD0, 0, '0' }, - { VK_NUMPAD1, 0, '1' }, - { VK_NUMPAD2, 0, '2' }, - { VK_NUMPAD3, 0, '3' }, - { VK_NUMPAD4, 0, '4' }, - { VK_NUMPAD5, 0, '5' }, - { VK_NUMPAD6, 0, '6' }, - { VK_NUMPAD7, 0, '7' }, - { VK_NUMPAD8, 0, '8' }, - { VK_NUMPAD9, 0, '9' }, + { VK_DECIMAL, 0, {'.'} }, + { VK_NUMPAD0, 0, {'0'} }, + { VK_NUMPAD1, 0, {'1'} }, + { VK_NUMPAD2, 0, {'2'} }, + { VK_NUMPAD3, 0, {'3'} }, + { VK_NUMPAD4, 0, {'4'} }, + { VK_NUMPAD5, 0, {'5'} }, + { VK_NUMPAD6, 0, {'6'} }, + { VK_NUMPAD7, 0, {'7'} }, + { VK_NUMPAD8, 0, {'8'} }, + { VK_NUMPAD9, 0, {'9'} }, { 0,0 } }; @@ -494,7 +451,7 @@ ROSDATA DEADKEY dead_key[] = { /* Finally, the master table */ ROSDATA KBDTABLES keyboard_layout_table = { /* modifier assignments */ - (PMODIFIERS)&modifier_bits, + &modifier_bits, /* character from vk tables */ vk_to_wchar_master_table, diff --git a/reactos/lib/kbdsg/kbdsg.c b/reactos/lib/kbdsg/kbdsg.c index d95765677c3..ea4320500f5 100644 --- a/reactos/lib/kbdsg/kbdsg.c +++ b/reactos/lib/kbdsg/kbdsg.c @@ -15,8 +15,12 @@ #ifdef _M_IA64 #define ROSDATA static __declspec(allocate(".data")) #else +#ifdef _MSC_VER #pragma data_seg(".data") #define ROSDATA static +#else +#define ROSDATA static __attribute__((section(".data"))) +#endif #endif #define VK_EMPTY 0xff /* The non-existent VK */ @@ -32,47 +36,6 @@ #define SHFT_INVALID 0x0F -/* Thanks to http://asp.flaaten.dk/pforum/keycode/keycode.htm */ -#ifndef VK_OEM_1 -#define VK_OEM_1 0xba -#endif -#ifndef VK_OEM_PLUS -#define VK_OEM_PLUS 0xbb /* actually this is ¨ ! ] on the Swiss German Keyboard */ -#endif -#ifndef VK_OEM_COMMA -#define VK_OEM_COMMA 0xbc -#endif -#ifndef VK_OEM_MINUS -#define VK_OEM_MINUS 0xbd -#endif -#ifndef VK_OEM_PERIOD -#define VK_OEM_PERIOD 0xbe -#endif -#ifndef VK_OEM_2 -#define VK_OEM_2 0xbf -#endif -#ifndef VK_OEM_3 -#define VK_OEM_3 0xc0 -#endif -#ifndef VK_OEM_4 -#define VK_OEM_4 0xdb -#endif -#ifndef VK_OEM_5 -#define VK_OEM_5 0xdc -#endif -#ifndef VK_OEM_6 -#define VK_OEM_6 0xdd -#endif -#ifndef VK_OEM_7 -#define VK_OEM_7 0xde -#endif -#ifndef VK_OEM_8 -#define VK_OEM_8 0xdf -#endif -#ifndef VK_OEM_102 -#define VK_OEM_102 0xe1 -#endif - ROSDATA USHORT scancode_to_vk[] = { /* Numbers Row */ /* - 00 - */ @@ -201,13 +164,7 @@ ROSDATA VK_TO_BIT modifier_keys[] = { { 0, 0 } }; -typedef struct _mymod { - PVOID mod_keys; - WORD maxmod; - BYTE mod_max[7]; -} INTERNAL_KBD_MODIFIERS; - -ROSDATA INTERNAL_KBD_MODIFIERS modifier_bits[] = { +ROSDATA MODIFIERS modifier_bits = { modifier_keys, 6, { 0, 1, 3, 4, SHFT_INVALID, SHFT_INVALID, 2 } /* Modifier bit order, NONE, SHIFT, CTRL, ALT, MENU, SHIFT + MENU, CTRL + MENU */ @@ -224,111 +181,111 @@ ROSDATA INTERNAL_KBD_MODIFIERS modifier_bits[] = { #define CAPS KSHIFT /* Caps -> shift */ ROSDATA VK_TO_WCHARS2 key_to_chars_2mod[] = { - { VK_OEM_5, NOCAPS, 0xa7, 0xb0}, /* § ° */ + { VK_OEM_5, NOCAPS, {0xa7, 0xb0} }, /* § ° */ /* Normal vs Shifted */ /* The numbers */ /* Ctrl-2 generates NUL */ - { 0xff, NOCAPS, 0xa7, 0x9B }, /* what is this for? */ - { '4', NOCAPS, '4', 0xE7 }, - { '5', NOCAPS, '5', '%' }, - { '9', NOCAPS, '9', ')' }, - { '0', NOCAPS, '0', '=' }, + { 0xff, NOCAPS, {0xa7, 0x9B} }, /* what is this for? */ + { '4', NOCAPS, {'4', 0xE7} }, + { '5', NOCAPS, {'5', '%'} }, + { '9', NOCAPS, {'9', ')'} }, + { '0', NOCAPS, {'0', '='} }, /* First letter row */ - { 'W', CAPS, 'w', 'W' }, - { 'R', CAPS, 'r', 'R' }, - { 'T', CAPS, 't', 'T' }, - { 'Z', CAPS, 'z', 'Z' }, - { 'U', CAPS, 'u', 'U' }, - { 'I', CAPS, 'i', 'I' }, - { 'O', CAPS, 'o', 'O' }, - { 'P', CAPS, 'p', 'P' }, + { 'W', CAPS, {'w', 'W'} }, + { 'R', CAPS, {'r', 'R'} }, + { 'T', CAPS, {'t', 'T'} }, + { 'Z', CAPS, {'z', 'Z'} }, + { 'U', CAPS, {'u', 'U'} }, + { 'I', CAPS, {'i', 'I'} }, + { 'O', CAPS, {'o', 'O'} }, + { 'P', CAPS, {'p', 'P'} }, /* Second letter row */ - { 'A', CAPS, 'a', 'A' }, - { 'S', CAPS, 's', 'S' }, - { 'D', CAPS, 'd', 'D' }, - { 'F', CAPS, 'f', 'F' }, - { 'G', CAPS, 'g', 'G' }, - { 'H', CAPS, 'h', 'H' }, - { 'J', CAPS, 'j', 'J' }, - { 'K', CAPS, 'k', 'K' }, - { 'L', CAPS, 'l', 'L' }, + { 'A', CAPS, {'a', 'A'} }, + { 'S', CAPS, {'s', 'S'} }, + { 'D', CAPS, {'d', 'D'} }, + { 'F', CAPS, {'f', 'F'} }, + { 'G', CAPS, {'g', 'G'} }, + { 'H', CAPS, {'h', 'H'} }, + { 'J', CAPS, {'j', 'J'} }, + { 'K', CAPS, {'k', 'K'} }, + { 'L', CAPS, {'l', 'L'} }, /* Third letter row */ - { 'Y', CAPS, 'y', 'Y' }, - { 'X', CAPS, 'x', 'X' }, - { 'V', CAPS, 'v', 'V' }, - { 'B', CAPS, 'b', 'B' }, - { 'N', CAPS, 'n', 'N' }, + { 'Y', CAPS, {'y', 'Y'} }, + { 'X', CAPS, {'x', 'X'} }, + { 'V', CAPS, {'v', 'V'} }, + { 'B', CAPS, {'b', 'B'} }, + { 'N', CAPS, {'n', 'N'} }, /* Specials */ - { VK_OEM_COMMA, NOCAPS, ',', ';' }, - { VK_OEM_PERIOD, NOCAPS, '.', ':' }, - { VK_OEM_MINUS, NOCAPS, '-', '_' }, - { VK_DECIMAL, NOCAPS, '.', '.' }, - { VK_TAB, NOCAPS, '\t', '\t' }, - { VK_ADD, NOCAPS, '+', '+' }, - { VK_DIVIDE, NOCAPS, 0x2f, 0x2f }, /* '/' */ - { VK_MULTIPLY, NOCAPS, '*', '*' }, - { VK_SUBTRACT, NOCAPS, '-', '-' }, + { VK_OEM_COMMA, NOCAPS, {',', ';'} }, + { VK_OEM_PERIOD, NOCAPS, {'.', ':'} }, + { VK_OEM_MINUS, NOCAPS, {'-', '_'} }, + { VK_DECIMAL, NOCAPS, {'.', '.'} }, + { VK_TAB, NOCAPS, {'\t', '\t'} }, + { VK_ADD, NOCAPS, {'+', '+'} }, + { VK_DIVIDE, NOCAPS, {0x2f, 0x2f} }, /* '/' */ + { VK_MULTIPLY, NOCAPS, {'*', '*'} }, + { VK_SUBTRACT, NOCAPS, {'-', '-'} }, { 0, 0 } }; ROSDATA VK_TO_WCHARS3 key_to_chars_3mod[] = { /* Normal, Shifted, Alt Gr */ /* Legacy (telnet-style) ascii escapes */ - { VK_OEM_4, NOCAPS, '\'' , '?' , WCH_DEAD }, /* ' ? ´ */ - { 0xff, NOCAPS, WCH_NONE, WCH_NONE, 0xb4 }, - { 'Q', CAPS, 'q', 'Q', '@' }, - { 'C', CAPS, 'c', 'C', 0xa9}, /* c C Copyright-Sign */ - { 'E', CAPS, 'e', 'E', 0x20ac }, /* e E € */ - { 'M', CAPS, 'm', 'M', 0xb5 }, /* m M mu-Sign */ - { VK_OEM_102, NOCAPS, '<', '>', '\\' }, + { VK_OEM_4, NOCAPS, {'\'' , '?' , WCH_DEAD} }, /* ' ? ´ */ + { 0xff, NOCAPS, {WCH_NONE, WCH_NONE, 0xb4} }, + { 'Q', CAPS, {'q', 'Q', '@'} }, + { 'C', CAPS, {'c', 'C', 0xa9} }, /* c C Copyright-Sign */ + { 'E', CAPS, {'e', 'E', 0x20ac} }, /* e E € */ + { 'M', CAPS, {'m', 'M', 0xb5} }, /* m M mu-Sign */ + { VK_OEM_102, NOCAPS, {'<', '>', '\\'} }, { 0,0 } }; ROSDATA VK_TO_WCHARS4 key_to_chars_4mod[] = { /* Normal, Shifted, Alt Gr, C-S-x */ /* Legacy Ascii generators */ - { VK_BACK, NOCAPS, '\b', '\b', WCH_NONE, 0x7f }, - { VK_ESCAPE, NOCAPS, 0x1b, 0x1b, WCH_NONE, 0x1b }, - { VK_RETURN, NOCAPS, '\r', '\r', WCH_NONE, '\n' }, - { VK_SPACE, NOCAPS, ' ', ' ', WCH_NONE, ' ' }, - { VK_CANCEL, NOCAPS, 0x03, 0x03, WCH_NONE, 0x03 }, + { VK_BACK, NOCAPS, {'\b', '\b', WCH_NONE, 0x7f} }, + { VK_ESCAPE, NOCAPS, {0x1b, 0x1b, WCH_NONE, 0x1b} }, + { VK_RETURN, NOCAPS, {'\r', '\r', WCH_NONE, '\n'} }, + { VK_SPACE, NOCAPS, {' ', ' ', WCH_NONE, ' '} }, + { VK_CANCEL, NOCAPS, {0x03, 0x03, WCH_NONE, 0x03} }, { 0, 0 } }; ROSDATA VK_TO_WCHARS5 key_to_chars_5mod[] = { /* Normal, Shifted, Alt Gr, Ctrl */ - { '1', NOCAPS, '1', '+', '|', WCH_NONE, 0x00 }, - { '2', NOCAPS, '2', '\"', '@', WCH_NONE, 0x00 }, - { '3', NOCAPS, '3', '*', '#', WCH_NONE, 0x00 }, - { '6', NOCAPS, '6', '&', 0xac, WCH_NONE, 0x00 }, - { '7', NOCAPS, '7', '/', 0xa6, WCH_NONE, 0x00 }, - { '8', NOCAPS, '8', '(', 0xa2, WCH_NONE, 0x00 }, - { VK_OEM_1, KCTRL, 0xfc, 0xe8, 0x5b, 0Xdc, 0xc8 }, /* ü è [ Ü È */ - { VK_OEM_2, NOCAPS, 0x24, 0xa3, 0x7d, WCH_NONE, 0x00 }, /* $ £ } */ - { VK_OEM_3, KCTRL, 0xf6, 0xe9, WCH_NONE, 0xd6, 0xc9 }, /* ö é Ö É*/ - { VK_OEM_6, NOCAPS, WCH_DEAD, WCH_DEAD, WCH_DEAD, WCH_NONE, 0x00 }, /* ^ ` ~ */ - { 0xff, NOCAPS, 0x5e , 0x27 , 0x7e , WCH_NONE, 0x00 }, - { VK_OEM_7, KCTRL, 0xe4, 0xe0, 0x7b, 0xc4, 0xc0 }, /* ä à { Ä À */ - { VK_OEM_PLUS, NOCAPS, WCH_DEAD, 0x21 , 0x5D , WCH_NONE, 0x00 }, /* ¨ ! ] */ - { 0xff, NOCAPS, 0xa8 , WCH_NONE, WCH_NONE, WCH_NONE, 0x00 }, + { '1', NOCAPS, {'1', '+', '|', WCH_NONE, 0x00} }, + { '2', NOCAPS, {'2', '\"', '@', WCH_NONE, 0x00} }, + { '3', NOCAPS, {'3', '*', '#', WCH_NONE, 0x00} }, + { '6', NOCAPS, {'6', '&', 0xac, WCH_NONE, 0x00} }, + { '7', NOCAPS, {'7', '/', 0xa6, WCH_NONE, 0x00} }, + { '8', NOCAPS, {'8', '(', 0xa2, WCH_NONE, 0x00} }, + { VK_OEM_1, KCTRL, {0xfc, 0xe8, 0x5b, 0Xdc, 0xc8} }, /* ü è [ Ü È */ + { VK_OEM_2, NOCAPS, {0x24, 0xa3, 0x7d, WCH_NONE, 0x00} }, /* $ £ } */ + { VK_OEM_3, KCTRL, {0xf6, 0xe9, WCH_NONE, 0xd6, 0xc9} }, /* ö é Ö É*/ + { VK_OEM_6, NOCAPS, {WCH_DEAD, WCH_DEAD, WCH_DEAD, WCH_NONE, 0x00} }, /* ^ ` ~ */ + { 0xff, NOCAPS, {0x5e , 0x27 , 0x7e , WCH_NONE, 0x00} }, + { VK_OEM_7, KCTRL, {0xe4, 0xe0, 0x7b, 0xc4, 0xc0} }, /* ä à { Ä À */ + { VK_OEM_PLUS, NOCAPS, {WCH_DEAD, 0x21 , 0x5D , WCH_NONE, 0x00} }, /* ¨ ! ] */ + { 0xff, NOCAPS, {0xa8 , WCH_NONE, WCH_NONE, WCH_NONE, 0x00} }, { 0, 0 } }; ROSDATA VK_TO_WCHARS1 keypad_numbers[] = { - { VK_DECIMAL, 0, '.' }, /* I have no idea why this has to be like this. Shouldn't it be a "."? */ - { VK_NUMPAD0, 0, '0' }, - { VK_NUMPAD1, 0, '1' }, - { VK_NUMPAD2, 0, '2' }, - { VK_NUMPAD3, 0, '3' }, - { VK_NUMPAD4, 0, '4' }, - { VK_NUMPAD5, 0, '5' }, - { VK_NUMPAD6, 0, '6' }, - { VK_NUMPAD7, 0, '7' }, - { VK_NUMPAD8, 0, '8' }, - { VK_NUMPAD9, 0, '9' }, + { VK_DECIMAL, 0, {'.'} }, /* I have no idea why this has to be like this. Shouldn't it be a "."? */ + { VK_NUMPAD0, 0, {'0'} }, + { VK_NUMPAD1, 0, {'1'} }, + { VK_NUMPAD2, 0, {'2'} }, + { VK_NUMPAD3, 0, {'3'} }, + { VK_NUMPAD4, 0, {'4'} }, + { VK_NUMPAD5, 0, {'5'} }, + { VK_NUMPAD6, 0, {'6'} }, + { VK_NUMPAD7, 0, {'7'} }, + { VK_NUMPAD8, 0, {'8'} }, + { VK_NUMPAD9, 0, {'9'} }, // { VK_BACK, 0, '\010' }, { 0,0 } }; @@ -496,7 +453,7 @@ ROSDATA DEADKEY dead_key[] = { /* Finally, the master table */ ROSDATA KBDTABLES keyboard_layout_table = { /* modifier assignments */ - (PMODIFIERS)&modifier_bits, + &modifier_bits, /* character from vk tables */ vk_to_wchar_master_table,