diff --git a/reactos/lib/kbdda/kbdda.c b/reactos/lib/kbdda/kbdda.c index c132f8201fd..53b9522a03b 100644 --- a/reactos/lib/kbdda/kbdda.c +++ b/reactos/lib/kbdda/kbdda.c @@ -8,8 +8,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 */ @@ -25,47 +29,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 - */ @@ -194,13 +157,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 */ @@ -212,67 +169,67 @@ ROSDATA INTERNAL_KBD_MODIFIERS modifier_bits[] = { ROSDATA VK_TO_WCHARS2 key_to_chars_2mod[] = { /* Normal vs Shifted */ /* The numbers */ - { VK_OEM_5, NOCAPS, 0xbd, 0xa7 }, - { '1', NOCAPS, '1', '!' }, + { VK_OEM_5, NOCAPS, {0xbd, 0xa7} }, + { '1', NOCAPS, {'1', '!'} }, /* Ctrl-2 generates NUL */ - { VK_OEM_PLUS, NOCAPS, '+', '?' }, + { VK_OEM_PLUS, NOCAPS, {'+', '?'} }, /* 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' }, - { VK_OEM_6, CAPS, 0xe5, 0xc5, }, /* Å */ + { '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'} }, + { VK_OEM_6, CAPS, {0xe5, 0xc5} }, /* Å */ /* 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_7, CAPS, 0xf8, 0xd8 }, /* Ø */ - { VK_OEM_3, CAPS, 0xe6, 0xc6 }, /* Æ */ + { VK_OEM_7, CAPS, {0xf8, 0xd8} }, /* Ø */ + { VK_OEM_3, CAPS, {0xe6, 0xc6} }, /* Æ */ - { 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_MINUS, NOCAPS, '-', '_', 0x1f /* US */ }, - { VK_RETURN, NOCAPS, '\r', '\r', '\n' }, + { 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 } }; @@ -280,44 +237,44 @@ ROSDATA VK_TO_WCHARS3 key_to_chars_3mod[] = { 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, 0x20ac }, - { '7', NOCAPS, '7', '/', WCH_NONE, '{' }, - { '8', NOCAPS, '8', '(', WCH_NONE, '[' }, - { '9', NOCAPS, '9', ')', WCH_NONE, ']' }, - { '0', NOCAPS, '0', '=', WCH_NONE, '}' }, - { VK_OEM_4, NOCAPS, WCH_DEAD, WCH_DEAD, WCH_DEAD, '|' }, - { VK_EMPTY , NOCAPS, 0xb4, '`', '|', WCH_NONE }, + { '2', NOCAPS, {'2', '\"', WCH_NONE, '@'} }, + { '3', NOCAPS, {'3', '#', WCH_NONE, 0x00a3} }, + { '4', NOCAPS, {'4', 0xa4, WCH_NONE, '$'} }, + { '5', NOCAPS, {'5', '%', WCH_NONE, 0x20ac} }, + { '7', NOCAPS, {'7', '/', WCH_NONE, '{'} }, + { '8', NOCAPS, {'8', '(', WCH_NONE, '['} }, + { '9', NOCAPS, {'9', ')', WCH_NONE, ']'} }, + { '0', NOCAPS, {'0', '=', WCH_NONE, '}'} }, + { VK_OEM_4, NOCAPS, {WCH_DEAD, WCH_DEAD, WCH_DEAD, '|'} }, + { VK_EMPTY , NOCAPS, {0xb4, '`', '|', WCH_NONE} }, - { 'E', CAPS, 'e', 'E', WCH_NONE, 0x20ac }, - { VK_OEM_1, NOCAPS, WCH_DEAD, WCH_DEAD, WCH_NONE, WCH_DEAD }, - { VK_EMPTY , NOCAPS, 0xa8, '^', WCH_NONE, '~' }, + { 'E', CAPS, {'e', 'E', WCH_NONE, 0x20ac} }, + { VK_OEM_1, NOCAPS, {WCH_DEAD, WCH_DEAD, WCH_NONE, WCH_DEAD} }, + { VK_EMPTY , NOCAPS, {0xa8, '^', WCH_NONE, '~'} }, - { 'M', CAPS, 'm', 'M', WCH_NONE, 0x00b5 }, - { VK_OEM_102, NOCAPS, '<', '>', 0x001c, '\\' }, + { '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_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, {'.'} }, { 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, diff --git a/reactos/lib/kbddv/kbddv.c b/reactos/lib/kbddv/kbddv.c index 77f9e620d45..e9fe4c4c8a8 100644 --- a/reactos/lib/kbddv/kbddv.c +++ b/reactos/lib/kbddv/kbddv.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 */ @@ -28,47 +32,6 @@ #define KNUMS 0xc00 /* Special + number pad */ #define KMEXT 0x300 /* Multi + ext */ -/* 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 - */ @@ -158,13 +121,7 @@ ROSDATA VK_TO_BIT modifier_keys[] = { { 0, 0 } }; -typedef struct _mymod { - PVOID mod_keys; - WORD maxmod; - BYTE mod_max[4]; -} INTERNAL_KBD_MODIFIERS; - -ROSDATA INTERNAL_KBD_MODIFIERS modifier_bits[] = { +ROSDATA MODIFIERS modifier_bits = { modifier_keys, 3, { 0, 1, 2, 3 } /* Modifier bit order, NONE, SHIFT, CTRL, ALT */ @@ -176,98 +133,98 @@ ROSDATA INTERNAL_KBD_MODIFIERS modifier_bits[] = { ROSDATA VK_TO_WCHARS2 key_to_chars_2mod[] = { /* Normal vs Shifted */ /* The numbers */ - { '1', NOCAPS, '1', '!' }, + { '1', NOCAPS, {'1', '!'} }, /* Ctrl-2 generates NUL */ - { '3', NOCAPS, '3', '#' }, - { '4', NOCAPS, '4', '$' }, - { '5', NOCAPS, '5', '%' }, + { '3', NOCAPS, {'3', '#'} }, + { '4', NOCAPS, {'4', '$'} }, + { '5', NOCAPS, {'5', '%'} }, /* Ctrl-6 generates RS */ - { '7', NOCAPS, '7', '&' }, - { '8', NOCAPS, '8', '*' }, - { '9', NOCAPS, '9', '(' }, - { '0', NOCAPS, '0', ')' }, + { '7', NOCAPS, {'7', '&'} }, + { '8', NOCAPS, {'8', '*'} }, + { '9', NOCAPS, {'9', '('} }, + { '0', NOCAPS, {'0', ')'} }, /* First letter row */ - { 'P', CAPS, 'p', 'P' }, - { 'Y', CAPS, 'y', 'Y' }, - { 'F', CAPS, 'f', 'F' }, - { 'G', CAPS, 'g', 'G' }, - { 'C', CAPS, 'c', 'C' }, - { 'R', CAPS, 'r', 'R' }, - { 'L', CAPS, 'l', 'L' }, + { 'P', CAPS, {'p', 'P'} }, + { 'Y', CAPS, {'y', 'Y'} }, + { 'F', CAPS, {'f', 'F'} }, + { 'G', CAPS, {'g', 'G'} }, + { 'C', CAPS, {'c', 'C'} }, + { 'R', CAPS, {'r', 'R'} }, + { 'L', CAPS, {'l', 'L'} }, /* Second letter row */ - { 'A', CAPS, 'a', 'A' }, - { 'O', CAPS, 'o', 'O' }, - { 'E', CAPS, 'e', 'E' }, - { 'U', CAPS, 'u', 'U' }, - { 'I', CAPS, 'i', 'I' }, - { 'D', CAPS, 'd', 'D' }, - { 'H', CAPS, 'h', 'H' }, - { 'T', CAPS, 't', 'T' }, - { 'N', CAPS, 'n', 'N' }, - { 'S', CAPS, 's', 'S' }, + { 'A', CAPS, {'a', 'A'} }, + { 'O', CAPS, {'o', 'O'} }, + { 'E', CAPS, {'e', 'E'} }, + { 'U', CAPS, {'u', 'U'} }, + { 'I', CAPS, {'i', 'I'} }, + { 'D', CAPS, {'d', 'D'} }, + { 'H', CAPS, {'h', 'H'} }, + { 'T', CAPS, {'t', 'T'} }, + { 'N', CAPS, {'n', 'N'} }, + { 'S', CAPS, {'s', 'S'} }, /* Third letter row */ - { 'Q', CAPS, 'q', 'Q' }, - { 'J', CAPS, 'j', 'J' }, - { 'K', CAPS, 'k', 'K' }, - { 'X', CAPS, 'x', 'X' }, - { 'B', CAPS, 'b', 'B' }, - { 'M', CAPS, 'm', 'M' }, - { 'W', CAPS, 'w', 'W' }, - { 'V', CAPS, 'v', 'V' }, - { 'Z', CAPS, 'z', 'Z' }, + { 'Q', CAPS, {'q', 'Q'} }, + { 'J', CAPS, {'j', 'J'} }, + { 'K', CAPS, {'k', 'K'} }, + { 'X', CAPS, {'x', 'X'} }, + { 'B', CAPS, {'b', 'B'} }, + { 'M', CAPS, {'m', 'M'} }, + { 'W', CAPS, {'w', 'W'} }, + { 'V', CAPS, {'v', 'V'} }, + { 'Z', CAPS, {'z', 'Z'} }, /* Specials */ /* Ctrl-_ generates US */ - { VK_OEM_7 ,NOCAPS, '\'','\"'}, - { VK_OEM_COMMA ,NOCAPS, ',', '<' }, - { VK_OEM_PERIOD ,NOCAPS, '.', '>' }, - { VK_OEM_2 ,NOCAPS, '/', '?' }, - { VK_OEM_PLUS ,NOCAPS, '=', '+' }, - { VK_OEM_1 ,NOCAPS, ';', ':' }, - { VK_OEM_3 ,NOCAPS, '`', '~' }, + { VK_OEM_7 ,NOCAPS, {'\'','\"'} }, + { VK_OEM_COMMA ,NOCAPS, {',', '<'} }, + { VK_OEM_PERIOD ,NOCAPS, {'.', '>'} }, + { VK_OEM_2 ,NOCAPS, {'/', '?'} }, + { VK_OEM_PLUS ,NOCAPS, {'=', '+'} }, + { VK_OEM_1 ,NOCAPS, {';', ':'} }, + { VK_OEM_3 ,NOCAPS, {'`', '~'} }, /* Keys that do not have shift states */ - { VK_TAB ,NOCAPS, '\t','\t'}, - { VK_ADD ,NOCAPS, '+', '+' }, - { VK_SUBTRACT,NOCAPS, '-', '-' }, - { VK_MULTIPLY,NOCAPS, '*', '*' }, - { VK_DIVIDE ,NOCAPS, '/', '/' }, - { VK_ESCAPE ,NOCAPS, '\x1b','\x1b' }, - { VK_SPACE ,NOCAPS, ' ', ' ' }, + { VK_TAB ,NOCAPS, {'\t','\t'} }, + { VK_ADD ,NOCAPS, {'+', '+'} }, + { VK_SUBTRACT,NOCAPS, {'-', '-'} }, + { VK_MULTIPLY,NOCAPS, {'*', '*'} }, + { VK_DIVIDE ,NOCAPS, {'/', '/'} }, + { VK_ESCAPE ,NOCAPS, {'\x1b','\x1b'} }, + { VK_SPACE ,NOCAPS, {' ', ' '} }, { 0, 0 } }; ROSDATA VK_TO_WCHARS3 key_to_chars_3mod[] = { /* Normal, Shifted, Ctrl */ /* Legacy (telnet-style) ascii escapes */ - { VK_OEM_4, 0, '[', '{', 0x1b /* ESC */ }, - { VK_OEM_6, 0, ']', '}', 0x1d /* GS */ }, - { VK_OEM_5, 0, '\\','|', 0x1c /* FS */ }, - { VK_RETURN,0, '\r', '\r', '\n' }, + { VK_OEM_4, 0, {'[', '{', 0x1b /* ESC */} }, + { VK_OEM_6, 0, {']', '}', 0x1d /* GS */} }, + { VK_OEM_5, 0, {'\\','|', 0x1c /* FS */} }, + { VK_RETURN,0, {'\r', '\r', '\n'} }, { 0,0 } }; ROSDATA VK_TO_WCHARS4 key_to_chars_4mod[] = { /* Normal, Shifted, Ctrl, C-S-x */ /* Legacy Ascii generators */ - { '2', NOCAPS, '2', '@', WCH_NONE, 0 }, - { '6', NOCAPS, '6', '^', WCH_NONE, 0x1e /* RS */ }, - { VK_OEM_MINUS, NOCAPS, '-', '_', WCH_NONE, 0x1f /* US */ }, + { '2', NOCAPS, {'2', '@', WCH_NONE, 0} }, + { '6', NOCAPS, {'6', '^', WCH_NONE, 0x1e /* RS */} }, + { VK_OEM_MINUS, NOCAPS, {'-', '_', WCH_NONE, 0x1f /* US */} }, { 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_DECIMAL, 0, '.' }, - { VK_BACK, 0, '\010' }, + { 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_BACK, 0, {'\010'} }, { 0,0 } }; @@ -366,7 +323,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/kbdes/kbdes.c b/reactos/lib/kbdes/kbdes.c index 5b59dae55e4..18ad873a8f8 100644 --- a/reactos/lib/kbdes/kbdes.c +++ b/reactos/lib/kbdes/kbdes.c @@ -16,12 +16,15 @@ #include #include - #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 @@ -38,50 +41,6 @@ #define SHFT_INVALID 0x0F -/* Thanks to http://asp.flaaten.dk/pforum/keycode/keycode.htm */ - - -#ifndef VK_OEM_1 -#define VK_OEM_1 0xba /* Tecla `^[ */ -#endif -#ifndef VK_OEM_PLUS -#define VK_OEM_PLUS 0xbb /* Tecla +*] */ -#endif -#ifndef VK_OEM_COMMA -#define VK_OEM_COMMA 0xbc /* Tecla ,; */ -#endif -#ifndef VK_OEM_MINUS -#define VK_OEM_MINUS 0xbd /* Tecla -_ */ -#endif -#ifndef VK_OEM_PERIOD -#define VK_OEM_PERIOD 0xbe /* Tecla .: */ -#endif -#ifndef VK_OEM_2 -#define VK_OEM_2 0xbf /* Tecla çÇ} */ -#endif -#ifndef VK_OEM_3 -#define VK_OEM_3 0xc0 /* Tecla ñÑ */ -#endif -#ifndef VK_OEM_4 -#define VK_OEM_4 0xdb /* Tecla '? */ -#endif -#ifndef VK_OEM_5 -#define VK_OEM_5 0xdc /* Tecla ºª\ */ -#endif -#ifndef VK_OEM_6 -#define VK_OEM_6 0xdd /* Tecla ¡¿ */ -#endif -#ifndef VK_OEM_7 -#define VK_OEM_7 0xde /* Tecla ´¨{ */ -#endif -#ifndef VK_OEM_8 -#define VK_OEM_8 0xdf -#endif -#ifndef VK_OEM_102 -#define VK_OEM_102 0xe2 /* Tecla < > */ -#endif - - ROSDATA USHORT scancode_to_vk[] = { /* 00 */ VK_EMPTY, /* 01 */ VK_ESCAPE, @@ -269,13 +228,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 } @@ -289,61 +242,61 @@ ROSDATA VK_TO_WCHARS2 key_to_chars_2mod[] = { /* Normal vs Shifted */ /* The numbers */ //Del 1 al 5 tienen tres estados - { '4', NOCAPS, '4', '$' }, - { '5', NOCAPS, '5', '%' }, + { '4', NOCAPS, {'4', '$'} }, + { '5', NOCAPS, {'5', '%'} }, //El 6 tiene 3 estados - { '7', NOCAPS, '7', '/' }, - { '8', NOCAPS, '8', '(' }, - { '9', NOCAPS, '9', ')' }, - { '0', NOCAPS, '0', '=' }, + { '7', NOCAPS, {'7', '/'} }, + { '8', NOCAPS, {'8', '('} }, + { '9', NOCAPS, {'9', ')'} }, + { '0', NOCAPS, {'0', '='} }, /* First letter row */ - { 'Q', CAPS, 'q', 'Q' }, - { 'W', CAPS, 'w', 'W' }, + { 'Q', CAPS, {'q', 'Q'} }, + { 'W', CAPS, {'w', 'W'} }, //La E tiene 3 estados - { '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' }, + { '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' }, - { VK_OEM_3, CAPS, 0x00F1, 0x00D1 }, // ñÑ + { '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'} }, + { VK_OEM_3, CAPS, {0x00F1, 0x00D1} }, // ñÑ /* 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' }, - { 'M', CAPS, 'm', 'M' }, - + { 'Z', CAPS, {'z', 'Z'} }, + { 'X', CAPS, {'x', 'X'} }, + { 'C', CAPS, {'c', 'C'} }, + { 'V', CAPS, {'v', 'V'} }, + { 'B', CAPS, {'b', 'B'} }, + { 'N', CAPS, {'n', 'N'} }, + { 'M', CAPS, {'m', 'M'} }, + /* Specials */ /* Ctrl-_ generates ES */ - { VK_OEM_6 ,NOCAPS, 0x00a1, 0x00bf }, // ¡¿ - { VK_OEM_4 ,NOCAPS, 0x0027, '?' }, //'? - { VK_OEM_COMMA ,NOCAPS, ',', ';' }, - { VK_OEM_PERIOD ,NOCAPS, '.', ':' }, - { VK_OEM_MINUS ,NOCAPS, '-', '_' }, - { VK_OEM_102 ,NOCAPS, '<', '>' }, + { VK_OEM_6 ,NOCAPS, {0x00a1, 0x00bf} }, // ¡¿ + { VK_OEM_4 ,NOCAPS, {0x0027, '?'} }, //'? + { VK_OEM_COMMA ,NOCAPS, {',', ';'} }, + { VK_OEM_PERIOD ,NOCAPS, {'.', ':'} }, + { VK_OEM_MINUS ,NOCAPS, {'-', '_'} }, + { VK_OEM_102 ,NOCAPS, {'<', '>'} }, /* Keys that do not have shift states */ - { VK_TAB, NOCAPS, '\t', '\t' }, - { VK_ADD, NOCAPS, '+', '+' }, - { VK_SUBTRACT, NOCAPS, '-', '-' }, - { VK_MULTIPLY, NOCAPS, '*', '*'}, - { VK_DIVIDE, NOCAPS, '/', '/' }, - { VK_ESCAPE, NOCAPS, '\x1b', '\x1b' }, - { VK_SPACE, NOCAPS, ' ', ' ' }, + { VK_TAB, NOCAPS, {'\t', '\t'} }, + { VK_ADD, NOCAPS, {'+', '+'} }, + { VK_SUBTRACT, NOCAPS, {'-', '-'} }, + { VK_MULTIPLY, NOCAPS, {'*', '*'} }, + { VK_DIVIDE, NOCAPS, {'/', '/'} }, + { VK_ESCAPE, NOCAPS, {'\x1b','\x1b'} }, + { VK_SPACE, NOCAPS, {' ', ' '} }, { 0, 0 } }; @@ -351,46 +304,46 @@ ROSDATA VK_TO_WCHARS2 key_to_chars_2mod[] = { ROSDATA VK_TO_WCHARS3 key_to_chars_3mod[] = { /* Normal, Shifted, Ctrl */ /* Legacy (telnet-style) ascii escapes */ - { VK_RETURN, NOCAPS, '\r', '\r', '\n' }, + { VK_RETURN, NOCAPS, {'\r', '\r', '\n'} }, { 0,0 } }; ROSDATA VK_TO_WCHARS4 key_to_chars_4mod[] = { /* Normal, shifted, control, Alt+Gr */ - { '1', NOCAPS, '1', '!', WCH_NONE, 0x00a6 }, // 1!| - { '2', NOCAPS, '2', '"', WCH_NONE, '@' }, // 2"@ - { '3', NOCAPS, '3', 0x00B7, WCH_NONE, '#' }, // 3·# - { '6', NOCAPS, '6', '&', WCH_NONE, 0x00AC }, // 6&¬ - { 'E', CAPS, 'e', 'E', WCH_NONE, 0x20AC }, // eE€ - { VK_OEM_PLUS, NOCAPS, '+', '*', WCH_NONE, 0x005d }, // +*] - { VK_OEM_2, NOCAPS, 0x00e7, 0x00c7, WCH_NONE, '}' }, // çÇ} + { '1', NOCAPS, {'1', '!', WCH_NONE, 0x00a6} }, // 1!| + { '2', NOCAPS, {'2', '"', WCH_NONE, '@'} }, // 2"@ + { '3', NOCAPS, {'3', 0x00B7, WCH_NONE, '#'} }, // 3·# + { '6', NOCAPS, {'6', '&', WCH_NONE, 0x00AC} }, // 6&¬ + { 'E', CAPS, {'e', 'E', WCH_NONE, 0x20AC} }, // eE€ + { VK_OEM_PLUS, NOCAPS, {'+', '*', WCH_NONE, 0x005d} }, // +*] + { VK_OEM_2, NOCAPS, {0x00e7, 0x00c7, WCH_NONE, '}'} }, // çÇ} - { VK_OEM_7, NOCAPS, WCH_DEAD, WCH_DEAD, WCH_NONE, '{' }, // ´¨{ - { VK_EMPTY, NOCAPS, 0xB4, 0xA8, WCH_NONE, WCH_NONE }, // ´¨{ + { VK_OEM_7, NOCAPS, {WCH_DEAD, WCH_DEAD, WCH_NONE, '{'} }, // ´¨{ + { VK_EMPTY, NOCAPS, {0xB4, 0xA8, WCH_NONE, WCH_NONE} }, // ´¨{ - { VK_OEM_1, NOCAPS, WCH_DEAD, WCH_DEAD, WCH_NONE, 0x5B }, // `^[ - { VK_EMPTY, NOCAPS, 0x60, 0x5e, WCH_NONE, WCH_NONE }, // `^[ + { VK_OEM_1, NOCAPS, {WCH_DEAD, WCH_DEAD, WCH_NONE, 0x5B} }, // `^[ + { VK_EMPTY, NOCAPS, {0x60, 0x5e, WCH_NONE, WCH_NONE} }, // `^[ - { VK_OEM_5, NOCAPS, 0x00BA, 0x00AA, WCH_NONE, 0x005c }, // çÇ} + { VK_OEM_5, NOCAPS, {0x00BA, 0x00AA, WCH_NONE, 0x005c} }, // çÇ} { 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_DECIMAL, 0, '.' }, - { VK_BACK, 0, '\010' }, + { 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_BACK, 0, {'\010'} }, { 0,0 } }; @@ -551,7 +504,7 @@ ROSDATA DEADKEY_LPWSTR dead_key_names[] = { ROSDATA KBDTABLES keyboard_layout_table = { /* modifier assignments */ - (PMODIFIERS)&modifier_bits, + &modifier_bits, /* character from vk tables */ vk_to_wchar_master_table, @@ -563,7 +516,7 @@ ROSDATA KBDTABLES keyboard_layout_table = { /* Key names */ (VSC_LPWSTR *)key_names, (VSC_LPWSTR *)extended_key_names, - NULL, + dead_key_names, /* Dead key names */ /* scan code to virtual key maps */ diff --git a/reactos/lib/kbdfr/kbdfr.c b/reactos/lib/kbdfr/kbdfr.c index c221685f119..2d8b9afea2b 100644 --- a/reactos/lib/kbdfr/kbdfr.c +++ b/reactos/lib/kbdfr/kbdfr.c @@ -12,8 +12,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 */ @@ -27,50 +31,6 @@ #define KNUMS 0xc00 /* Special + number pad */ #define KMEXT 0x300 /* Multi + ext */ -/* 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 0xe2 -#endif -#ifndef VK_ZOOM -#define VK_ZOOM 0xfb -#endif - ROSDATA USHORT scancode_to_vk[] = { /* Numbers Row */ /* - 00 - */ @@ -176,13 +136,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,15,15,3 } @@ -196,122 +150,122 @@ ROSDATA INTERNAL_KBD_MODIFIERS modifier_bits[] = { ROSDATA VK_TO_WCHARS2 key_to_chars_2mod[] = { /* Normal vs Shifted */ /* The numbers */ - { '1', NOCAPS, '&', '1' }, - //{ '2', NOCAPS, 'é', '2' }, + { '1', NOCAPS, {'&', '1'} }, + //{ '2', NOCAPS, {'é', '2'} }, /* Ctrl-2 generates NUL */ - //{ '3', NOCAPS, '"', '3' }, - //{ '4', NOCAPS, '\'', '4' }, - //{ '5', NOCAPS, '(', '5' }, - //{ '6', NOCAPS, '-', '6' }, + //{ '3', NOCAPS, {'"', '3'} }, + //{ '4', NOCAPS, {'\'', '4'} }, + //{ '5', NOCAPS, {'(', '5'} }, + //{ '6', NOCAPS, {'-', '6'} }, /* Ctrl-6 generates RS */ - //{ '7', NOCAPS, 'è', '7' }, - //{ '8', NOCAPS, '_', '8' }, - //{ '9', NOCAPS, 'ç', '9' }, - //{ '0', NOCAPS, 'à', '0' }, + //{ '7', NOCAPS, {'è', '7'} }, + //{ '8', NOCAPS, {'_', '8'} }, + //{ '9', NOCAPS, {'ç', '9'} }, + //{ '0', NOCAPS, {'à', '0'} }, /* First letter row */ - { 'A', CAPS, 'a', 'A' }, - { 'Z', CAPS, 'z', 'Z' }, - //{ 'E', CAPS, 'e', 'E' }, - { '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' }, + { 'A', CAPS, {'a', 'A'} }, + { 'Z', CAPS, {'z', 'Z'} }, + //{ 'E', CAPS, {'e', 'E'} }, + { '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 */ - { 'Q', CAPS, 'q', 'Q' }, - { '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' }, - { 'M', CAPS, 'm', 'M' }, + { 'Q', CAPS, {'q', 'Q'} }, + { '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'} }, + { 'M', CAPS, {'m', 'M'} }, /* Third letter row */ - { 'W', CAPS, 'w', 'W' }, - { 'X', CAPS, 'x', 'X' }, - { 'C', CAPS, 'c', 'C' }, - { 'V', CAPS, 'v', 'V' }, - { 'B', CAPS, 'b', 'B' }, - { 'N', CAPS, 'n', 'N' }, + { 'W', CAPS, {'w', 'W'} }, + { 'X', CAPS, {'x', 'X'} }, + { 'C', CAPS, {'c', 'C'} }, + { 'V', CAPS, {'v', 'V'} }, + { 'B', CAPS, {'b', 'B'} }, + { 'N', CAPS, {'n', 'N'} }, /* Specials */ /* Ctrl-_ generates US */ - //{ VK_OEM_1 ,NOCAPS, '$', '£' }, - { VK_OEM_5 ,NOCAPS, '*','µ'}, - { VK_OEM_3 ,NOCAPS, 'ù', '%' }, - { VK_OEM_COMMA ,NOCAPS, ',', '?' }, - { VK_OEM_PERIOD ,NOCAPS, ';', '.' }, - { VK_OEM_2 ,NOCAPS, ':', '/' }, - { VK_OEM_8 ,NOCAPS, '!', '§' }, + //{ VK_OEM_1 ,NOCAPS, {'$', '£'} }, + { VK_OEM_5 ,NOCAPS, {'*','µ'} }, + { VK_OEM_3 ,NOCAPS, {'ù', '%'} }, + { VK_OEM_COMMA ,NOCAPS, {',', '?'} }, + { VK_OEM_PERIOD ,NOCAPS, {';', '.'} }, + { VK_OEM_2 ,NOCAPS, {':', '/'} }, + { VK_OEM_8 ,NOCAPS, {'!', '§'} }, /* Keys that do not have shift states */ - { VK_TAB ,NOCAPS, '\t','\t'}, - { VK_ADD ,NOCAPS, '+', '+' }, - { VK_SUBTRACT,NOCAPS, '-', '-' }, - { VK_MULTIPLY,NOCAPS, '*', '*' }, - { VK_DIVIDE ,NOCAPS, '/', '/' }, - { VK_ESCAPE ,NOCAPS, '\x1b','\x1b' }, - { VK_SPACE ,NOCAPS, ' ', ' ' }, + { VK_TAB ,NOCAPS, {'\t','\t'} }, + { VK_ADD ,NOCAPS, {'+', '+'} }, + { VK_SUBTRACT,NOCAPS, {'-', '-'} }, + { VK_MULTIPLY,NOCAPS, {'*', '*'} }, + { VK_DIVIDE ,NOCAPS, {'/', '/'} }, + { VK_ESCAPE ,NOCAPS, {'\x1b','\x1b'} }, + { VK_SPACE ,NOCAPS, {' ', ' '} }, { 0, 0 } }; ROSDATA VK_TO_WCHARS3 key_to_chars_3mod[] = { /* Normal, Shifted, Ctrl */ /* Legacy (telnet-style) ascii escapes */ - { VK_OEM_102, 0, '<', '>', 0x1c /* FS */ }, - { VK_OEM_6, 0, WCH_DEAD, WCH_DEAD, WCH_NONE }, - { VK_EMPTY, 0, '^', '¨', WCH_NONE }, //OEM 6 DEAD - { VK_OEM_7, 0, '²','|', 0x1c /* FS */ }, - { VK_RETURN,0, '\r', '\r', '\n' }, + { VK_OEM_102, 0, {'<', '>', 0x1c /* FS */} }, + { VK_OEM_6, 0, {WCH_DEAD, WCH_DEAD, WCH_NONE} }, + { VK_EMPTY, 0, {'^', '¨', WCH_NONE} }, //OEM 6 DEAD + { VK_OEM_7, 0, {'²','|', 0x1c /* FS */} }, + { VK_RETURN, 0, {'\r', '\r', '\n'} }, { 0,0 } }; ROSDATA VK_TO_WCHARS4 key_to_chars_4mod[] = { /* Normal, shifted, control, Alt+Gr */ - { '2' , 1, 'é', '2', WCH_NONE, WCH_DEAD }, - { VK_EMPTY, 0, WCH_NONE, WCH_NONE, WCH_NONE, '~' }, - { '3' , 0, '"', '3', WCH_NONE, '#' }, - { '4' , 0, '\'', '4', WCH_NONE, '{' }, - { '7' , 1, 'è', '7', WCH_NONE, WCH_DEAD }, - { VK_EMPTY, 0, WCH_NONE, WCH_NONE, WCH_NONE, '`' }, - { '9' , 1, 'ç', '9', WCH_NONE, '^' }, - { '0' , 1, 'à', '0', WCH_NONE, '@' }, - { VK_OEM_PLUS,0, '=', '+', WCH_NONE, '}' }, - { 'E' , 1, 'e', 'E', WCH_NONE, '€' /* euro */ }, - { VK_OEM_1, 0, '$', '£', WCH_NONE, '¤' }, - { VK_OEM_4, 0, ')', '°', WCH_NONE, ']' }, + { '2' , 1, {'é', '2', WCH_NONE, WCH_DEAD} }, + { VK_EMPTY, 0, {WCH_NONE, WCH_NONE, WCH_NONE, '~'} }, + { '3' , 0, {'"', '3', WCH_NONE, '#'} }, + { '4' , 0, {'\'', '4', WCH_NONE, '{'} }, + { '7' , 1, {'è', '7', WCH_NONE, WCH_DEAD} }, + { VK_EMPTY, 0, {WCH_NONE, WCH_NONE, WCH_NONE, '`'} }, + { '9' , 1, {'ç', '9', WCH_NONE, '^'} }, + { '0' , 1, {'à', '0', WCH_NONE, '@'} }, + { VK_OEM_PLUS,0, {'=', '+', WCH_NONE, '}'} }, + { 'E' , 1, {'e', 'E', WCH_NONE, '€' /* euro */} }, + { VK_OEM_1, 0, {'$', '£', WCH_NONE, '¤'} }, + { VK_OEM_4, 0, {')', '°', WCH_NONE, ']'} }, { 0, 0 } }; ROSDATA VK_TO_WCHARS5 key_to_chars_5mod[] = { /* x,x, Normal, Shifted, Ctrl, Alt, C-S-x */ /* Legacy Ascii generators */ - //{ '2', NOCAPS, '2', '@', WCH_NONE, 0 }, - //{ '6', NOCAPS, '6', '^', WCH_NONE, 0x1e /* RS */ }, - //{ VK_OEM_MINUS, NOCAPS, ')', '°', WCH_NONE, 0x1f /* US */ }, - //{ '5' | KEXT , NOCAPS, ')', '°', '#' , 0x1f /* US */ }, - { '5' , 1 , '(', '5', WCH_NONE , '[' , 0x1b }, - { '6' , 1 , '-', '6', WCH_NONE , '|' , 0x1f }, - { '8' , 1 , '_', '8', WCH_NONE , '\\' , 0x1c }, + //{ '2', NOCAPS, {'2', '@', WCH_NONE, 0} }, + //{ '6', NOCAPS, {'6', '^', WCH_NONE, 0x1e /* RS */} }, + //{ VK_OEM_MINUS, NOCAPS, {')', '°', WCH_NONE, 0x1f /* US */} }, + //{ '5' | KEXT , NOCAPS, {')', '°', '#' , 0x1f /* US */} }, + { '5' , 1 , {'(', '5', WCH_NONE , '[' , 0x1b} }, + { '6' , 1 , {'-', '6', WCH_NONE , '|' , 0x1f} }, + { '8' , 1 , {'_', '8', WCH_NONE , '\\' , 0x1c} }, { 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_BACK, 0, '\010' }, + { 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_BACK, 0, {'\010'} }, { 0,0 } }; @@ -438,7 +392,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/kbdgr/kbdgr.c b/reactos/lib/kbdgr/kbdgr.c index a2f0e6d5a78..6d311d5a6d0 100644 --- a/reactos/lib/kbdgr/kbdgr.c +++ b/reactos/lib/kbdgr/kbdgr.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, 3, 4, SHFT_INVALID, SHFT_INVALID, 2 } /* Modifier bit order, NONE, SHIFT, CTRL, ALT, MENU, SHIFT + MENU, CTRL + MENU */ @@ -215,109 +172,109 @@ ROSDATA INTERNAL_KBD_MODIFIERS modifier_bits[] = { #define CAPS KSHIFT /* Caps -> shift */ ROSDATA VK_TO_WCHARS2 key_to_chars_2mod[] = { - { VK_OEM_5, NOCAPS, WCH_DEAD, 0xb0 }, - { 0xff, NOCAPS, '^', WCH_NONE }, // FIXME - why doesn't this work? + { VK_OEM_5, NOCAPS, {WCH_DEAD, 0xb0} }, + { 0xff, NOCAPS, {'^', WCH_NONE} }, // FIXME - why doesn't this work? /* Normal vs Shifted */ /* The numbers */ - { '1', NOCAPS, '1', '!' }, + { '1', NOCAPS, {'1', '!'} }, /* Ctrl-2 generates NUL */ - { '4', NOCAPS, '4', '$' }, - { '5', NOCAPS, '5', '%' }, + { '4', NOCAPS, {'4', '$'} }, + { '5', NOCAPS, {'5', '%'} }, - { VK_OEM_6, NOCAPS, WCH_DEAD, WCH_DEAD }, - { 0xff, NOCAPS, 0xb4, '`' }, + { VK_OEM_6, NOCAPS, {WCH_DEAD, WCH_DEAD} }, + { 0xff, NOCAPS, {0xb4, '`'} }, /* 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' }, - { VK_OEM_3, CAPS, 0xf6, 0xd6 }, - { VK_OEM_7, CAPS, 0xe4, 0xc4 }, + { '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'} }, + { VK_OEM_3, CAPS, {0xf6, 0xd6} }, + { VK_OEM_7, CAPS, {0xe4, 0xc4} }, /* Third letter row */ - { 'Y', CAPS, 'y', 'Y' }, - { 'X', CAPS, 'x', 'X' }, - { 'C', CAPS, 'c', 'C' }, - { 'V', CAPS, 'v', 'V' }, - { 'B', CAPS, 'b', 'B' }, - { 'N', CAPS, 'n', 'N' }, + { 'Y', CAPS, {'y', 'Y'} }, + { 'X', CAPS, {'x', 'X'} }, + { 'C', CAPS, {'c', 'C'} }, + { 'V', CAPS, {'v', 'V'} }, + { 'B', CAPS, {'b', 'B'} }, + { 'N', CAPS, {'n', 'N'} }, /* Specials */ - { VK_OEM_COMMA, CAPS, ',', ';' }, - { VK_OEM_PERIOD, CAPS, '.', ':' }, - { VK_DECIMAL, NOCAPS, ',',','}, - { VK_TAB, NOCAPS, '\t', '\t' }, - { VK_ADD, NOCAPS, '+', '+' }, - { VK_DIVIDE, NOCAPS, '/', '/' }, - { VK_MULTIPLY, NOCAPS, '*', '*' }, - { VK_SUBTRACT, NOCAPS, '-', '-' }, + { VK_OEM_COMMA, CAPS, {',', ';'} }, + { VK_OEM_PERIOD, CAPS, {'.', ':'} }, + { 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 */ - { '3', CAPS, '3', 0xa7, 0xb3 }, - { '7', CAPS, '7', '/', '{' }, - { '8', CAPS, '8', '(', '[' }, - { '9', CAPS, '9', ')', ']' }, - { '0', CAPS, '0', '=', '}' }, - { VK_OEM_4, CAPS, 0xdf, '?', '\\' }, - { 'Q', CAPS, 'q', 'Q', '@' }, - { 'E', CAPS, 'e', 'E', 0x20ac }, - { 'M', CAPS, 'm', 'M', 0xb5 }, - { VK_OEM_102, NOCAPS, '<', '>', '|' }, // FIXME - why doesn't this work? + { '3', CAPS, {'3', 0xa7, 0xb3} }, + { '7', CAPS, {'7', '/', '{'} }, + { '8', CAPS, {'8', '(', '['} }, + { '9', CAPS, {'9', ')', ']'} }, + { '0', CAPS, {'0', '=', '}'} }, + { VK_OEM_4, CAPS, {0xdf, '?', '\\'} }, + { 'Q', CAPS, {'q', 'Q', '@'} }, + { 'E', CAPS, {'e', 'E', 0x20ac} }, + { 'M', CAPS, {'m', 'M', 0xb5} }, + { VK_OEM_102, NOCAPS, {'<', '>', '|'} }, // FIXME - why doesn't this work? { 0,0 } }; ROSDATA VK_TO_WCHARS4 key_to_chars_4mod[] = { /* Normal, Shifted, Ctrl, C-S-x */ /* Legacy Ascii generators */ - { VK_OEM_1, CAPS, 0xfc, 0xdc, WCH_NONE, 0x1b }, - { VK_OEM_PLUS, CAPS, '+', '*', '~', 0x1d }, - { VK_OEM_2, CAPS, '#', '\'', WCH_NONE, 0x1c }, - { 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_OEM_1, CAPS, {0xfc, 0xdc, WCH_NONE, 0x1b} }, + { VK_OEM_PLUS, CAPS, {'+', '*', '~', 0x1d} }, + { VK_OEM_2, CAPS, {'#', '\'', WCH_NONE, 0x1c} }, + { 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, Ctrl, C-S-x */ - { '2', CAPS, '2', '\"', 0xb2, WCH_NONE, 0x00 }, - { '6', CAPS, '6', '&', WCH_NONE, WCH_NONE, 0x1e }, - { VK_OEM_MINUS, NOCAPS, '-', '_', WCH_NONE, WCH_NONE, 0x1f }, + { '2', CAPS, {'2', '\"', 0xb2, WCH_NONE, 0x00} }, + { '6', CAPS, {'6', '&', WCH_NONE, WCH_NONE, 0x1e} }, + { VK_OEM_MINUS, NOCAPS, {'-', '_', WCH_NONE, WCH_NONE, 0x1f} }, { 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'} }, // { VK_BACK, 0, '\010' }, { 0,0 } }; @@ -466,7 +423,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,