Merge pull request #513 from kiilerix/master

a crypto+redirect fix and manu small steps with locale / keyboard refactoring
This commit is contained in:
Marc-André Moreau 2012-03-23 18:25:15 -07:00
commit ed2a1517b4
18 changed files with 1922 additions and 2008 deletions

View File

@ -22,6 +22,7 @@
#include <freerdp/api.h>
#include <freerdp/types.h>
#include <freerdp/locale/virtual_key_codes.h>
#define RDP_KEYBOARD_LAYOUT_TYPE_STANDARD 1
#define RDP_KEYBOARD_LAYOUT_TYPE_VARIANT 2
@ -41,290 +42,6 @@ struct _RDP_SCANCODE
};
typedef struct _RDP_SCANCODE RDP_SCANCODE;
struct _VIRTUAL_KEY_CODE
{
uint32 code; /* Windows Virtual Key Code */
const char* name; /* Virtual Key Code Name */
};
typedef struct _VIRTUAL_KEY_CODE VIRTUAL_KEY_CODE;
/* Mouse buttons */
#define VK_LBUTTON 0x01 /* Left mouse button */
#define VK_RBUTTON 0x02 /* Right mouse button */
#define VK_CANCEL 0x03 /* Control-break processing */
#define VK_MBUTTON 0x04 /* Middle mouse button (three-button mouse) */
#define VK_XBUTTON1 0x05 /* Windows 2000/XP: X1 mouse button */
#define VK_XBUTTON2 0x06 /* Windows 2000/XP: X2 mouse button */
/* 0x07 is undefined */
#define VK_BACK 0x08 /* BACKSPACE key */
#define VK_TAB 0x09 /* TAB key */
/* 0x0A to 0x0B are reserved */
#define VK_CLEAR 0x0C /* CLEAR key */
#define VK_RETURN 0x0D /* ENTER key */
/* 0x0E to 0x0F are undefined */
#define VK_SHIFT 0x10 /* SHIFT key */
#define VK_CONTROL 0x11 /* CTRL key */
#define VK_MENU 0x12 /* ALT key */
#define VK_PAUSE 0x13 /* PAUSE key */
#define VK_CAPITAL 0x14 /* CAPS LOCK key */
#define VK_KANA 0x15 /* Input Method Editor (IME) Kana mode */
#define VK_HANGUEL 0x15 /* IME Hanguel mode (maintained for compatibility; use #define VK_HANGUL) */
#define VK_HANGUL 0x15 /* IME Hangul mode */
/* 0x16 is undefined */
#define VK_JUNJA 0x17 /* IME Junja mode */
#define VK_FINAL 0x18 /* IME final mode */
#define VK_HANJA 0x19 /* IME Hanja mode */
#define VK_KANJI 0x19 /* IME Kanji mode */
/* 0x1A is undefined */
#define VK_ESCAPE 0x1B /* ESC key */
#define VK_CONVERT 0x1C /* IME convert */
#define VK_NONCONVERT 0x1D /* IME nonconvert */
#define VK_ACCEPT 0x1E /* IME accept */
#define VK_MODECHANGE 0x1F /* IME mode change request */
#define VK_SPACE 0x20 /* SPACEBAR */
#define VK_PRIOR 0x21 /* PAGE UP key */
#define VK_NEXT 0x22 /* PAGE DOWN key */
#define VK_END 0x23 /* END key */
#define VK_HOME 0x24 /* HOME key */
#define VK_LEFT 0x25 /* LEFT ARROW key */
#define VK_UP 0x26 /* UP ARROW key */
#define VK_RIGHT 0x27 /* RIGHT ARROW key */
#define VK_DOWN 0x28 /* DOWN ARROW key */
#define VK_SELECT 0x29 /* SELECT key */
#define VK_PRINT 0x2A /* PRINT key */
#define VK_EXECUTE 0x2B /* EXECUTE key */
#define VK_SNAPSHOT 0x2C /* PRINT SCREEN key */
#define VK_INSERT 0x2D /* INS key */
#define VK_DELETE 0x2E /* DEL key */
#define VK_HELP 0x2F /* HELP key */
/* Digits, the last 4 bits of the code represent the corresponding digit */
#define VK_KEY_0 0x30 /* '0' key */
#define VK_KEY_1 0x31 /* '1' key */
#define VK_KEY_2 0x32 /* '2' key */
#define VK_KEY_3 0x33 /* '3' key */
#define VK_KEY_4 0x34 /* '4' key */
#define VK_KEY_5 0x35 /* '5' key */
#define VK_KEY_6 0x36 /* '6' key */
#define VK_KEY_7 0x37 /* '7' key */
#define VK_KEY_8 0x38 /* '8' key */
#define VK_KEY_9 0x39 /* '9' key */
/* 0x3A to 0x40 are undefined */
/* The alphabet, the code corresponds to the capitalized letter in the ASCII code */
#define VK_KEY_A 0x41 /* 'A' key */
#define VK_KEY_B 0x42 /* 'B' key */
#define VK_KEY_C 0x43 /* 'C' key */
#define VK_KEY_D 0x44 /* 'D' key */
#define VK_KEY_E 0x45 /* 'E' key */
#define VK_KEY_F 0x46 /* 'F' key */
#define VK_KEY_G 0x47 /* 'G' key */
#define VK_KEY_H 0x48 /* 'H' key */
#define VK_KEY_I 0x49 /* 'I' key */
#define VK_KEY_J 0x4A /* 'J' key */
#define VK_KEY_K 0x4B /* 'K' key */
#define VK_KEY_L 0x4C /* 'L' key */
#define VK_KEY_M 0x4D /* 'M' key */
#define VK_KEY_N 0x4E /* 'N' key */
#define VK_KEY_O 0x4F /* 'O' key */
#define VK_KEY_P 0x50 /* 'P' key */
#define VK_KEY_Q 0x51 /* 'Q' key */
#define VK_KEY_R 0x52 /* 'R' key */
#define VK_KEY_S 0x53 /* 'S' key */
#define VK_KEY_T 0x54 /* 'T' key */
#define VK_KEY_U 0x55 /* 'U' key */
#define VK_KEY_V 0x56 /* 'V' key */
#define VK_KEY_W 0x57 /* 'W' key */
#define VK_KEY_X 0x58 /* 'X' key */
#define VK_KEY_Y 0x59 /* 'Y' key */
#define VK_KEY_Z 0x5A /* 'Z' key */
#define VK_LWIN 0x5B /* Left Windows key (Microsoft Natural keyboard) */
#define VK_RWIN 0x5C /* Right Windows key (Natural keyboard) */
#define VK_APPS 0x5D /* Applications key (Natural keyboard) */
/* 0x5E is reserved */
#define VK_SLEEP 0x5F /* Computer Sleep key */
/* Numeric keypad digits, the last four bits of the code represent the corresponding digit */
#define VK_NUMPAD0 0x60 /* Numeric keypad '0' key */
#define VK_NUMPAD1 0x61 /* Numeric keypad '1' key */
#define VK_NUMPAD2 0x62 /* Numeric keypad '2' key */
#define VK_NUMPAD3 0x63 /* Numeric keypad '3' key */
#define VK_NUMPAD4 0x64 /* Numeric keypad '4' key */
#define VK_NUMPAD5 0x65 /* Numeric keypad '5' key */
#define VK_NUMPAD6 0x66 /* Numeric keypad '6' key */
#define VK_NUMPAD7 0x67 /* Numeric keypad '7' key */
#define VK_NUMPAD8 0x68 /* Numeric keypad '8' key */
#define VK_NUMPAD9 0x69 /* Numeric keypad '9' key */
/* Numeric keypad operators and special keys */
#define VK_MULTIPLY 0x6A /* Multiply key */
#define VK_ADD 0x6B /* Add key */
#define VK_SEPARATOR 0x6C /* Separator key */
#define VK_SUBTRACT 0x6D /* Subtract key */
#define VK_DECIMAL 0x6E /* Decimal key */
#define VK_DIVIDE 0x6F /* Divide key */
/* Function keys, from F1 to F24 */
#define VK_F1 0x70 /* F1 key */
#define VK_F2 0x71 /* F2 key */
#define VK_F3 0x72 /* F3 key */
#define VK_F4 0x73 /* F4 key */
#define VK_F5 0x74 /* F5 key */
#define VK_F6 0x75 /* F6 key */
#define VK_F7 0x76 /* F7 key */
#define VK_F8 0x77 /* F8 key */
#define VK_F9 0x78 /* F9 key */
#define VK_F10 0x79 /* F10 key */
#define VK_F11 0x7A /* F11 key */
#define VK_F12 0x7B /* F12 key */
#define VK_F13 0x7C /* F13 key */
#define VK_F14 0x7D /* F14 key */
#define VK_F15 0x7E /* F15 key */
#define VK_F16 0x7F /* F16 key */
#define VK_F17 0x80 /* F17 key */
#define VK_F18 0x81 /* F18 key */
#define VK_F19 0x82 /* F19 key */
#define VK_F20 0x83 /* F20 key */
#define VK_F21 0x84 /* F21 key */
#define VK_F22 0x85 /* F22 key */
#define VK_F23 0x86 /* F23 key */
#define VK_F24 0x87 /* F24 key */
/* 0x88 to 0x8F are unassigned */
#define VK_NUMLOCK 0x90 /* NUM LOCK key */
#define VK_SCROLL 0x91 /* SCROLL LOCK key */
/* 0x92 to 0x96 are OEM specific */
/* 0x97 to 0x9F are unassigned */
/* Modifier keys */
#define VK_LSHIFT 0xA0 /* Left SHIFT key */
#define VK_RSHIFT 0xA1 /* Right SHIFT key */
#define VK_LCONTROL 0xA2 /* Left CONTROL key */
#define VK_RCONTROL 0xA3 /* Right CONTROL key */
#define VK_LMENU 0xA4 /* Left MENU key */
#define VK_RMENU 0xA5 /* Right MENU key */
/* Browser related keys */
#define VK_BROWSER_BACK 0xA6 /* Windows 2000/XP: Browser Back key */
#define VK_BROWSER_FORWARD 0xA7 /* Windows 2000/XP: Browser Forward key */
#define VK_BROWSER_REFRESH 0xA8 /* Windows 2000/XP: Browser Refresh key */
#define VK_BROWSER_STOP 0xA9 /* Windows 2000/XP: Browser Stop key */
#define VK_BROWSER_SEARCH 0xAA /* Windows 2000/XP: Browser Search key */
#define VK_BROWSER_FAVORITES 0xAB /* Windows 2000/XP: Browser Favorites key */
#define VK_BROWSER_HOME 0xAC /* Windows 2000/XP: Browser Start and Home key */
/* Volume related keys */
#define VK_VOLUME_MUTE 0xAD /* Windows 2000/XP: Volume Mute key */
#define VK_VOLUME_DOWN 0xAE /* Windows 2000/XP: Volume Down key */
#define VK_VOLUME_UP 0xAF /* Windows 2000/XP: Volume Up key */
/* Media player related keys */
#define VK_MEDIA_NEXT_TRACK 0xB0 /* Windows 2000/XP: Next Track key */
#define VK_MEDIA_PREV_TRACK 0xB1 /* Windows 2000/XP: Previous Track key */
#define VK_MEDIA_STOP 0xB2 /* Windows 2000/XP: Stop Media key */
#define VK_MEDIA_PLAY_PAUSE 0xB3 /* Windows 2000/XP: Play/Pause Media key */
/* Application launcher keys */
#define VK_LAUNCH_MAIL 0xB4 /* Windows 2000/XP: Start Mail key */
#define VK_MEDIA_SELECT 0xB5 /* Windows 2000/XP: Select Media key */
#define VK_LAUNCH_APP1 0xB6 /* Windows 2000/XP: Start Application 1 key */
#define VK_LAUNCH_APP2 0xB7 /* Windows 2000/XP: Start Application 2 key */
/* 0xB8 and 0xB9 are reserved */
/* OEM keys */
#define VK_OEM_1 0xBA /* Used for miscellaneous characters; it can vary by keyboard. */
/* Windows 2000/XP: For the US standard keyboard, the ';:' key */
#define VK_OEM_PLUS 0xBB /* Windows 2000/XP: For any country/region, the '+' key */
#define VK_OEM_COMMA 0xBC /* Windows 2000/XP: For any country/region, the ',' key */
#define VK_OEM_MINUS 0xBD /* Windows 2000/XP: For any country/region, the '-' key */
#define VK_OEM_PERIOD 0xBE /* Windows 2000/XP: For any country/region, the '.' key */
#define VK_OEM_2 0xBF /* Used for miscellaneous characters; it can vary by keyboard. */
/* Windows 2000/XP: For the US standard keyboard, the '/?' key */
#define VK_OEM_3 0xC0 /* Used for miscellaneous characters; it can vary by keyboard. */
/* Windows 2000/XP: For the US standard keyboard, the '`~' key */
/* 0xC1 to 0xD7 are reserved */
#define VK_ABNT_C1 0xC1 /* Brazilian (ABNT) Keyboard */
#define VK_ABNT_C2 0xC2 /* Brazilian (ABNT) Keyboard */
/* 0xD8 to 0xDA are unassigned */
#define VK_OEM_4 0xDB /* Used for miscellaneous characters; it can vary by keyboard. */
/* Windows 2000/XP: For the US standard keyboard, the '[{' key */
#define VK_OEM_5 0xDC /* Used for miscellaneous characters; it can vary by keyboard. */
/* Windows 2000/XP: For the US standard keyboard, the '\|' key */
#define VK_OEM_6 0xDD /* Used for miscellaneous characters; it can vary by keyboard. */
/* Windows 2000/XP: For the US standard keyboard, the ']}' key */
#define VK_OEM_7 0xDE /* Used for miscellaneous characters; it can vary by keyboard. */
/* Windows 2000/XP: For the US standard keyboard, the 'single-quote/double-quote' key */
#define VK_OEM_8 0xDF /* Used for miscellaneous characters; it can vary by keyboard. */
/* 0xE0 is reserved */
/* 0xE1 is OEM specific */
#define VK_OEM_102 0xE2 /* Windows 2000/XP: Either the angle bracket key or */
/* the backslash key on the RT 102-key keyboard */
/* 0xE3 and 0xE4 are OEM specific */
#define VK_PROCESSKEY 0xE5 /* Windows 95/98/Me, Windows NT 4.0, Windows 2000/XP: IME PROCESS key */
/* 0xE6 is OEM specific */
#define VK_PACKET 0xE7 /* Windows 2000/XP: Used to pass Unicode characters as if they were keystrokes. */
/* The #define VK_PACKET key is the low word of a 32-bit Virtual Key value used */
/* for non-keyboard input methods. For more information, */
/* see Remark in KEYBDINPUT, SendInput, WM_KEYDOWN, and WM_KEYUP */
/* 0xE8 is unassigned */
/* 0xE9 to 0xF5 are OEM specific */
#define VK_ATTN 0xF6 /* Attn key */
#define VK_CRSEL 0xF7 /* CrSel key */
#define VK_EXSEL 0xF8 /* ExSel key */
#define VK_EREOF 0xF9 /* Erase EOF key */
#define VK_PLAY 0xFA /* Play key */
#define VK_ZOOM 0xFB /* Zoom key */
#define VK_NONAME 0xFC /* Reserved */
#define VK_PA1 0xFD /* PA1 key */
#define VK_OEM_CLEAR 0xFE /* Clear key */
/* Keyboard layout IDs */
@ -485,6 +202,5 @@ FREERDP_API const char* freerdp_keyboard_get_layout_name_from_id(uint32 keyboard
FREERDP_API uint32 freerdp_keyboard_get_rdp_scancode_from_x11_keycode(uint32 keycode, boolean* extended);
FREERDP_API uint32 freerdp_keyboard_get_x11_keycode_from_rdp_scancode(uint32 scancode, boolean extended);
FREERDP_API uint32 freerdp_keyboard_get_rdp_scancode_from_virtual_key_code(uint32 vkcode, boolean* extended);
FREERDP_API char* freerdp_keyboard_get_virtual_key_code_name(uint32 vkcode);
#endif /* __FREERDP_LOCALE_KEYBOARD_H */

View File

@ -0,0 +1,309 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* Microsoft Windows Virtual-Key Codes
*
* Copyright 2009-2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef __FREERDP_VIRTUAL_KEY_CODES_H
#define __FREERDP_VIRTUAL_KEY_CODES_H
#include <freerdp/types.h>
#include <freerdp/api.h>
/* Virtual-Key Codes, @msdn{dd375731} */
/* Mouse buttons */
#define VK_LBUTTON 0x01 /* Left mouse button */
#define VK_RBUTTON 0x02 /* Right mouse button */
#define VK_CANCEL 0x03 /* Control-break processing */
#define VK_MBUTTON 0x04 /* Middle mouse button (three-button mouse) */
#define VK_XBUTTON1 0x05 /* Windows 2000/XP: X1 mouse button */
#define VK_XBUTTON2 0x06 /* Windows 2000/XP: X2 mouse button */
/* 0x07 is undefined */
#define VK_BACK 0x08 /* BACKSPACE key */
#define VK_TAB 0x09 /* TAB key */
/* 0x0A to 0x0B are reserved */
#define VK_CLEAR 0x0C /* CLEAR key */
#define VK_RETURN 0x0D /* ENTER key */
/* 0x0E to 0x0F are undefined */
#define VK_SHIFT 0x10 /* SHIFT key */
#define VK_CONTROL 0x11 /* CTRL key */
#define VK_MENU 0x12 /* ALT key */
#define VK_PAUSE 0x13 /* PAUSE key */
#define VK_CAPITAL 0x14 /* CAPS LOCK key */
#define VK_KANA 0x15 /* Input Method Editor (IME) Kana mode */
#define VK_HANGUEL 0x15 /* IME Hanguel mode (maintained for compatibility; use #define VK_HANGUL) */
#define VK_HANGUL 0x15 /* IME Hangul mode */
/* 0x16 is undefined */
#define VK_JUNJA 0x17 /* IME Junja mode */
#define VK_FINAL 0x18 /* IME final mode */
#define VK_HANJA 0x19 /* IME Hanja mode */
#define VK_KANJI 0x19 /* IME Kanji mode */
/* 0x1A is undefined */
#define VK_ESCAPE 0x1B /* ESC key */
#define VK_CONVERT 0x1C /* IME convert */
#define VK_NONCONVERT 0x1D /* IME nonconvert */
#define VK_ACCEPT 0x1E /* IME accept */
#define VK_MODECHANGE 0x1F /* IME mode change request */
#define VK_SPACE 0x20 /* SPACEBAR */
#define VK_PRIOR 0x21 /* PAGE UP key */
#define VK_NEXT 0x22 /* PAGE DOWN key */
#define VK_END 0x23 /* END key */
#define VK_HOME 0x24 /* HOME key */
#define VK_LEFT 0x25 /* LEFT ARROW key */
#define VK_UP 0x26 /* UP ARROW key */
#define VK_RIGHT 0x27 /* RIGHT ARROW key */
#define VK_DOWN 0x28 /* DOWN ARROW key */
#define VK_SELECT 0x29 /* SELECT key */
#define VK_PRINT 0x2A /* PRINT key */
#define VK_EXECUTE 0x2B /* EXECUTE key */
#define VK_SNAPSHOT 0x2C /* PRINT SCREEN key */
#define VK_INSERT 0x2D /* INS key */
#define VK_DELETE 0x2E /* DEL key */
#define VK_HELP 0x2F /* HELP key */
/* Digits, the last 4 bits of the code represent the corresponding digit */
#define VK_KEY_0 0x30 /* '0' key */
#define VK_KEY_1 0x31 /* '1' key */
#define VK_KEY_2 0x32 /* '2' key */
#define VK_KEY_3 0x33 /* '3' key */
#define VK_KEY_4 0x34 /* '4' key */
#define VK_KEY_5 0x35 /* '5' key */
#define VK_KEY_6 0x36 /* '6' key */
#define VK_KEY_7 0x37 /* '7' key */
#define VK_KEY_8 0x38 /* '8' key */
#define VK_KEY_9 0x39 /* '9' key */
/* 0x3A to 0x40 are undefined */
/* The alphabet, the code corresponds to the capitalized letter in the ASCII code */
#define VK_KEY_A 0x41 /* 'A' key */
#define VK_KEY_B 0x42 /* 'B' key */
#define VK_KEY_C 0x43 /* 'C' key */
#define VK_KEY_D 0x44 /* 'D' key */
#define VK_KEY_E 0x45 /* 'E' key */
#define VK_KEY_F 0x46 /* 'F' key */
#define VK_KEY_G 0x47 /* 'G' key */
#define VK_KEY_H 0x48 /* 'H' key */
#define VK_KEY_I 0x49 /* 'I' key */
#define VK_KEY_J 0x4A /* 'J' key */
#define VK_KEY_K 0x4B /* 'K' key */
#define VK_KEY_L 0x4C /* 'L' key */
#define VK_KEY_M 0x4D /* 'M' key */
#define VK_KEY_N 0x4E /* 'N' key */
#define VK_KEY_O 0x4F /* 'O' key */
#define VK_KEY_P 0x50 /* 'P' key */
#define VK_KEY_Q 0x51 /* 'Q' key */
#define VK_KEY_R 0x52 /* 'R' key */
#define VK_KEY_S 0x53 /* 'S' key */
#define VK_KEY_T 0x54 /* 'T' key */
#define VK_KEY_U 0x55 /* 'U' key */
#define VK_KEY_V 0x56 /* 'V' key */
#define VK_KEY_W 0x57 /* 'W' key */
#define VK_KEY_X 0x58 /* 'X' key */
#define VK_KEY_Y 0x59 /* 'Y' key */
#define VK_KEY_Z 0x5A /* 'Z' key */
#define VK_LWIN 0x5B /* Left Windows key (Microsoft Natural keyboard) */
#define VK_RWIN 0x5C /* Right Windows key (Natural keyboard) */
#define VK_APPS 0x5D /* Applications key (Natural keyboard) */
/* 0x5E is reserved */
#define VK_SLEEP 0x5F /* Computer Sleep key */
/* Numeric keypad digits, the last four bits of the code represent the corresponding digit */
#define VK_NUMPAD0 0x60 /* Numeric keypad '0' key */
#define VK_NUMPAD1 0x61 /* Numeric keypad '1' key */
#define VK_NUMPAD2 0x62 /* Numeric keypad '2' key */
#define VK_NUMPAD3 0x63 /* Numeric keypad '3' key */
#define VK_NUMPAD4 0x64 /* Numeric keypad '4' key */
#define VK_NUMPAD5 0x65 /* Numeric keypad '5' key */
#define VK_NUMPAD6 0x66 /* Numeric keypad '6' key */
#define VK_NUMPAD7 0x67 /* Numeric keypad '7' key */
#define VK_NUMPAD8 0x68 /* Numeric keypad '8' key */
#define VK_NUMPAD9 0x69 /* Numeric keypad '9' key */
/* Numeric keypad operators and special keys */
#define VK_MULTIPLY 0x6A /* Multiply key */
#define VK_ADD 0x6B /* Add key */
#define VK_SEPARATOR 0x6C /* Separator key */
#define VK_SUBTRACT 0x6D /* Subtract key */
#define VK_DECIMAL 0x6E /* Decimal key */
#define VK_DIVIDE 0x6F /* Divide key */
/* Function keys, from F1 to F24 */
#define VK_F1 0x70 /* F1 key */
#define VK_F2 0x71 /* F2 key */
#define VK_F3 0x72 /* F3 key */
#define VK_F4 0x73 /* F4 key */
#define VK_F5 0x74 /* F5 key */
#define VK_F6 0x75 /* F6 key */
#define VK_F7 0x76 /* F7 key */
#define VK_F8 0x77 /* F8 key */
#define VK_F9 0x78 /* F9 key */
#define VK_F10 0x79 /* F10 key */
#define VK_F11 0x7A /* F11 key */
#define VK_F12 0x7B /* F12 key */
#define VK_F13 0x7C /* F13 key */
#define VK_F14 0x7D /* F14 key */
#define VK_F15 0x7E /* F15 key */
#define VK_F16 0x7F /* F16 key */
#define VK_F17 0x80 /* F17 key */
#define VK_F18 0x81 /* F18 key */
#define VK_F19 0x82 /* F19 key */
#define VK_F20 0x83 /* F20 key */
#define VK_F21 0x84 /* F21 key */
#define VK_F22 0x85 /* F22 key */
#define VK_F23 0x86 /* F23 key */
#define VK_F24 0x87 /* F24 key */
/* 0x88 to 0x8F are unassigned */
#define VK_NUMLOCK 0x90 /* NUM LOCK key */
#define VK_SCROLL 0x91 /* SCROLL LOCK key */
/* 0x92 to 0x96 are OEM specific */
/* 0x97 to 0x9F are unassigned */
/* Modifier keys */
#define VK_LSHIFT 0xA0 /* Left SHIFT key */
#define VK_RSHIFT 0xA1 /* Right SHIFT key */
#define VK_LCONTROL 0xA2 /* Left CONTROL key */
#define VK_RCONTROL 0xA3 /* Right CONTROL key */
#define VK_LMENU 0xA4 /* Left MENU key */
#define VK_RMENU 0xA5 /* Right MENU key */
/* Browser related keys */
#define VK_BROWSER_BACK 0xA6 /* Windows 2000/XP: Browser Back key */
#define VK_BROWSER_FORWARD 0xA7 /* Windows 2000/XP: Browser Forward key */
#define VK_BROWSER_REFRESH 0xA8 /* Windows 2000/XP: Browser Refresh key */
#define VK_BROWSER_STOP 0xA9 /* Windows 2000/XP: Browser Stop key */
#define VK_BROWSER_SEARCH 0xAA /* Windows 2000/XP: Browser Search key */
#define VK_BROWSER_FAVORITES 0xAB /* Windows 2000/XP: Browser Favorites key */
#define VK_BROWSER_HOME 0xAC /* Windows 2000/XP: Browser Start and Home key */
/* Volume related keys */
#define VK_VOLUME_MUTE 0xAD /* Windows 2000/XP: Volume Mute key */
#define VK_VOLUME_DOWN 0xAE /* Windows 2000/XP: Volume Down key */
#define VK_VOLUME_UP 0xAF /* Windows 2000/XP: Volume Up key */
/* Media player related keys */
#define VK_MEDIA_NEXT_TRACK 0xB0 /* Windows 2000/XP: Next Track key */
#define VK_MEDIA_PREV_TRACK 0xB1 /* Windows 2000/XP: Previous Track key */
#define VK_MEDIA_STOP 0xB2 /* Windows 2000/XP: Stop Media key */
#define VK_MEDIA_PLAY_PAUSE 0xB3 /* Windows 2000/XP: Play/Pause Media key */
/* Application launcher keys */
#define VK_LAUNCH_MAIL 0xB4 /* Windows 2000/XP: Start Mail key */
#define VK_MEDIA_SELECT 0xB5 /* Windows 2000/XP: Select Media key */
#define VK_LAUNCH_APP1 0xB6 /* Windows 2000/XP: Start Application 1 key */
#define VK_LAUNCH_APP2 0xB7 /* Windows 2000/XP: Start Application 2 key */
/* 0xB8 and 0xB9 are reserved */
/* OEM keys */
#define VK_OEM_1 0xBA /* Used for miscellaneous characters; it can vary by keyboard. */
/* Windows 2000/XP: For the US standard keyboard, the ';:' key */
#define VK_OEM_PLUS 0xBB /* Windows 2000/XP: For any country/region, the '+' key */
#define VK_OEM_COMMA 0xBC /* Windows 2000/XP: For any country/region, the ',' key */
#define VK_OEM_MINUS 0xBD /* Windows 2000/XP: For any country/region, the '-' key */
#define VK_OEM_PERIOD 0xBE /* Windows 2000/XP: For any country/region, the '.' key */
#define VK_OEM_2 0xBF /* Used for miscellaneous characters; it can vary by keyboard. */
/* Windows 2000/XP: For the US standard keyboard, the '/?' key */
#define VK_OEM_3 0xC0 /* Used for miscellaneous characters; it can vary by keyboard. */
/* Windows 2000/XP: For the US standard keyboard, the '`~' key */
/* 0xC1 to 0xD7 are reserved */
#define VK_ABNT_C1 0xC1 /* Brazilian (ABNT) Keyboard */
#define VK_ABNT_C2 0xC2 /* Brazilian (ABNT) Keyboard */
/* 0xD8 to 0xDA are unassigned */
#define VK_OEM_4 0xDB /* Used for miscellaneous characters; it can vary by keyboard. */
/* Windows 2000/XP: For the US standard keyboard, the '[{' key */
#define VK_OEM_5 0xDC /* Used for miscellaneous characters; it can vary by keyboard. */
/* Windows 2000/XP: For the US standard keyboard, the '\|' key */
#define VK_OEM_6 0xDD /* Used for miscellaneous characters; it can vary by keyboard. */
/* Windows 2000/XP: For the US standard keyboard, the ']}' key */
#define VK_OEM_7 0xDE /* Used for miscellaneous characters; it can vary by keyboard. */
/* Windows 2000/XP: For the US standard keyboard, the 'single-quote/double-quote' key */
#define VK_OEM_8 0xDF /* Used for miscellaneous characters; it can vary by keyboard. */
/* 0xE0 is reserved */
/* 0xE1 is OEM specific */
#define VK_OEM_102 0xE2 /* Windows 2000/XP: Either the angle bracket key or */
/* the backslash key on the RT 102-key keyboard */
/* 0xE3 and 0xE4 are OEM specific */
#define VK_PROCESSKEY 0xE5 /* Windows 95/98/Me, Windows NT 4.0, Windows 2000/XP: IME PROCESS key */
/* 0xE6 is OEM specific */
#define VK_PACKET 0xE7 /* Windows 2000/XP: Used to pass Unicode characters as if they were keystrokes. */
/* The #define VK_PACKET key is the low word of a 32-bit Virtual Key value used */
/* for non-keyboard input methods. For more information, */
/* see Remark in KEYBDINPUT, SendInput, WM_KEYDOWN, and WM_KEYUP */
/* 0xE8 is unassigned */
/* 0xE9 to 0xF5 are OEM specific */
#define VK_ATTN 0xF6 /* Attn key */
#define VK_CRSEL 0xF7 /* CrSel key */
#define VK_EXSEL 0xF8 /* ExSel key */
#define VK_EREOF 0xF9 /* Erase EOF key */
#define VK_PLAY 0xFA /* Play key */
#define VK_ZOOM 0xFB /* Zoom key */
#define VK_NONAME 0xFC /* Reserved */
#define VK_PA1 0xFD /* PA1 key */
#define VK_OEM_CLEAR 0xFE /* Clear key */
FREERDP_API const char* freerdp_keyboard_get_virtual_key_code_name(uint32 vkcode);
FREERDP_API uint32 freerdp_keyboard_get_virtual_key_code_from_name(const char* vkcode_name);
#endif /* __FREERDP_VIRTUAL_KEY_CODES_H */

View File

@ -420,6 +420,10 @@ boolean security_establish_keys(uint8* client_random, rdpRdp* rdp)
memcpy(rdp->decrypt_update_key, rdp->decrypt_key, 16);
memcpy(rdp->encrypt_update_key, rdp->encrypt_key, 16);
rdp->decrypt_use_count = 0;
rdp->decrypt_checksum_use_count = 0;
rdp->encrypt_use_count =0;
rdp->encrypt_checksum_use_count =0;
return true;
}

View File

@ -18,6 +18,7 @@
# limitations under the License.
set(FREERDP_LOCALE_SRCS
virtual_key_codes.c
keyboard_layout.c
keyboard.c
locale.c
@ -25,12 +26,18 @@ set(FREERDP_LOCALE_SRCS
liblocale.h)
set(FREERDP_LOCALE_X11_SRCS
xkb_layout_ids.c
xkb_layout_ids.h)
set(FREERDP_LOCALE_X11_KEYMAP_SRCS
keyboard_keymap.c
keyboard_keymap.h
keyboard_x11.c
keyboard_x11.h)
set(FREERDP_LOCALE_XKB_SRCS
keyboard_xkb.c
keyboard_xkb.h)
set(FREERDP_LOCALE_XKBFILE_SRCS
keyboard_xkbfile.c
keyboard_xkbfile.h)
set(FREERDP_LOCALE_SUN_SRCS
keyboard_sun.c
@ -49,18 +56,19 @@ if(NOT WIN32)
include_directories(${X11_INCLUDE_DIRS})
set(FREERDP_LOCALE_SRCS ${FREERDP_LOCALE_SRCS} ${FREERDP_LOCALE_X11_SRCS})
set(FREERDP_LOCALE_LINK_LIBRARIES ${FREERDP_LOCALE_LINK_LIBRARIES} ${X11_LIBRARIES})
if(NOT APPLE)
find_suggested_package(XKBFile)
if(WITH_XKBFILE)
add_definitions(-DWITH_XKB)
include_directories(${XKBFILE_INCLUDE_DIRS})
set(FREERDP_LOCALE_SRCS ${FREERDP_LOCALE_SRCS} ${FREERDP_LOCALE_XKB_SRCS})
set(FREERDP_LOCALE_LINK_LIBRARIES ${FREERDP_LOCALE_LINK_LIBRARIES} ${XKBFILE_LIBRARIES})
endif()
endif()
if(WITH_SUN)
add_definitions(-DWITH_SUN)
set(FREERDP_LOCALE_SRCS ${FREERDP_LOCALE_SRCS} ${FREERDP_LOCALE_SUN_SRCS})
elseif(NOT APPLE)
find_suggested_package(XKBFile)
endif()
if(WITH_XKBFILE)
add_definitions(-DWITH_XKBFILE)
include_directories(${XKBFILE_INCLUDE_DIRS})
set(FREERDP_LOCALE_SRCS ${FREERDP_LOCALE_SRCS} ${FREERDP_LOCALE_XKBFILE_SRCS})
set(FREERDP_LOCALE_LINK_LIBRARIES ${FREERDP_LOCALE_LINK_LIBRARIES} ${XKBFILE_LIBRARIES})
else()
set(FREERDP_LOCALE_SRCS ${FREERDP_LOCALE_SRCS} ${FREERDP_LOCALE_X11_KEYMAP_SRCS})
endif()
endif()
endif()
@ -72,4 +80,3 @@ set_target_properties(freerdp-locale PROPERTIES VERSION ${FREERDP_VERSION_FULL}
target_link_libraries(freerdp-locale ${FREERDP_LOCALE_LINK_LIBRARIES})
install(TARGETS freerdp-locale DESTINATION ${CMAKE_INSTALL_LIBDIR})

View File

@ -18,228 +18,30 @@
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <freerdp/types.h>
#include <freerdp/utils/file.h>
#include <freerdp/utils/memory.h>
#include <freerdp/locale/keyboard.h>
#include <freerdp/locale/locale.h>
#include "keyboard_keymap.h"
#include "liblocale.h"
#ifdef WITH_X11
#include "keyboard_x11.h"
#ifdef WITH_XKBFILE
#include "keyboard_xkbfile.h"
#endif
#ifdef WITH_XKB
#include "keyboard_xkb.h"
#endif
#ifdef WITH_SUN
#include "keyboard_sun.h"
#endif
#include <freerdp/locale/locale.h>
#include <freerdp/locale/keyboard.h>
uint32 RDP_SCANCODE_TO_X11_KEYCODE[256][2];
RDP_SCANCODE X11_KEYCODE_TO_RDP_SCANCODE[256];
extern const VIRTUAL_KEY_CODE VIRTUAL_KEY_CODE_TABLE[256];
extern const uint32 VIRTUAL_KEY_CODE_TO_RDP_SCANCODE_TABLE[256];
extern const RDP_SCANCODE VIRTUAL_KEY_CODE_TO_DEFAULT_RDP_SCANCODE_TABLE[256];
int freerdp_keyboard_load_map(uint32 keycode_to_vkcode[256], char* name)
{
FILE* fp;
char* pch;
char* beg;
char* end;
int i = 0;
uint32 vkcode;
uint32 scancode;
int kbd_found = 0;
char* keymap_path;
uint32 keycode = 0;
char buffer[1024] = "";
char keymap_name[256] = "";
char keymap_include[256] = "";
char keymap_filename[256] = "";
char keycode_string[32] = "";
char vkcode_name[128] = "";
boolean found = false;
boolean extended = false;
beg = name;
/* Extract file name and keymap name */
if ((end = strrchr(name, '(')) != NULL)
{
strncpy(keymap_filename, &name[beg - name], end - beg);
beg = end + 1;
if ((end = strrchr(name, ')')) != NULL)
{
strncpy(keymap_name, &name[beg - name], end - beg);
keymap_name[end - beg] = '\0';
}
}
else
{
/* The keyboard name is the same as the file name */
strcpy(keymap_filename, name);
strcpy(keymap_name, name);
}
keymap_path = freerdp_construct_path(FREERDP_KEYMAP_PATH, keymap_filename);
DEBUG_KBD("Loading keymap %s, first trying %s", name, keymap_path);
if ((fp = fopen(keymap_path, "r")) == NULL)
{
return 0;
}
while (fgets(buffer, sizeof(buffer), fp) != NULL)
{
if (buffer[0] == '#')
{
continue; /* Skip comments */
}
if (kbd_found)
{
/* Closing curly bracket and semicolon */
if ((pch = strstr(buffer, "};")) != NULL)
{
break;
}
else if ((pch = strstr(buffer, "VK_")) != NULL)
{
/* The end is delimited by the first white space */
end = strcspn(pch, " \t\n\0") + pch;
/* We copy the virtual key code name in a string */
beg = pch;
strncpy(vkcode_name, beg, end - beg);
vkcode_name[end - beg] = '\0';
/* Now we want to extract the virtual key code itself which is in between '<' and '>' */
if ((beg = strchr(pch + 3, '<')) == NULL)
break;
else
beg++;
if ((end = strchr(beg, '>')) == NULL)
break;
/* We copy the string representing the number in a string */
strncpy(keycode_string, beg, end - beg);
keycode_string[end - beg] = '\0';
/* Convert the string representing the code to an integer */
keycode = atoi(keycode_string);
/* Make sure it is a valid keycode */
if (keycode < 0 || keycode > 255)
break;
/* Load this key mapping in the keyboard mapping */
i = 0;
found = false;
extended = false;
for (i = 0; i < 256; i++)
{
if (VIRTUAL_KEY_CODE_TABLE[i].name)
{
if (strcmp(vkcode_name, VIRTUAL_KEY_CODE_TABLE[i].name) == 0)
{
found = true;
vkcode = VIRTUAL_KEY_CODE_TABLE[i].code;
scancode = VIRTUAL_KEY_CODE_TO_RDP_SCANCODE_TABLE[vkcode];
extended = VIRTUAL_KEY_CODE_TO_DEFAULT_RDP_SCANCODE_TABLE[vkcode].extended;
keycode_to_vkcode[keycode] = vkcode;
}
}
}
}
else if ((pch = strstr(buffer, ": extends")) != NULL)
{
/*
* This map extends another keymap We extract its name
* and we recursively load the keymap we need to include.
*/
if ((beg = strchr(pch + sizeof(": extends"), '"')) == NULL)
break;
beg++;
if ((end = strchr(beg, '"')) == NULL)
break;
strncpy(keymap_include, beg, end - beg);
keymap_include[end - beg] = '\0';
freerdp_keyboard_load_map(keycode_to_vkcode, keymap_include); /* Load included keymap */
}
}
else if ((pch = strstr(buffer, "keyboard")) != NULL)
{
/* Keyboard map identifier */
if ((beg = strchr(pch + sizeof("keyboard"), '"')) == NULL)
break;
beg++;
if ((end = strchr(beg, '"')) == NULL)
break;
pch = beg;
buffer[end - beg] = '\0';
/* Does it match our keymap name? */
if (strncmp(keymap_name, pch, strlen(keymap_name)) == 0)
kbd_found = 1;
}
}
fclose(fp); /* Don't forget to close file */
return 1;
}
void freerdp_keyboard_load_maps(uint32 keycode_to_vkcode[256], char* names)
{
char* kbd;
char* names_end;
int keymap_loaded = 0;
memset(keycode_to_vkcode, 0, sizeof(keycode_to_vkcode));
kbd = names;
names_end = names + strlen(names);
do
{
/* multiple maps are separated by '+' */
int kbd_length = strcspn(kbd + 1, "+") + 1;
kbd[kbd_length] = '\0';
/* Load keyboard map */
keymap_loaded += freerdp_keyboard_load_map(keycode_to_vkcode, kbd);
kbd += kbd_length + 1;
}
while (kbd < names_end);
DEBUG_KBD("loaded %d keymaps", keymap_loaded);
if (keymap_loaded <= 0)
printf("error: no keyboard mapping available!\n");
}
uint32 freerdp_detect_keyboard(uint32 keyboardLayoutID)
{
if (keyboardLayoutID != 0)
@ -262,18 +64,25 @@ uint32 freerdp_detect_keyboard(uint32 keyboardLayoutID)
uint32 freerdp_keyboard_init(uint32 keyboardLayoutId)
{
#ifdef WITH_XKB
keyboardLayoutId = freerdp_keyboard_init_xkb(keyboardLayoutId);
if (keyboardLayoutId == 0)
keyboardLayoutId = freerdp_keyboard_init_x11(keyboardLayoutId);
#else
uint32 keycode;
#ifdef WITH_X11
keyboardLayoutId = freerdp_keyboard_init_x11(keyboardLayoutId);
#ifdef WITH_XKBFILE
keyboardLayoutId = freerdp_keyboard_init_xkbfile(keyboardLayoutId, X11_KEYCODE_TO_RDP_SCANCODE);
#else
keyboardLayoutId = freerdp_keyboard_init_x11(keyboardLayoutId, X11_KEYCODE_TO_RDP_SCANCODE);
#endif
#endif
keyboardLayoutId = freerdp_detect_keyboard(keyboardLayoutId);
memset(RDP_SCANCODE_TO_X11_KEYCODE, 0, sizeof(RDP_SCANCODE_TO_X11_KEYCODE));
for (keycode=0; keycode < ARRAY_SIZE(RDP_SCANCODE_TO_X11_KEYCODE); keycode++)
RDP_SCANCODE_TO_X11_KEYCODE
[X11_KEYCODE_TO_RDP_SCANCODE[keycode].code]
[X11_KEYCODE_TO_RDP_SCANCODE[keycode].extended ? 1: 0] = keycode;
return keyboardLayoutId;
}
@ -299,10 +108,5 @@ uint32 freerdp_keyboard_get_x11_keycode_from_rdp_scancode(uint32 scancode, boole
uint32 freerdp_keyboard_get_rdp_scancode_from_virtual_key_code(uint32 vkcode, boolean* extended)
{
*extended = VIRTUAL_KEY_CODE_TO_DEFAULT_RDP_SCANCODE_TABLE[vkcode].extended;
return VIRTUAL_KEY_CODE_TO_RDP_SCANCODE_TABLE[vkcode];
}
char* freerdp_keyboard_get_virtual_key_code_name(uint32 vkcode)
{
return (char*) VIRTUAL_KEY_CODE_TABLE[vkcode].name;
return VIRTUAL_KEY_CODE_TO_DEFAULT_RDP_SCANCODE_TABLE[vkcode].code;
}

View File

@ -0,0 +1,209 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* Keyboard Localization - loading of keymap files
*
* Copyright 2009-2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "keyboard_keymap.h"
#include <freerdp/utils/file.h>
#include <freerdp/utils/memory.h>
#include <freerdp/locale/virtual_key_codes.h>
#include <freerdp/locale/keyboard.h>
#include "config.h"
#include "liblocale.h"
#include <stdlib.h>
extern const RDP_SCANCODE VIRTUAL_KEY_CODE_TO_DEFAULT_RDP_SCANCODE_TABLE[256];
int freerdp_keyboard_load_map(uint32 keycode_to_vkcode[256], char* name)
{
FILE* fp;
char* pch;
char* beg;
char* end;
uint32 vkcode;
uint32 scancode;
int kbd_found = 0;
char* keymap_path;
uint32 keycode = 0;
char buffer[1024] = "";
char keymap_name[256] = "";
char keymap_include[256] = "";
char keymap_filename[256] = "";
char keycode_string[32] = "";
char vkcode_name[128] = "";
boolean extended = false;
beg = name;
/* Extract file name and keymap name */
if ((end = strrchr(name, '(')) != NULL)
{
strncpy(keymap_filename, &name[beg - name], end - beg);
beg = end + 1;
if ((end = strrchr(name, ')')) != NULL)
{
strncpy(keymap_name, &name[beg - name], end - beg);
keymap_name[end - beg] = '\0';
}
}
else
{
/* The keyboard name is the same as the file name */
strcpy(keymap_filename, name);
strcpy(keymap_name, name);
}
keymap_path = freerdp_construct_path(FREERDP_KEYMAP_PATH, keymap_filename);
DEBUG_KBD("Loading keymap %s, first trying %s", name, keymap_path);
if ((fp = fopen(keymap_path, "r")) == NULL)
{
DEBUG_KBD("%s not found", keymap_path);
xfree(keymap_path);
return 0;
}
xfree(keymap_path);
while (fgets(buffer, sizeof(buffer), fp) != NULL)
{
if (buffer[0] == '#')
{
continue; /* Skip comments */
}
if (kbd_found)
{
/* Closing curly bracket and semicolon */
if ((pch = strstr(buffer, "};")) != NULL)
{
break;
}
else if ((pch = strstr(buffer, "VK_")) != NULL)
{
/* The end is delimited by the first white space */
end = strcspn(pch, " \t\n\0") + pch;
/* We copy the virtual key code name in a string */
beg = pch;
strncpy(vkcode_name, beg, end - beg);
vkcode_name[end - beg] = '\0';
/* Now we want to extract the virtual key code itself which is in between '<' and '>' */
if ((beg = strchr(pch + 3, '<')) == NULL)
break;
else
beg++;
if ((end = strchr(beg, '>')) == NULL)
break;
/* We copy the string representing the number in a string */
strncpy(keycode_string, beg, end - beg);
keycode_string[end - beg] = '\0';
/* Convert the string representing the code to an integer */
keycode = atoi(keycode_string);
/* Make sure it is a valid keycode */
if (keycode < 0 || keycode > 255)
break;
/* Load this key mapping in the keyboard mapping */
vkcode = freerdp_keyboard_get_virtual_key_code_from_name(vkcode_name);
scancode = VIRTUAL_KEY_CODE_TO_DEFAULT_RDP_SCANCODE_TABLE[vkcode].code;
extended = VIRTUAL_KEY_CODE_TO_DEFAULT_RDP_SCANCODE_TABLE[vkcode].extended;
keycode_to_vkcode[keycode] = vkcode;
}
else if ((pch = strstr(buffer, ": extends")) != NULL)
{
/*
* This map extends another keymap We extract its name
* and we recursively load the keymap we need to include.
*/
if ((beg = strchr(pch + sizeof(": extends"), '"')) == NULL)
break;
beg++;
if ((end = strchr(beg, '"')) == NULL)
break;
strncpy(keymap_include, beg, end - beg);
keymap_include[end - beg] = '\0';
freerdp_keyboard_load_map(keycode_to_vkcode, keymap_include); /* Load included keymap */
}
}
else if ((pch = strstr(buffer, "keyboard")) != NULL)
{
/* Keyboard map identifier */
if ((beg = strchr(pch + sizeof("keyboard"), '"')) == NULL)
break;
beg++;
if ((end = strchr(beg, '"')) == NULL)
break;
pch = beg;
buffer[end - beg] = '\0';
/* Does it match our keymap name? */
if (strncmp(keymap_name, pch, strlen(keymap_name)) == 0)
kbd_found = 1;
}
}
fclose(fp); /* Don't forget to close file */
return 1;
}
void freerdp_keyboard_load_maps(uint32 keycode_to_vkcode[256], char* names)
{
char* kbd;
char* names_end;
int keymap_loaded = 0;
memset(keycode_to_vkcode, 0, sizeof(keycode_to_vkcode));
kbd = names;
names_end = names + strlen(names);
do
{
/* multiple maps are separated by '+' */
int kbd_length = strcspn(kbd + 1, "+") + 1;
kbd[kbd_length] = '\0';
/* Load keyboard map */
keymap_loaded += freerdp_keyboard_load_map(keycode_to_vkcode, kbd);
kbd += kbd_length + 1;
}
while (kbd < names_end);
DEBUG_KBD("loaded %d keymaps", keymap_loaded);
if (keymap_loaded <= 0)
printf("error: no keyboard mapping available!\n");
}

View File

@ -0,0 +1,28 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* Keyboard Localization - loading of keymap files
*
* Copyright 2009-2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef __KEYBOARD_KEYMAP_H
#define __KEYBOARD_KEYMAP_H
#include <freerdp/types.h>
int freerdp_keyboard_load_map(uint32 keycode_to_vkcode[256], char* name);
void freerdp_keyboard_load_maps(uint32 keycode_to_vkcode[256], char* names);
#endif /* __KEYBOARD_KEYMAP_H */

View File

@ -207,527 +207,6 @@ static const RDP_KEYBOARD_IME RDP_KEYBOARD_IME_TABLE[] =
{ KBD_CHINESE_TRADITIONAL_ALPHANUMERIC, "romanime.ime", "Chinese (Traditional) - Alphanumeric" }
};
const VIRTUAL_KEY_CODE VIRTUAL_KEY_CODE_TABLE[256] =
{
{ 0, "" },
{ VK_LBUTTON, "VK_LBUTTON" },
{ VK_RBUTTON, "VK_RBUTTON" },
{ VK_CANCEL, "VK_CANCEL" },
{ VK_MBUTTON, "VK_MBUTTON" },
{ VK_XBUTTON1, "VK_XBUTTON1" },
{ VK_XBUTTON2, "VK_XBUTTON2" },
{ 0, "" },
{ VK_BACK, "VK_BACK" },
{ VK_TAB, "VK_TAB" },
{ 0, "" },
{ 0, "" },
{ VK_CLEAR, "VK_CLEAR" },
{ VK_RETURN, "VK_RETURN" },
{ 0, "" },
{ 0, "" },
{ VK_SHIFT, "VK_SHIFT" },
{ VK_CONTROL, "VK_CONTROL" },
{ VK_MENU, "VK_MENU" },
{ VK_PAUSE, "VK_PAUSE" },
{ VK_CAPITAL, "VK_CAPITAL" },
{ VK_KANA, "VK_KANA" }, /* also VK_HANGUL */
{ 0, "" },
{ VK_JUNJA, "VK_JUNJA" },
{ VK_FINAL, "VK_FINAL" },
{ VK_KANJI, "VK_KANJI" }, /* also VK_HANJA */
{ 0, "" },
{ VK_ESCAPE, "VK_ESCAPE" },
{ VK_CONVERT, "VK_CONVERT" },
{ VK_NONCONVERT, "VK_NONCONVERT" },
{ VK_ACCEPT, "VK_ACCEPT" },
{ VK_MODECHANGE, "VK_MODECHANGE" },
{ VK_SPACE, "VK_SPACE" },
{ VK_PRIOR, "VK_PRIOR" },
{ VK_NEXT, "VK_NEXT" },
{ VK_END, "VK_END" },
{ VK_HOME, "VK_HOME" },
{ VK_LEFT, "VK_LEFT" },
{ VK_UP, "VK_UP" },
{ VK_RIGHT, "VK_RIGHT" },
{ VK_DOWN, "VK_DOWN" },
{ VK_SELECT, "VK_SELECT" },
{ VK_PRINT, "VK_PRINT" },
{ VK_EXECUTE, "VK_EXECUTE" },
{ VK_SNAPSHOT, "VK_SNAPSHOT" },
{ VK_INSERT, "VK_INSERT" },
{ VK_DELETE, "VK_DELETE" },
{ VK_HELP, "VK_HELP" },
{ VK_KEY_0, "VK_KEY_0" },
{ VK_KEY_1, "VK_KEY_1" },
{ VK_KEY_2, "VK_KEY_2" },
{ VK_KEY_3, "VK_KEY_3" },
{ VK_KEY_4, "VK_KEY_4" },
{ VK_KEY_5, "VK_KEY_5" },
{ VK_KEY_6, "VK_KEY_6" },
{ VK_KEY_7, "VK_KEY_7" },
{ VK_KEY_8, "VK_KEY_8" },
{ VK_KEY_9, "VK_KEY_9" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ VK_KEY_A, "VK_KEY_A" },
{ VK_KEY_B, "VK_KEY_B" },
{ VK_KEY_C, "VK_KEY_C" },
{ VK_KEY_D, "VK_KEY_D" },
{ VK_KEY_E, "VK_KEY_E" },
{ VK_KEY_F, "VK_KEY_F" },
{ VK_KEY_G, "VK_KEY_G" },
{ VK_KEY_H, "VK_KEY_H" },
{ VK_KEY_I, "VK_KEY_I" },
{ VK_KEY_J, "VK_KEY_J" },
{ VK_KEY_K, "VK_KEY_K" },
{ VK_KEY_L, "VK_KEY_L" },
{ VK_KEY_M, "VK_KEY_M" },
{ VK_KEY_N, "VK_KEY_N" },
{ VK_KEY_O, "VK_KEY_O" },
{ VK_KEY_P, "VK_KEY_P" },
{ VK_KEY_Q, "VK_KEY_Q" },
{ VK_KEY_R, "VK_KEY_R" },
{ VK_KEY_S, "VK_KEY_S" },
{ VK_KEY_T, "VK_KEY_T" },
{ VK_KEY_U, "VK_KEY_U" },
{ VK_KEY_V, "VK_KEY_V" },
{ VK_KEY_W, "VK_KEY_W" },
{ VK_KEY_X, "VK_KEY_X" },
{ VK_KEY_Y, "VK_KEY_Y" },
{ VK_KEY_Z, "VK_KEY_Z" },
{ VK_LWIN, "VK_LWIN" },
{ VK_RWIN, "VK_RWIN" },
{ VK_APPS, "VK_APPS" },
{ 0, "" },
{ VK_SLEEP, "VK_SLEEP" },
{ VK_NUMPAD0, "VK_NUMPAD0" },
{ VK_NUMPAD1, "VK_NUMPAD1" },
{ VK_NUMPAD2, "VK_NUMPAD2" },
{ VK_NUMPAD3, "VK_NUMPAD3" },
{ VK_NUMPAD4, "VK_NUMPAD4" },
{ VK_NUMPAD5, "VK_NUMPAD5" },
{ VK_NUMPAD6, "VK_NUMPAD6" },
{ VK_NUMPAD7, "VK_NUMPAD7" },
{ VK_NUMPAD8, "VK_NUMPAD8" },
{ VK_NUMPAD9, "VK_NUMPAD9" },
{ VK_MULTIPLY, "VK_MULTIPLY" },
{ VK_ADD, "VK_ADD" },
{ VK_SEPARATOR, "VK_SEPARATOR" },
{ VK_SUBTRACT, "VK_SUBTRACT" },
{ VK_DECIMAL, "VK_DECIMAL" },
{ VK_DIVIDE, "VK_DIVIDE" },
{ VK_F1, "VK_F1" },
{ VK_F2, "VK_F2" },
{ VK_F3, "VK_F3" },
{ VK_F4, "VK_F4" },
{ VK_F5, "VK_F5" },
{ VK_F6, "VK_F6" },
{ VK_F7, "VK_F7" },
{ VK_F8, "VK_F8" },
{ VK_F9, "VK_F9" },
{ VK_F10, "VK_F10" },
{ VK_F11, "VK_F11" },
{ VK_F12, "VK_F12" },
{ VK_F13, "VK_F13" },
{ VK_F14, "VK_F14" },
{ VK_F15, "VK_F15" },
{ VK_F16, "VK_F16" },
{ VK_F17, "VK_F17" },
{ VK_F18, "VK_F18" },
{ VK_F19, "VK_F19" },
{ VK_F20, "VK_F20" },
{ VK_F21, "VK_F21" },
{ VK_F22, "VK_F22" },
{ VK_F23, "VK_F23" },
{ VK_F24, "VK_F24" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ VK_NUMLOCK, "VK_NUMLOCK" },
{ VK_SCROLL, "VK_SCROLL" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ VK_LSHIFT, "VK_LSHIFT" },
{ VK_RSHIFT, "VK_RSHIFT" },
{ VK_LCONTROL, "VK_LCONTROL" },
{ VK_RCONTROL, "VK_RCONTROL" },
{ VK_LMENU, "VK_LMENU" },
{ VK_RMENU, "VK_RMENU" },
{ VK_BROWSER_BACK, "VK_BROWSER_BACK" },
{ VK_BROWSER_FORWARD, "VK_BROWSER_FORWARD" },
{ VK_BROWSER_REFRESH, "VK_BROWSER_REFRESH" },
{ VK_BROWSER_STOP, "VK_BROWSER_STOP" },
{ VK_BROWSER_SEARCH, "VK_BROWSER_SEARCH" },
{ VK_BROWSER_FAVORITES, "VK_BROWSER_FAVORITES" },
{ VK_BROWSER_HOME, "VK_BROWSER_HOME" },
{ VK_VOLUME_MUTE, "VK_VOLUME_MUTE" },
{ VK_VOLUME_DOWN, "VK_VOLUME_DOWN" },
{ VK_VOLUME_UP, "VK_VOLUME_UP" },
{ VK_MEDIA_NEXT_TRACK, "VK_MEDIA_NEXT_TRACK" },
{ VK_MEDIA_PREV_TRACK, "VK_MEDIA_PREV_TRACK" },
{ VK_MEDIA_STOP, "VK_MEDIA_STOP" },
{ VK_MEDIA_PLAY_PAUSE, "VK_MEDIA_PLAY_PAUSE" },
{ VK_LAUNCH_MAIL, "VK_LAUNCH_MAIL" },
{ VK_MEDIA_SELECT, "VK_MEDIA_SELECT" },
{ VK_LAUNCH_APP1, "VK_LAUNCH_APP1" },
{ VK_LAUNCH_APP2, "VK_LAUNCH_APP2" },
{ 0, "" },
{ 0, "" },
{ VK_OEM_1, "VK_OEM_1" },
{ VK_OEM_PLUS, "VK_OEM_PLUS" },
{ VK_OEM_COMMA, "VK_OEM_COMMA" },
{ VK_OEM_MINUS, "VK_OEM_MINUS" },
{ VK_OEM_PERIOD, "VK_OEM_PERIOD" },
{ VK_OEM_2, "VK_OEM_2" },
{ VK_OEM_3, "VK_OEM_3" },
{ VK_ABNT_C1, "VK_ABNT_C1" },
{ VK_ABNT_C2, "VK_ABNT_C2" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ VK_OEM_4, "VK_OEM_4" },
{ VK_OEM_5, "VK_OEM_5" },
{ VK_OEM_6, "VK_OEM_6" },
{ VK_OEM_7, "VK_OEM_7" },
{ VK_OEM_8, "VK_OEM_8" },
{ 0, "" },
{ 0, "" },
{ VK_OEM_102, "VK_OEM_102" },
{ 0, "" },
{ 0, "" },
{ VK_PROCESSKEY, "VK_PROCESSKEY" },
{ 0, "" },
{ VK_PACKET, "VK_PACKET" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ VK_ATTN, "VK_ATTN" },
{ VK_CRSEL, "VK_CRSEL" },
{ VK_EXSEL, "VK_EXSEL" },
{ VK_EREOF, "VK_EREOF" },
{ VK_PLAY, "VK_PLAY" },
{ VK_ZOOM, "VK_ZOOM" },
{ VK_NONAME, "VK_NONAME" },
{ VK_PA1, "VK_PA1" },
{ VK_OEM_CLEAR, "VK_OEM_CLEAR" },
{ 0, "" }
};
/* the index in this table is the virtual key code */
const uint32 VIRTUAL_KEY_CODE_TO_RDP_SCANCODE_TABLE[256] =
{
0x00,
0x00, /* VK_LBUTTON */
0x00, /* VK_RBUTTON */
0x00, /* VK_CANCEL */
0x00, /* VK_MBUTTON */
0x00, /* VK_XBUTTON1 */
0x00, /* VK_XBUTTON2 */
0x00,
0x0E, /* VK_BACK */
0x0F, /* VK_TAB */
0x00,
0x00,
0x00, /* VK_CLEAR */
0x1C, /* VK_RETURN */
0x00,
0x00,
0x2A, /* VK_SHIFT */
0x00, /* VK_CONTROL */
0x38, /* VK_MENU */
0x46, /* VK_PAUSE */
0x3A, /* VK_CAPITAL */
0x72, /* VK_KANA / VK_HANGUL */
0x00,
0x00, /* VK_JUNJA */
0x00, /* VK_FINAL */
0x71, /* VK_HANJA / VK_KANJI */
0x00,
0x01, /* VK_ESCAPE */
0x00, /* VK_CONVERT */
0x00, /* VK_NONCONVERT */
0x00, /* VK_ACCEPT */
0x00, /* VK_MODECHANGE */
0x39, /* VK_SPACE */
0x49, /* VK_PRIOR */
0x51, /* VK_NEXT */
0x4F, /* VK_END */
0x47, /* VK_HOME */
0x4B, /* VK_LEFT */
0x48, /* VK_UP */
0x4D, /* VK_RIGHT */
0x50, /* VK_DOWN */
0x00, /* VK_SELECT */
0x37, /* VK_PRINT */
0x37, /* VK_EXECUTE */
0x37, /* VK_SNAPSHOT */
0x52, /* VK_INSERT */
0x53, /* VK_DELETE */
0x63, /* VK_HELP */
0x0B, /* VK_KEY_0 */
0x02, /* VK_KEY_1 */
0x03, /* VK_KEY_2 */
0x04, /* VK_KEY_3 */
0x05, /* VK_KEY_4 */
0x06, /* VK_KEY_5 */
0x07, /* VK_KEY_6 */
0x08, /* VK_KEY_7 */
0x09, /* VK_KEY_8 */
0x0A, /* VK_KEY_9 */
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x1E, /* VK_KEY_A */
0x30, /* VK_KEY_B */
0x2E, /* VK_KEY_C */
0x20, /* VK_KEY_D */
0x12, /* VK_KEY_E */
0x21, /* VK_KEY_F */
0x22, /* VK_KEY_G */
0x23, /* VK_KEY_H */
0x17, /* VK_KEY_I */
0x24, /* VK_KEY_J */
0x25, /* VK_KEY_K */
0x26, /* VK_KEY_L */
0x32, /* VK_KEY_M */
0x31, /* VK_KEY_N */
0x18, /* VK_KEY_O */
0x19, /* VK_KEY_P */
0x10, /* VK_KEY_Q */
0x13, /* VK_KEY_R */
0x1F, /* VK_KEY_S */
0x14, /* VK_KEY_T */
0x16, /* VK_KEY_U */
0x2F, /* VK_KEY_V */
0x11, /* VK_KEY_W */
0x2D, /* VK_KEY_X */
0x15, /* VK_KEY_Y */
0x2C, /* VK_KEY_Z */
0x5B, /* VK_LWIN */
0x5C, /* VK_RWIN */
0x5D, /* VK_APPS */
0x00,
0x5F, /* VK_SLEEP */
0x52, /* VK_NUMPAD0 */
0x4F, /* VK_NUMPAD1 */
0x50, /* VK_NUMPAD2 */
0x51, /* VK_NUMPAD3 */
0x4B, /* VK_NUMPAD4 */
0x4C, /* VK_NUMPAD5 */
0x4D, /* VK_NUMPAD6 */
0x47, /* VK_NUMPAD7 */
0x48, /* VK_NUMPAD8 */
0x49, /* VK_NUMPAD9 */
0x37, /* VK_MULTIPLY */
0x4E, /* VK_ADD */
0x00, /* VK_SEPARATOR */
0x4A, /* VK_SUBTRACT */
0x53, /* VK_DECIMAL */
0x35, /* VK_DIVIDE */
0x3B, /* VK_F1 */
0x3C, /* VK_F2 */
0x3D, /* VK_F3 */
0x3E, /* VK_F4 */
0x3F, /* VK_F5 */
0x40, /* VK_F6 */
0x41, /* VK_F7 */
0x42, /* VK_F8 */
0x43, /* VK_F9 */
0x44, /* VK_F10 */
0x57, /* VK_F11 */
0x58, /* VK_F12 */
0x64, /* VK_F13 */
0x65, /* VK_F14 */
0x66, /* VK_F15 */
0x67, /* VK_F16 */
0x68, /* VK_F17 */
0x69, /* VK_F18 */
0x6A, /* VK_F19 */
0x6B, /* VK_F20 */
0x6C, /* VK_F21 */
0x6D, /* VK_F22 */
0x6E, /* VK_F23 */
0x6F, /* VK_F24 */
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x45, /* VK_NUMLOCK */
0x46, /* VK_SCROLL */
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x2A, /* VK_LSHIFT */
0x36, /* VK_RSHIFT */
0x1D, /* VK_LCONTROL */
0x1D, /* VK_RCONTROL */
0x38, /* VK_LMENU */
0x38, /* VK_RMENU */
0x00, /* VK_BROWSER_BACK */
0x00, /* VK_BROWSER_FORWARD */
0x00, /* VK_BROWSER_REFRESH */
0x00, /* VK_BROWSER_STOP */
0x00, /* VK_BROWSER_SEARCH */
0x00, /* VK_BROWSER_FAVORITES */
0x00, /* VK_BROWSER_HOME */
0x00, /* VK_VOLUME_MUTE */
0x00, /* VK_VOLUME_DOWN */
0x00, /* VK_VOLUME_UP */
0x00, /* VK_MEDIA_NEXT_TRACK */
0x00, /* VK_MEDIA_PREV_TRACK */
0x00, /* VK_MEDIA_STOP */
0x00, /* VK_MEDIA_PLAY_PAUSE */
0x00, /* VK_LAUNCH_MAIL */
0x00, /* VK_MEDIA_SELECT */
0x00, /* VK_LAUNCH_APP1 */
0x00, /* VK_LAUNCH_APP2 */
0x00,
0x00,
0x27, /* VK_OEM_1 */
0x0D, /* VK_OEM_PLUS */
0x33, /* VK_OEM_COMMA */
0x0C, /* VK_OEM_MINUS */
0x34, /* VK_OEM_PERIOD */
0x35, /* VK_OEM_2 */
0x29, /* VK_OEM_3 */
0x73, /* VK_ABNT_C1 */
0x7E, /* VK_ABNT_C2 */
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x1A, /* VK_OEM_4 */
0x2B, /* VK_OEM_5 */
0x1B, /* VK_OEM_6 */
0x28, /* VK_OEM_7 */
0x1D, /* VK_OEM_8 */
0x00,
0x00,
0x56, /* VK_OEM_102 */
0x00,
0x00,
0x00, /* VK_PROCESSKEY */
0x00,
0x00, /* VK_PACKET */
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00, /* VK_ATTN */
0x00, /* VK_CRSEL */
0x00, /* VK_EXSEL */
0x00, /* VK_EREOF */
0x00, /* VK_PLAY */
0x62, /* VK_ZOOM */
0x00, /* VK_NONAME */
0x00, /* VK_PA1 */
0x00, /* VK_OEM_CLEAR */
0x00
};
/* the index in this table is the virtual key code */

View File

@ -23,6 +23,7 @@
#include "liblocale.h"
#include <freerdp/locale/keyboard.h>
#include <freerdp/utils/memory.h>
#include "keyboard_x11.h"
@ -197,7 +198,7 @@ static const SOLARIS_KEYBOARD SOLARIS_KEYBOARD_TABLE[] =
{ 6, 272, "sun(type6)", KBD_PORTUGUESE_BRAZILIAN_ABNT } /* Brazil6_usb */
};
uint32 freerdp_detect_keyboard_type_and_layout_solaris(char* xkbfile, int length)
uint32 freerdp_detect_keyboard_type_and_layout_solaris(char* keyboard_type, int length)
{
FILE* kbd;
@ -251,7 +252,7 @@ uint32 freerdp_detect_keyboard_type_and_layout_solaris(char* xkbfile, int length
{
if (SOLARIS_KEYBOARD_TABLE[i].layout == layout)
{
strncpy(xkbfile, SOLARIS_KEYBOARD_TABLE[i].xkbType, length);
strncpy(keyboard_type, SOLARIS_KEYBOARD_TABLE[i].xkbType, length);
return SOLARIS_KEYBOARD_TABLE[i].keyboardLayoutId;
}
}

View File

@ -20,8 +20,6 @@
#ifndef __LOCALE_KEYBOARD_SUN_H
#define __LOCALE_KEYBOARD_SUN_H
#include "keyboard_x11.h"
uint32 freerdp_detect_keyboard_type_and_layout_solaris(char* xkbfile, int length);
uint32 freerdp_detect_keyboard_type_and_layout_solaris(char* keyboard_type, int length);
#endif /* __LOCALE_KEYBOARD_SUN_H */

File diff suppressed because it is too large Load Diff

View File

@ -20,7 +20,6 @@
#ifndef __LOCALE_KEYBOARD_X11_H
#define __LOCALE_KEYBOARD_X11_H
uint32 freerdp_keyboard_init_x11(uint32 keyboardLayoutId);
uint32 find_keyboard_layout_in_xorg_rules(char* layout, char* variant);
uint32 freerdp_keyboard_init_x11(uint32 keyboardLayoutId, RDP_SCANCODE x11_keycode_to_rdp_scancode[256]);
#endif /* __LOCALE_KEYBOARD_X11_H */

View File

@ -17,24 +17,22 @@
* limitations under the License.
*/
#include "keyboard_xkbfile.h"
#include <freerdp/locale/keyboard.h>
#include <freerdp/utils/memory.h>
#include "keyboard_x11.h"
#include "xkb_layout_ids.h"
#include "liblocale.h"
#include "keyboard_xkb.h"
#include "keyboard_x11.h"
#include <freerdp/locale/keyboard.h>
extern uint32 RDP_SCANCODE_TO_X11_KEYCODE[256][2];
extern RDP_SCANCODE X11_KEYCODE_TO_RDP_SCANCODE[256];
extern const VIRTUAL_KEY_CODE VIRTUAL_KEY_CODE_TABLE[256];
extern const uint32 VIRTUAL_KEY_CODE_TO_RDP_SCANCODE_TABLE[256];
extern const RDP_SCANCODE VIRTUAL_KEY_CODE_TO_DEFAULT_RDP_SCANCODE_TABLE[256];
#include <X11/Xlib.h>
#include <X11/XKBlib.h>
#include <X11/extensions/XKBfile.h>
#include <X11/extensions/XKBrules.h>
#include <freerdp/utils/memory.h>
VIRTUAL_KEY_CODE_TO_XKB_KEY_NAME VIRTUAL_KEY_CODE_TO_XKB_KEY_NAME_TABLE[256] =
{
{ 0, "", "" },
@ -316,11 +314,10 @@ void* freerdp_keyboard_xkb_init()
return (void*) display;
}
uint32 freerdp_keyboard_init_xkb(uint32 keyboardLayoutId)
uint32 freerdp_keyboard_init_xkbfile(uint32 keyboardLayoutId, RDP_SCANCODE x11_keycode_to_rdp_scancode[256])
{
void* display;
memset(X11_KEYCODE_TO_RDP_SCANCODE, 0, sizeof(X11_KEYCODE_TO_RDP_SCANCODE));
memset(RDP_SCANCODE_TO_X11_KEYCODE, 0, sizeof(RDP_SCANCODE_TO_X11_KEYCODE));
memset(x11_keycode_to_rdp_scancode, 0, sizeof(x11_keycode_to_rdp_scancode));
display = freerdp_keyboard_xkb_init();
@ -332,11 +329,11 @@ uint32 freerdp_keyboard_init_xkb(uint32 keyboardLayoutId)
if (keyboardLayoutId == 0)
{
keyboardLayoutId = detect_keyboard_layout_from_xkb(display);
keyboardLayoutId = detect_keyboard_layout_from_xkbfile(display);
DEBUG_KBD("detect_keyboard_layout_from_xkb: %X", keyboardLayoutId);
}
freerdp_keyboard_load_map_from_xkb(display);
freerdp_keyboard_load_map_from_xkbfile(display, x11_keycode_to_rdp_scancode);
XCloseDisplay(display);
@ -365,7 +362,7 @@ static char* comma_substring(char* s, int n)
return s;
}
uint32 detect_keyboard_layout_from_xkb(void* display)
uint32 detect_keyboard_layout_from_xkbfile(void* display)
{
char* layout;
char* variant;
@ -406,7 +403,7 @@ uint32 detect_keyboard_layout_from_xkb(void* display)
return keyboard_layout;
}
int freerdp_keyboard_load_map_from_xkb(void* display)
int freerdp_keyboard_load_map_from_xkbfile(void* display, RDP_SCANCODE x11_keycode_to_rdp_scancode[256])
{
int i, j;
uint32 vkcode;
@ -465,18 +462,14 @@ int freerdp_keyboard_load_map_from_xkb(void* display)
if (found)
{
scancode = VIRTUAL_KEY_CODE_TO_RDP_SCANCODE_TABLE[vkcode];
scancode = VIRTUAL_KEY_CODE_TO_DEFAULT_RDP_SCANCODE_TABLE[vkcode].code;
DEBUG_KBD("%4s: keycode: 0x%02X -> vkcode: 0x%02X -> rdp scancode: 0x%02X %s",
xkb_keyname, i, vkcode, scancode, extended ? " extended" : "");
DEBUG_KBD("%4s: keycode: 0x%02X -> vkcode: 0x%02X %-13s -> rdp scancode: 0x%02X %s",
xkb_keyname, i, vkcode, freerdp_keyboard_get_virtual_key_code_name(vkcode),
scancode, extended ? " extended" : "");
X11_KEYCODE_TO_RDP_SCANCODE[i].code = scancode;
X11_KEYCODE_TO_RDP_SCANCODE[i].extended = extended;
if (extended)
RDP_SCANCODE_TO_X11_KEYCODE[scancode][1] = i;
else
RDP_SCANCODE_TO_X11_KEYCODE[scancode][0] = i;
x11_keycode_to_rdp_scancode[i].code = scancode;
x11_keycode_to_rdp_scancode[i].extended = extended;
}
else
{

View File

@ -31,8 +31,8 @@ struct _VIRTUAL_KEY_CODE_TO_XKB_KEY_NAME
};
typedef struct _VIRTUAL_KEY_CODE_TO_XKB_KEY_NAME VIRTUAL_KEY_CODE_TO_XKB_KEY_NAME;
uint32 freerdp_keyboard_init_xkb(uint32 keyboardLayoutId);
uint32 detect_keyboard_layout_from_xkb(void* display);
int freerdp_keyboard_load_map_from_xkb(void* display);
uint32 freerdp_keyboard_init_xkbfile(uint32 keyboardLayoutId, RDP_SCANCODE x11_keycode_to_rdp_scancode[256]);
uint32 detect_keyboard_layout_from_xkbfile(void* display);
int freerdp_keyboard_load_map_from_xkbfile(void* display, RDP_SCANCODE x11_keycode_to_rdp_scancode[256]);
#endif /* __LOCALE_KEYBOARD_XKB_H */

View File

@ -21,12 +21,8 @@
#define __LIBLOCALE_H
#include "config.h"
#include <freerdp/types.h>
#include <freerdp/utils/debug.h>
int freerdp_keyboard_load_map(uint32 keycode_to_vkcode[256], char* name);
void freerdp_keyboard_load_maps(uint32 keycode_to_vkcode[256], char* names);
#ifdef WITH_DEBUG_KBD
#define DEBUG_KBD(fmt, ...) DEBUG_CLASS(KBD, fmt, ## __VA_ARGS__)
#else

View File

@ -0,0 +1,310 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* Keyboard Layouts
*
* Copyright 2009-2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <freerdp/locale/virtual_key_codes.h>
#include <freerdp/utils/memory.h>
struct _VIRTUAL_KEY_CODE
{
uint32 code; /* Windows Virtual Key Code */
const char* name; /* Virtual Key Code Name */
};
typedef struct _VIRTUAL_KEY_CODE VIRTUAL_KEY_CODE;
static const VIRTUAL_KEY_CODE VIRTUAL_KEY_CODE_TABLE[256] =
{
{ 0, "" },
{ VK_LBUTTON, "VK_LBUTTON" },
{ VK_RBUTTON, "VK_RBUTTON" },
{ VK_CANCEL, "VK_CANCEL" },
{ VK_MBUTTON, "VK_MBUTTON" },
{ VK_XBUTTON1, "VK_XBUTTON1" },
{ VK_XBUTTON2, "VK_XBUTTON2" },
{ 0, "" },
{ VK_BACK, "VK_BACK" },
{ VK_TAB, "VK_TAB" },
{ 0, "" },
{ 0, "" },
{ VK_CLEAR, "VK_CLEAR" },
{ VK_RETURN, "VK_RETURN" },
{ 0, "" },
{ 0, "" },
{ VK_SHIFT, "VK_SHIFT" },
{ VK_CONTROL, "VK_CONTROL" },
{ VK_MENU, "VK_MENU" },
{ VK_PAUSE, "VK_PAUSE" },
{ VK_CAPITAL, "VK_CAPITAL" },
{ VK_KANA, "VK_KANA" }, /* also VK_HANGUL */
{ 0, "" },
{ VK_JUNJA, "VK_JUNJA" },
{ VK_FINAL, "VK_FINAL" },
{ VK_KANJI, "VK_KANJI" }, /* also VK_HANJA */
{ 0, "" },
{ VK_ESCAPE, "VK_ESCAPE" },
{ VK_CONVERT, "VK_CONVERT" },
{ VK_NONCONVERT, "VK_NONCONVERT" },
{ VK_ACCEPT, "VK_ACCEPT" },
{ VK_MODECHANGE, "VK_MODECHANGE" },
{ VK_SPACE, "VK_SPACE" },
{ VK_PRIOR, "VK_PRIOR" },
{ VK_NEXT, "VK_NEXT" },
{ VK_END, "VK_END" },
{ VK_HOME, "VK_HOME" },
{ VK_LEFT, "VK_LEFT" },
{ VK_UP, "VK_UP" },
{ VK_RIGHT, "VK_RIGHT" },
{ VK_DOWN, "VK_DOWN" },
{ VK_SELECT, "VK_SELECT" },
{ VK_PRINT, "VK_PRINT" },
{ VK_EXECUTE, "VK_EXECUTE" },
{ VK_SNAPSHOT, "VK_SNAPSHOT" },
{ VK_INSERT, "VK_INSERT" },
{ VK_DELETE, "VK_DELETE" },
{ VK_HELP, "VK_HELP" },
{ VK_KEY_0, "VK_KEY_0" },
{ VK_KEY_1, "VK_KEY_1" },
{ VK_KEY_2, "VK_KEY_2" },
{ VK_KEY_3, "VK_KEY_3" },
{ VK_KEY_4, "VK_KEY_4" },
{ VK_KEY_5, "VK_KEY_5" },
{ VK_KEY_6, "VK_KEY_6" },
{ VK_KEY_7, "VK_KEY_7" },
{ VK_KEY_8, "VK_KEY_8" },
{ VK_KEY_9, "VK_KEY_9" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ VK_KEY_A, "VK_KEY_A" },
{ VK_KEY_B, "VK_KEY_B" },
{ VK_KEY_C, "VK_KEY_C" },
{ VK_KEY_D, "VK_KEY_D" },
{ VK_KEY_E, "VK_KEY_E" },
{ VK_KEY_F, "VK_KEY_F" },
{ VK_KEY_G, "VK_KEY_G" },
{ VK_KEY_H, "VK_KEY_H" },
{ VK_KEY_I, "VK_KEY_I" },
{ VK_KEY_J, "VK_KEY_J" },
{ VK_KEY_K, "VK_KEY_K" },
{ VK_KEY_L, "VK_KEY_L" },
{ VK_KEY_M, "VK_KEY_M" },
{ VK_KEY_N, "VK_KEY_N" },
{ VK_KEY_O, "VK_KEY_O" },
{ VK_KEY_P, "VK_KEY_P" },
{ VK_KEY_Q, "VK_KEY_Q" },
{ VK_KEY_R, "VK_KEY_R" },
{ VK_KEY_S, "VK_KEY_S" },
{ VK_KEY_T, "VK_KEY_T" },
{ VK_KEY_U, "VK_KEY_U" },
{ VK_KEY_V, "VK_KEY_V" },
{ VK_KEY_W, "VK_KEY_W" },
{ VK_KEY_X, "VK_KEY_X" },
{ VK_KEY_Y, "VK_KEY_Y" },
{ VK_KEY_Z, "VK_KEY_Z" },
{ VK_LWIN, "VK_LWIN" },
{ VK_RWIN, "VK_RWIN" },
{ VK_APPS, "VK_APPS" },
{ 0, "" },
{ VK_SLEEP, "VK_SLEEP" },
{ VK_NUMPAD0, "VK_NUMPAD0" },
{ VK_NUMPAD1, "VK_NUMPAD1" },
{ VK_NUMPAD2, "VK_NUMPAD2" },
{ VK_NUMPAD3, "VK_NUMPAD3" },
{ VK_NUMPAD4, "VK_NUMPAD4" },
{ VK_NUMPAD5, "VK_NUMPAD5" },
{ VK_NUMPAD6, "VK_NUMPAD6" },
{ VK_NUMPAD7, "VK_NUMPAD7" },
{ VK_NUMPAD8, "VK_NUMPAD8" },
{ VK_NUMPAD9, "VK_NUMPAD9" },
{ VK_MULTIPLY, "VK_MULTIPLY" },
{ VK_ADD, "VK_ADD" },
{ VK_SEPARATOR, "VK_SEPARATOR" },
{ VK_SUBTRACT, "VK_SUBTRACT" },
{ VK_DECIMAL, "VK_DECIMAL" },
{ VK_DIVIDE, "VK_DIVIDE" },
{ VK_F1, "VK_F1" },
{ VK_F2, "VK_F2" },
{ VK_F3, "VK_F3" },
{ VK_F4, "VK_F4" },
{ VK_F5, "VK_F5" },
{ VK_F6, "VK_F6" },
{ VK_F7, "VK_F7" },
{ VK_F8, "VK_F8" },
{ VK_F9, "VK_F9" },
{ VK_F10, "VK_F10" },
{ VK_F11, "VK_F11" },
{ VK_F12, "VK_F12" },
{ VK_F13, "VK_F13" },
{ VK_F14, "VK_F14" },
{ VK_F15, "VK_F15" },
{ VK_F16, "VK_F16" },
{ VK_F17, "VK_F17" },
{ VK_F18, "VK_F18" },
{ VK_F19, "VK_F19" },
{ VK_F20, "VK_F20" },
{ VK_F21, "VK_F21" },
{ VK_F22, "VK_F22" },
{ VK_F23, "VK_F23" },
{ VK_F24, "VK_F24" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ VK_NUMLOCK, "VK_NUMLOCK" },
{ VK_SCROLL, "VK_SCROLL" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ VK_LSHIFT, "VK_LSHIFT" },
{ VK_RSHIFT, "VK_RSHIFT" },
{ VK_LCONTROL, "VK_LCONTROL" },
{ VK_RCONTROL, "VK_RCONTROL" },
{ VK_LMENU, "VK_LMENU" },
{ VK_RMENU, "VK_RMENU" },
{ VK_BROWSER_BACK, "VK_BROWSER_BACK" },
{ VK_BROWSER_FORWARD, "VK_BROWSER_FORWARD" },
{ VK_BROWSER_REFRESH, "VK_BROWSER_REFRESH" },
{ VK_BROWSER_STOP, "VK_BROWSER_STOP" },
{ VK_BROWSER_SEARCH, "VK_BROWSER_SEARCH" },
{ VK_BROWSER_FAVORITES, "VK_BROWSER_FAVORITES" },
{ VK_BROWSER_HOME, "VK_BROWSER_HOME" },
{ VK_VOLUME_MUTE, "VK_VOLUME_MUTE" },
{ VK_VOLUME_DOWN, "VK_VOLUME_DOWN" },
{ VK_VOLUME_UP, "VK_VOLUME_UP" },
{ VK_MEDIA_NEXT_TRACK, "VK_MEDIA_NEXT_TRACK" },
{ VK_MEDIA_PREV_TRACK, "VK_MEDIA_PREV_TRACK" },
{ VK_MEDIA_STOP, "VK_MEDIA_STOP" },
{ VK_MEDIA_PLAY_PAUSE, "VK_MEDIA_PLAY_PAUSE" },
{ VK_LAUNCH_MAIL, "VK_LAUNCH_MAIL" },
{ VK_MEDIA_SELECT, "VK_MEDIA_SELECT" },
{ VK_LAUNCH_APP1, "VK_LAUNCH_APP1" },
{ VK_LAUNCH_APP2, "VK_LAUNCH_APP2" },
{ 0, "" },
{ 0, "" },
{ VK_OEM_1, "VK_OEM_1" },
{ VK_OEM_PLUS, "VK_OEM_PLUS" },
{ VK_OEM_COMMA, "VK_OEM_COMMA" },
{ VK_OEM_MINUS, "VK_OEM_MINUS" },
{ VK_OEM_PERIOD, "VK_OEM_PERIOD" },
{ VK_OEM_2, "VK_OEM_2" },
{ VK_OEM_3, "VK_OEM_3" },
{ VK_ABNT_C1, "VK_ABNT_C1" },
{ VK_ABNT_C2, "VK_ABNT_C2" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ VK_OEM_4, "VK_OEM_4" },
{ VK_OEM_5, "VK_OEM_5" },
{ VK_OEM_6, "VK_OEM_6" },
{ VK_OEM_7, "VK_OEM_7" },
{ VK_OEM_8, "VK_OEM_8" },
{ 0, "" },
{ 0, "" },
{ VK_OEM_102, "VK_OEM_102" },
{ 0, "" },
{ 0, "" },
{ VK_PROCESSKEY, "VK_PROCESSKEY" },
{ 0, "" },
{ VK_PACKET, "VK_PACKET" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ VK_ATTN, "VK_ATTN" },
{ VK_CRSEL, "VK_CRSEL" },
{ VK_EXSEL, "VK_EXSEL" },
{ VK_EREOF, "VK_EREOF" },
{ VK_PLAY, "VK_PLAY" },
{ VK_ZOOM, "VK_ZOOM" },
{ VK_NONAME, "VK_NONAME" },
{ VK_PA1, "VK_PA1" },
{ VK_OEM_CLEAR, "VK_OEM_CLEAR" },
{ 0, "" }
};
const char* freerdp_keyboard_get_virtual_key_code_name(uint32 vkcode)
{
return VIRTUAL_KEY_CODE_TABLE[vkcode].name;
}
uint32 freerdp_keyboard_get_virtual_key_code_from_name(const char* vkcode_name)
{
int i = 0;
for (i = 0; i < ARRAY_SIZE(VIRTUAL_KEY_CODE_TABLE); i++)
{
if (VIRTUAL_KEY_CODE_TABLE[i].name)
{
if (strcmp(vkcode_name, VIRTUAL_KEY_CODE_TABLE[i].name) == 0)
{
return VIRTUAL_KEY_CODE_TABLE[i].code;
}
}
}
return 0;
}

View File

@ -0,0 +1,918 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* RDP Keyboard layout ID detection from common X11 xkb keyboard layout names
*
* Copyright 2009-2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "xkb_layout_ids.h"
#include <freerdp/utils/memory.h>
#include <freerdp/locale/keyboard.h>
#include "liblocale.h"
struct _XKB_VARIANT
{
const char* variant; /* XKB Keyboard layout variant */
uint32 keyboardLayoutID; /* Keyboard Layout ID */
};
typedef struct _XKB_VARIANT XKB_VARIANT;
struct _XKB_LAYOUT
{
const char* layout; /* XKB Keyboard layout */
uint32 keyboardLayoutID; /* Keyboard Layout ID */
const XKB_VARIANT* variants;
};
typedef struct _XKB_LAYOUT XKB_LAYOUT;
/* Those have been generated automatically and are waiting to be filled by hand */
/* USA */
static const XKB_VARIANT us_variants[] =
{
{ "chr", 0 }, /* Cherokee */
{ "euro", 0 }, /* With EuroSign on 5 */
{ "intl", KBD_UNITED_STATES_INTERNATIONAL }, /* International (with dead keys) */
{ "alt-intl", KBD_UNITED_STATES_INTERNATIONAL }, /* Alternative international (former us_intl) */
{ "colemak", 0 }, /* Colemak */
{ "dvorak", KBD_UNITED_STATES_DVORAK }, /* Dvorak */
{ "dvorak-intl", KBD_UNITED_STATES_DVORAK }, /* Dvorak international */
{ "dvorak-l", KBD_UNITED_STATES_DVORAK_FOR_LEFT_HAND }, /* Left handed Dvorak */
{ "dvorak-r", KBD_UNITED_STATES_DVORAK_FOR_RIGHT_HAND }, /* Right handed Dvorak */
{ "dvorak-classic", KBD_UNITED_STATES_DVORAK }, /* Classic Dvorak */
{ "dvp", KBD_UNITED_STATES_DVORAK }, /* Programmer Dvorak */
{ "rus", 0 }, /* Russian phonetic */
{ "mac", KBD_US }, /* Macintosh */
{ "altgr-intl", KBD_UNITED_STATES_INTERNATIONAL }, /* International (AltGr dead keys) */
{ "olpc2", KBD_US }, /* Group toggle on multiply/divide key */
{ "", 0 },
};
/* Afghanistan */
static const XKB_VARIANT af_variants[] =
{
{ "ps", KBD_PASHTO }, /* Pashto */
{ "uz", KBD_UZBEK_CYRILLIC }, /* Southern Uzbek */
{ "olpc-ps", KBD_PASHTO }, /* OLPC Pashto */
{ "olpc-fa", 0 }, /* OLPC Dari */
{ "olpc-uz", KBD_UZBEK_CYRILLIC }, /* OLPC Southern Uzbek */
{ "", 0 },
};
/* Arabic */
static const XKB_VARIANT ara_variants[] =
{
{ "azerty", KBD_ARABIC_102_AZERTY }, /* azerty */
{ "azerty_digits", KBD_ARABIC_102_AZERTY }, /* azerty/digits */
{ "digits", KBD_ARABIC_102_AZERTY }, /* digits */
{ "qwerty", KBD_ARABIC_101 }, /* qwerty */
{ "qwerty_digits", KBD_ARABIC_101 }, /* qwerty/digits */
{ "buckwalter", KBD_US_ENGLISH_TABLE_FOR_IBM_ARABIC_238_L }, /* Buckwalter */
{ "", 0 },
};
/* Armenia */
static const XKB_VARIANT am_variants[] =
{
{ "phonetic", 0 }, /* Phonetic */
{ "phonetic-alt", 0 }, /* Alternative Phonetic */
{ "eastern", KBD_ARMENIAN_EASTERN }, /* Eastern */
{ "western", KBD_ARMENIAN_WESTERN }, /* Western */
{ "eastern-alt", KBD_ARMENIAN_EASTERN }, /* Alternative Eastern */
{ "", 0 },
};
/* Azerbaijan */
static const XKB_VARIANT az_variants[] =
{
{ "cyrillic", KBD_AZERI_CYRILLIC }, /* Cyrillic */
{ "", 0 },
};
/* Belarus */
static const XKB_VARIANT by_variants[] =
{
{ "winkeys", KBD_BELARUSIAN }, /* Winkeys */
{ "latin", KBD_BELARUSIAN }, /* Latin */
{ "", 0 },
};
/* Belgium */
static const XKB_VARIANT be_variants[] =
{
{ "oss", KBD_BELGIAN_FRENCH }, /* Alternative */
{ "oss_latin9", KBD_BELGIAN_FRENCH }, /* Alternative, latin-9 only */
{ "oss_sundeadkeys", KBD_BELGIAN_PERIOD }, /* Alternative, Sun dead keys */
{ "iso-alternate", KBD_BELGIAN_COMMA }, /* ISO Alternate */
{ "nodeadkeys", KBD_BELGIAN_COMMA }, /* Eliminate dead keys */
{ "sundeadkeys", KBD_BELGIAN_PERIOD }, /* Sun dead keys */
{ "wang", KBD_BELGIAN_FRENCH }, /* Wang model 724 azerty */
{ "", 0 },
};
/* Bangladesh */
static const XKB_VARIANT bd_variants[] =
{
{ "probhat", KBD_BENGALI_INSCRIPT }, /* Probhat */
{ "", 0 },
};
/* India */
static const XKB_VARIANT in_variants[] =
{
{ "ben", KBD_BENGALI }, /* Bengali */
{ "ben_probhat", KBD_BENGALI_INSCRIPT }, /* Bengali Probhat */
{ "guj", KBD_GUJARATI }, /* Gujarati */
{ "guru", 0 }, /* Gurmukhi */
{ "jhelum", 0 }, /* Gurmukhi Jhelum */
{ "kan", KBD_KANNADA }, /* Kannada */
{ "mal", KBD_MALAYALAM }, /* Malayalam */
{ "mal_lalitha", KBD_MALAYALAM }, /* Malayalam Lalitha */
{ "ori", 0 }, /* Oriya */
{ "tam_unicode", KBD_TAMIL }, /* Tamil Unicode */
{ "tam_TAB", KBD_TAMIL }, /* Tamil TAB Typewriter */
{ "tam_TSCII", KBD_TAMIL }, /* Tamil TSCII Typewriter */
{ "tam", KBD_TAMIL }, /* Tamil */
{ "tel", KBD_TELUGU }, /* Telugu */
{ "urd-phonetic", KBD_URDU }, /* Urdu, Phonetic */
{ "urd-phonetic3", KBD_URDU }, /* Urdu, Alternative phonetic */
{ "urd-winkeys", KBD_URDU }, /* Urdu, Winkeys */
{ "bolnagri", KBD_HINDI_TRADITIONAL }, /* Hindi Bolnagri */
{ "hin-wx", KBD_HINDI_TRADITIONAL }, /* Hindi Wx */
{ "", 0 },
};
/* Bosnia and Herzegovina */
static const XKB_VARIANT ba_variants[] =
{
{ "alternatequotes", KBD_BOSNIAN }, /* Use guillemets for quotes */
{ "unicode", KBD_BOSNIAN }, /* Use Bosnian digraphs */
{ "unicodeus", KBD_BOSNIAN }, /* US keyboard with Bosnian digraphs */
{ "us", KBD_BOSNIAN_CYRILLIC }, /* US keyboard with Bosnian letters */
{ "", 0 },
};
/* Brazil */
static const XKB_VARIANT br_variants[] =
{
{ "nodeadkeys", KBD_PORTUGUESE_BRAZILIAN_ABNT2 }, /* Eliminate dead keys */
{ "dvorak", KBD_UNITED_STATES_DVORAK }, /* Dvorak */
{ "nativo", KBD_PORTUGUESE_BRAZILIAN_ABNT2 }, /* Nativo */
{ "nativo-us", KBD_PORTUGUESE_BRAZILIAN_ABNT2 }, /* Nativo for USA keyboards */
{ "nativo-epo", KBD_PORTUGUESE_BRAZILIAN_ABNT2 }, /* Nativo for Esperanto */
{ "", 0 },
};
/* Bulgaria */
static const XKB_VARIANT bg_variants[] =
{
{ "phonetic", KBD_BULGARIAN_LATIN }, /* Traditional Phonetic */
{ "bas_phonetic", KBD_BULGARIAN_LATIN }, /* Standard Phonetic */
{ "", 0 },
};
/* Morocco */
static const XKB_VARIANT ma_variants[] =
{
{ "french", KBD_FRENCH }, /* French */
{ "tifinagh", 0 }, /* Tifinagh */
{ "tifinagh-alt", 0 }, /* Tifinagh Alternative */
{ "tifinagh-alt-phonetic", 0 }, /* Tifinagh Alternative Phonetic */
{ "tifinagh-extended", 0 }, /* Tifinagh Extended */
{ "tifinagh-phonetic", 0 }, /* Tifinagh Phonetic */
{ "tifinagh-extended-phonetic", 0 }, /* Tifinagh Extended Phonetic */
{ "", 0 },
};
/* Canada */
static const XKB_VARIANT ca_variants[] =
{
{ "fr-dvorak", KBD_UNITED_STATES_DVORAK }, /* French Dvorak */
{ "fr-legacy", KBD_CANADIAN_FRENCH }, /* French (legacy) */
{ "multix", KBD_CANADIAN_MULTILINGUAL_STANDARD }, /* Multilingual */
{ "multi", KBD_CANADIAN_MULTILINGUAL_STANDARD }, /* Multilingual, first part */
{ "multi-2gr", KBD_CANADIAN_MULTILINGUAL_STANDARD }, /* Multilingual, second part */
{ "ike", KBD_INUKTITUT_LATIN }, /* Inuktitut */
{ "shs", 0 }, /* Secwepemctsin */
{ "kut", 0 }, /* Ktunaxa */
{ "eng", KBD_US }, /* English */
{ "", 0 },
};
/* China */
static const XKB_VARIANT cn_variants[] =
{
{ "tib", 0 }, /* Tibetan */
{ "tib_asciinum", 0 }, /* Tibetan (with ASCII numerals) */
{ "", 0 },
};
/* Croatia */
static const XKB_VARIANT hr_variants[] =
{
{ "alternatequotes", KBD_CROATIAN }, /* Use guillemets for quotes */
{ "unicode", KBD_CROATIAN }, /* Use Croatian digraphs */
{ "unicodeus", KBD_CROATIAN }, /* US keyboard with Croatian digraphs */
{ "us", KBD_CROATIAN }, /* US keyboard with Croatian letters */
{ "", 0 },
};
/* Czechia */
static const XKB_VARIANT cz_variants[] =
{
{ "bksl", KBD_CZECH_PROGRAMMERS }, /* With &lt;\|&gt; key */
{ "qwerty", KBD_CZECH_QWERTY }, /* qwerty */
{ "qwerty_bksl", KBD_CZECH_QWERTY }, /* qwerty, extended Backslash */
{ "ucw", KBD_CZECH }, /* UCW layout (accented letters only) */
{ "", 0 },
};
/* Denmark */
static const XKB_VARIANT dk_variants[] =
{
{ "nodeadkeys", KBD_DANISH }, /* Eliminate dead keys */
{ "mac", KBD_DANISH }, /* Macintosh */
{ "mac_nodeadkeys", KBD_DANISH }, /* Macintosh, eliminate dead keys */
{ "dvorak", KBD_UNITED_STATES_DVORAK }, /* Dvorak */
{ "", 0 },
};
/* Netherlands */
static const XKB_VARIANT nl_variants[] =
{
{ "sundeadkeys", KBD_SWISS_FRENCH }, /* Sun dead keys */
{ "mac", KBD_SWISS_FRENCH }, /* Macintosh */
{ "std", KBD_SWISS_FRENCH }, /* Standard */
{ "", 0 },
};
/* Estonia */
static const XKB_VARIANT ee_variants[] =
{
{ "nodeadkeys", KBD_US }, /* Eliminate dead keys */
{ "dvorak", KBD_UNITED_STATES_DVORAK }, /* Dvorak */
{ "us", KBD_UNITED_STATES_INTERNATIONAL }, /* US keyboard with Estonian letters */
{ "", 0 },
};
/* Iran */
static const XKB_VARIANT ir_variants[] =
{
{ "pro", 0 }, /* Pro */
{ "keypad", 0 }, /* Keypad */
{ "pro_keypad", 0 }, /* Pro Keypad */
{ "ku", 0 }, /* Kurdish, Latin Q */
{ "ku_f", 0 }, /* Kurdish, (F) */
{ "ku_alt", 0 }, /* Kurdish, Latin Alt-Q */
{ "ku_ara", 0 }, /* Kurdish, Arabic-Latin */
{ "", 0 },
};
/* Iraq */
static const XKB_VARIANT iq_variants[] =
{
{ "ku", 0 }, /* Kurdish, Latin Q */
{ "ku_f", 0 }, /* Kurdish, (F) */
{ "ku_alt", 0 }, /* Kurdish, Latin Alt-Q */
{ "ku_ara", 0 }, /* Kurdish, Arabic-Latin */
{ "", 0 },
};
/* Faroe Islands */
static const XKB_VARIANT fo_variants[] =
{
{ "nodeadkeys", 0 }, /* Eliminate dead keys */
{ "", 0 },
};
/* Finland */
static const XKB_VARIANT fi_variants[] =
{
{ "nodeadkeys", 0 }, /* Eliminate dead keys */
{ "smi", 0 }, /* Northern Saami */
{ "classic", 0 }, /* Classic */
{ "mac", 0 }, /* Macintosh */
{ "", 0 },
};
/* France */
static const XKB_VARIANT fr_variants[] =
{
{ "nodeadkeys", 0 }, /* Eliminate dead keys */
{ "sundeadkeys", 0 }, /* Sun dead keys */
{ "oss", 0 }, /* Alternative */
{ "oss_latin9", 0 }, /* Alternative, latin-9 only */
{ "oss_nodeadkeys", 0 }, /* Alternative, eliminate dead keys */
{ "oss_sundeadkeys", 0 }, /* Alternative, Sun dead keys */
{ "latin9", 0 }, /* (Legacy) Alternative */
{ "latin9_nodeadkeys", 0 }, /* (Legacy) Alternative, eliminate dead keys */
{ "latin9_sundeadkeys", 0 }, /* (Legacy) Alternative, Sun dead keys */
{ "bepo", 0 }, /* Bepo, ergonomic, Dvorak way */
{ "bepo_latin9", 0 }, /* Bepo, ergonomic, Dvorak way, latin-9 only */
{ "dvorak", 0 }, /* Dvorak */
{ "mac", 0 }, /* Macintosh */
{ "bre", 0 }, /* Breton */
{ "oci", 0 }, /* Occitan */
{ "geo", 0 }, /* Georgian AZERTY Tskapo */
{ "", 0 },
};
/* Ghana */
static const XKB_VARIANT gh_variants[] =
{
{ "generic", 0 }, /* Multilingual */
{ "akan", 0 }, /* Akan */
{ "ewe", 0 }, /* Ewe */
{ "fula", 0 }, /* Fula */
{ "ga", 0 }, /* Ga */
{ "hausa", 0 }, /* Hausa */
{ "", 0 },
};
/* Georgia */
static const XKB_VARIANT ge_variants[] =
{
{ "ergonomic", 0 }, /* Ergonomic */
{ "mess", 0 }, /* MESS */
{ "ru", 0 }, /* Russian */
{ "os", 0 }, /* Ossetian */
{ "", 0 },
};
/* Germany */
static const XKB_VARIANT de_variants[] =
{
{ "deadacute", KBD_GERMAN }, /* Dead acute */
{ "deadgraveacute", KBD_GERMAN }, /* Dead grave acute */
{ "nodeadkeys", KBD_GERMAN }, /* Eliminate dead keys */
{ "ro", KBD_GERMAN }, /* Romanian keyboard with German letters */
{ "ro_nodeadkeys", KBD_GERMAN }, /* Romanian keyboard with German letters, eliminate dead keys */
{ "dvorak", KBD_UNITED_STATES_DVORAK }, /* Dvorak */
{ "sundeadkeys", KBD_GERMAN }, /* Sun dead keys */
{ "neo", KBD_GERMAN_NEO }, /* Neo 2 */
{ "mac", KBD_GERMAN }, /* Macintosh */
{ "mac_nodeadkeys", KBD_GERMAN }, /* Macintosh, eliminate dead keys */
{ "dsb", KBD_GERMAN }, /* Lower Sorbian */
{ "dsb_qwertz", KBD_GERMAN }, /* Lower Sorbian (qwertz) */
{ "qwerty", KBD_GERMAN_IBM }, /* qwerty */
{ "", 0 },
};
/* Greece */
static const XKB_VARIANT gr_variants[] =
{
{ "simple", KBD_GREEK_220 }, /* Simple */
{ "extended", KBD_GREEK_319 }, /* Extended */
{ "nodeadkeys", KBD_GREEK_319}, /* Eliminate dead keys */
{ "polytonic", KBD_GREEK_POLYTONIC }, /* Polytonic */
{ "", 0 },
};
/* Hungary */
static const XKB_VARIANT hu_variants[] =
{
{ "standard", KBD_HUNGARIAN_101_KEY }, /* Standard */
{ "nodeadkeys", KBD_HUNGARIAN_101_KEY }, /* Eliminate dead keys */
{ "qwerty", KBD_HUNGARIAN_101_KEY }, /* qwerty */
{ "101_qwertz_comma_dead", KBD_HUNGARIAN_101_KEY }, /* 101/qwertz/comma/Dead keys */
{ "101_qwertz_comma_nodead", KBD_HUNGARIAN_101_KEY }, /* 101/qwertz/comma/Eliminate dead keys */
{ "101_qwertz_dot_dead", KBD_HUNGARIAN_101_KEY }, /* 101/qwertz/dot/Dead keys */
{ "101_qwertz_dot_nodead", KBD_HUNGARIAN_101_KEY }, /* 101/qwertz/dot/Eliminate dead keys */
{ "101_qwerty_comma_dead", KBD_HUNGARIAN_101_KEY }, /* 101/qwerty/comma/Dead keys */
{ "101_qwerty_comma_nodead", KBD_HUNGARIAN_101_KEY }, /* 101/qwerty/comma/Eliminate dead keys */
{ "101_qwerty_dot_dead", KBD_HUNGARIAN_101_KEY }, /* 101/qwerty/dot/Dead keys */
{ "101_qwerty_dot_nodead", KBD_HUNGARIAN_101_KEY }, /* 101/qwerty/dot/Eliminate dead keys */
{ "102_qwertz_comma_dead", KBD_HUNGARIAN_101_KEY }, /* 102/qwertz/comma/Dead keys */
{ "102_qwertz_comma_nodead", KBD_HUNGARIAN_101_KEY }, /* 102/qwertz/comma/Eliminate dead keys */
{ "102_qwertz_dot_dead", KBD_HUNGARIAN_101_KEY }, /* 102/qwertz/dot/Dead keys */
{ "102_qwertz_dot_nodead", KBD_HUNGARIAN_101_KEY }, /* 102/qwertz/dot/Eliminate dead keys */
{ "102_qwerty_comma_dead", KBD_HUNGARIAN_101_KEY }, /* 102/qwerty/comma/Dead keys */
{ "102_qwerty_comma_nodead", KBD_HUNGARIAN_101_KEY }, /* 102/qwerty/comma/Eliminate dead keys */
{ "102_qwerty_dot_dead", KBD_HUNGARIAN_101_KEY }, /* 102/qwerty/dot/Dead keys */
{ "102_qwerty_dot_nodead", KBD_HUNGARIAN_101_KEY }, /* 102/qwerty/dot/Eliminate dead keys */
{ "", 0 },
};
/* Iceland */
static const XKB_VARIANT is_variants[] =
{
{ "Sundeadkeys", KBD_ICELANDIC }, /* Sun dead keys */
{ "nodeadkeys", KBD_ICELANDIC }, /* Eliminate dead keys */
{ "mac", KBD_ICELANDIC }, /* Macintosh */
{ "dvorak", KBD_UNITED_STATES_DVORAK }, /* Dvorak */
{ "", 0 },
};
/* Israel */
static const XKB_VARIANT il_variants[] =
{
{ "lyx", KBD_HEBREW }, /* lyx */
{ "phonetic", KBD_HEBREW }, /* Phonetic */
{ "biblical", KBD_HEBREW }, /* Biblical Hebrew (Tiro) */
{ "", 0 },
};
/* Italy */
static const XKB_VARIANT it_variants[] =
{
{ "nodeadkeys", KBD_ITALIAN_142 }, /* Eliminate dead keys */
{ "mac", KBD_ITALIAN }, /* Macintosh */
{ "geo", KBD_GEORGIAN }, /* Georgian */
{ "", 0 },
};
/* Japan */
static const XKB_VARIANT jp_variants[] =
{
{ "kana", KBD_JAPANESE_INPUT_SYSTEM_MS_IME2002 }, /* Kana */
{ "OADG109A", KBD_JAPANESE_INPUT_SYSTEM_MS_IME2002 }, /* OADG 109A */
{ "", 0 },
};
/* Kyrgyzstan */
static const XKB_VARIANT kg_variants[] =
{
{ "phonetic", KBD_KYRGYZ_CYRILLIC }, /* Phonetic */
{ "", 0 },
};
/* Kazakhstan */
static const XKB_VARIANT kz_variants[] =
{
{ "ruskaz", KBD_KAZAKH }, /* Russian with Kazakh */
{ "kazrus", KBD_KAZAKH }, /* Kazakh with Russian */
{ "", 0 },
};
/* Latin America */
static const XKB_VARIANT latam_variants[] =
{
{ "nodeadkeys", KBD_LATIN_AMERICAN }, /* Eliminate dead keys */
{ "deadtilde", KBD_LATIN_AMERICAN }, /* Include dead tilde */
{ "sundeadkeys", KBD_LATIN_AMERICAN }, /* Sun dead keys */
{ "", 0 },
};
/* Lithuania */
static const XKB_VARIANT lt_variants[] =
{
{ "std", KBD_LITHUANIAN }, /* Standard */
{ "us", KBD_LITHUANIAN_IBM }, /* US keyboard with Lithuanian letters */
{ "ibm", KBD_LITHUANIAN_IBM }, /* IBM (LST 1205-92) */
{ "lekp", KBD_LITHUANIAN }, /* LEKP */
{ "lekpa", KBD_LITHUANIAN }, /* LEKPa */
{ "balticplus", KBD_LITHUANIAN }, /* Baltic+ */
{ "", 0 },
};
/* Latvia */
static const XKB_VARIANT lv_variants[] =
{
{ "apostrophe", KBD_LATVIAN }, /* Apostrophe (') variant */
{ "tilde", KBD_LATVIAN }, /* Tilde (~) variant */
{ "fkey", KBD_LATVIAN }, /* F-letter (F) variant */
{ "", 0 },
};
/* Montenegro */
static const XKB_VARIANT me_variants[] =
{
{ "cyrillic", 0 }, /* Cyrillic */
{ "cyrillicyz", 0 }, /* Cyrillic, Z and ZHE swapped */
{ "latinunicode", 0 }, /* Latin unicode */
{ "latinyz", 0 }, /* Latin qwerty */
{ "latinunicodeyz", 0 }, /* Latin unicode qwerty */
{ "cyrillicalternatequotes", 0 }, /* Cyrillic with guillemets */
{ "latinalternatequotes", 0 }, /* Latin with guillemets */
{ "", 0 },
};
/* Macedonia */
static const XKB_VARIANT mk_variants[] =
{
{ "nodeadkeys", KBD_FYRO_MACEDONIAN }, /* Eliminate dead keys */
{ "", 0 },
};
/* Malta */
static const XKB_VARIANT mt_variants[] =
{
{ "us", KBD_MALTESE_48_KEY }, /* Maltese keyboard with US layout */
{ "", 0 },
};
/* Norway */
static const XKB_VARIANT no_variants[] =
{
{ "nodeadkeys", KBD_NORWEGIAN }, /* Eliminate dead keys */
{ "dvorak", KBD_UNITED_STATES_DVORAK }, /* Dvorak */
{ "smi", KBD_NORWEGIAN_WITH_SAMI }, /* Northern Saami */
{ "smi_nodeadkeys", KBD_SAMI_EXTENDED_NORWAY }, /* Northern Saami, eliminate dead keys */
{ "mac", KBD_NORWEGIAN }, /* Macintosh */
{ "mac_nodeadkeys", KBD_SAMI_EXTENDED_NORWAY }, /* Macintosh, eliminate dead keys */
{ "", 0 },
};
/* Poland */
static const XKB_VARIANT pl_variants[] =
{
{ "qwertz", KBD_POLISH_214 }, /* qwertz */
{ "dvorak", KBD_UNITED_STATES_DVORAK }, /* Dvorak */
{ "dvorak_quotes", KBD_UNITED_STATES_DVORAK }, /* Dvorak, Polish quotes on quotemark key */
{ "dvorak_altquotes", KBD_UNITED_STATES_DVORAK }, /* Dvorak, Polish quotes on key 1 */
{ "csb", 0 }, /* Kashubian */
{ "ru_phonetic_dvorak", KBD_UNITED_STATES_DVORAK }, /* Russian phonetic Dvorak */
{ "", 0 },
};
/* Portugal */
static const XKB_VARIANT pt_variants[] =
{
{ "nodeadkeys", KBD_PORTUGUESE }, /* Eliminate dead keys */
{ "sundeadkeys", KBD_PORTUGUESE }, /* Sun dead keys */
{ "mac", KBD_PORTUGUESE }, /* Macintosh */
{ "mac_nodeadkeys", KBD_PORTUGUESE }, /* Macintosh, eliminate dead keys */
{ "mac_sundeadkeys", KBD_PORTUGUESE }, /* Macintosh, Sun dead keys */
{ "nativo", KBD_PORTUGUESE }, /* Nativo */
{ "nativo-us", KBD_PORTUGUESE }, /* Nativo for USA keyboards */
{ "nativo-epo", KBD_PORTUGUESE }, /* Nativo for Esperanto */
{ "", 0 },
};
/* Romania */
static const XKB_VARIANT ro_variants[] =
{
{ "cedilla", KBD_ROMANIAN }, /* Cedilla */
{ "std", KBD_ROMANIAN }, /* Standard */
{ "std_cedilla", KBD_ROMANIAN }, /* Standard (Cedilla) */
{ "winkeys", KBD_ROMANIAN }, /* Winkeys */
{ "crh_f", KBD_TURKISH_F }, /* Crimean Tatar (Turkish F) */
{ "crh_alt", KBD_TURKISH_Q }, /* Crimean Tatar (Turkish Alt-Q) */
{ "crh_dobruca1", KBD_TATAR }, /* Crimean Tatar (Dobruca-1 Q) */
{ "crh_dobruca2", KBD_TATAR }, /* Crimean Tatar (Dobruca-2 Q) */
{ "", 0 },
};
/* Russia */
static const XKB_VARIANT ru_variants[] =
{
{ "phonetic", KBD_RUSSIAN }, /* Phonetic */
{ "phonetic_winkeys", KBD_RUSSIAN }, /* Phonetic Winkeys */
{ "typewriter", KBD_RUSSIAN_TYPEWRITER }, /* Typewriter */
{ "legacy", KBD_RUSSIAN }, /* Legacy */
{ "tt", KBD_TATAR }, /* Tatar */
{ "os_legacy", 0 }, /* Ossetian, legacy */
{ "os_winkeys", 0 }, /* Ossetian, Winkeys */
{ "cv", 0 }, /* Chuvash */
{ "cv_latin", 0 }, /* Chuvash Latin */
{ "udm", 0 }, /* Udmurt */
{ "kom", 0 }, /* Komi */
{ "sah", 0 }, /* Yakut */
{ "xal", 0 }, /* Kalmyk */
{ "dos", 0 }, /* DOS */
{ "", 0 },
};
/* Serbia */
static const XKB_VARIANT rs_variants[] =
{
{ "yz", KBD_SERBIAN_CYRILLIC }, /* Z and ZHE swapped */
{ "latin", KBD_SERBIAN_LATIN }, /* Latin */
{ "latinunicode", KBD_SERBIAN_LATIN }, /* Latin Unicode */
{ "latinyz", KBD_SERBIAN_LATIN }, /* Latin qwerty */
{ "latinunicodeyz", KBD_SERBIAN_LATIN }, /* Latin Unicode qwerty */
{ "alternatequotes", KBD_SERBIAN_CYRILLIC }, /* With guillemets */
{ "latinalternatequotes", KBD_SERBIAN_LATIN }, /* Latin with guillemets */
{ "", 0 },
};
/* Slovenia */
static const XKB_VARIANT si_variants[] =
{
{ "alternatequotes", KBD_SLOVENIAN }, /* Use guillemets for quotes */
{ "us", KBD_UNITED_STATES_INTERNATIONAL }, /* US keyboard with Slovenian letters */
{ "", 0 },
};
/* Slovakia */
static const XKB_VARIANT sk_variants[] =
{
{ "bksl", KBD_SLOVAK }, /* Extended Backslash */
{ "qwerty", KBD_SLOVAK_QWERTY }, /* qwerty */
{ "qwerty_bksl", KBD_SLOVAK_QWERTY }, /* qwerty, extended Backslash */
{ "", 0 },
};
/* Spain */
static const XKB_VARIANT es_variants[] =
{
{ "nodeadkeys", KBD_SPANISH_VARIATION }, /* Eliminate dead keys */
{ "deadtilde", KBD_SPANISH_VARIATION }, /* Include dead tilde */
{ "sundeadkeys", KBD_SPANISH }, /* Sun dead keys */
{ "dvorak", KBD_UNITED_STATES_DVORAK }, /* Dvorak */
{ "ast", KBD_SPANISH_VARIATION }, /* Asturian variant with bottom-dot H and bottom-dot L */
{ "cat", KBD_SPANISH_VARIATION }, /* Catalan variant with middle-dot L */
{ "mac", KBD_SPANISH }, /* Macintosh */
{ "", 0 },
};
/* Sweden */
static const XKB_VARIANT se_variants[] =
{
{ "nodeadkeys", KBD_SWEDISH }, /* Eliminate dead keys */
{ "dvorak", KBD_UNITED_STATES_DVORAK }, /* Dvorak */
{ "rus", KBD_RUSSIAN }, /* Russian phonetic */
{ "rus_nodeadkeys", KBD_RUSSIAN }, /* Russian phonetic, eliminate dead keys */
{ "smi", KBD_SWEDISH_WITH_SAMI }, /* Northern Saami */
{ "mac", KBD_SWEDISH }, /* Macintosh */
{ "svdvorak", KBD_UNITED_STATES_DVORAK }, /* Svdvorak */
{ "", 0 },
};
/* Switzerland */
static const XKB_VARIANT ch_variants[] =
{
{ "de_nodeadkeys", KBD_SWISS_GERMAN }, /* German, eliminate dead keys */
{ "de_sundeadkeys", KBD_SWISS_GERMAN }, /* German, Sun dead keys */
{ "fr", KBD_SWISS_FRENCH }, /* French */
{ "fr_nodeadkeys", KBD_SWISS_FRENCH }, /* French, eliminate dead keys */
{ "fr_sundeadkeys", KBD_SWISS_FRENCH }, /* French, Sun dead keys */
{ "fr_mac", KBD_SWISS_FRENCH }, /* French (Macintosh) */
{ "de_mac", KBD_SWISS_GERMAN }, /* German (Macintosh) */
{ "", 0 },
};
/* Syria */
static const XKB_VARIANT sy_variants[] =
{
{ "syc", KBD_SYRIAC }, /* Syriac */
{ "syc_phonetic", KBD_SYRIAC_PHONETIC }, /* Syriac phonetic */
{ "ku", 0 }, /* Kurdish, Latin Q */
{ "ku_f", 0 }, /* Kurdish, (F) */
{ "ku_alt", 0 }, /* Kurdish, Latin Alt-Q */
{ "", 0 },
};
/* Tajikistan */
static const XKB_VARIANT tj_variants[] =
{
{ "legacy", 0 }, /* Legacy */
{ "", 0 },
};
/* Sri Lanka */
static const XKB_VARIANT lk_variants[] =
{
{ "tam_unicode", KBD_TAMIL }, /* Tamil Unicode */
{ "tam_TAB", KBD_TAMIL }, /* Tamil TAB Typewriter */
{ "", 0 },
};
/* Thailand */
static const XKB_VARIANT th_variants[] =
{
{ "tis", KBD_THAI_KEDMANEE_NON_SHIFTLOCK }, /* TIS-820.2538 */
{ "pat", KBD_THAI_PATTACHOTE }, /* Pattachote */
{ "", 0 },
};
/* Turkey */
static const XKB_VARIANT tr_variants[] =
{
{ "f", KBD_TURKISH_F }, /* (F) */
{ "alt", KBD_TURKISH_Q }, /* Alt-Q */
{ "sundeadkeys", KBD_TURKISH_F }, /* Sun dead keys */
{ "ku", 0 }, /* Kurdish, Latin Q */
{ "ku_f", 0 }, /* Kurdish, (F) */
{ "ku_alt", 0 }, /* Kurdish, Latin Alt-Q */
{ "intl", KBD_TURKISH_F }, /* International (with dead keys) */
{ "crh", KBD_TATAR }, /* Crimean Tatar (Turkish Q) */
{ "crh_f", KBD_TURKISH_F }, /* Crimean Tatar (Turkish F) */
{ "crh_alt", KBD_TURKISH_Q }, /* Crimean Tatar (Turkish Alt-Q) */
{ "", 0 },
};
/* Ukraine */
static const XKB_VARIANT ua_variants[] =
{
{ "phonetic", KBD_UKRAINIAN }, /* Phonetic */
{ "typewriter", KBD_UKRAINIAN }, /* Typewriter */
{ "winkeys", KBD_UKRAINIAN }, /* Winkeys */
{ "legacy", KBD_UKRAINIAN }, /* Legacy */
{ "rstu", KBD_UKRAINIAN }, /* Standard RSTU */
{ "rstu_ru", KBD_UKRAINIAN }, /* Standard RSTU on Russian layout */
{ "homophonic", KBD_UKRAINIAN }, /* Homophonic */
{ "crh", KBD_TATAR }, /* Crimean Tatar (Turkish Q) */
{ "crh_f", KBD_TURKISH_F }, /* Crimean Tatar (Turkish F) */
{ "crh_alt", KBD_TURKISH_Q }, /* Crimean Tatar (Turkish Alt-Q) */
{ "", 0 },
};
/* United Kingdom */
static const XKB_VARIANT gb_variants[] =
{
{ "extd", KBD_UNITED_KINGDOM_EXTENDED }, /* Extended - Winkeys */
{ "intl", KBD_UNITED_KINGDOM_EXTENDED }, /* International (with dead keys) */
{ "dvorak", KBD_UNITED_STATES_DVORAK }, /* Dvorak */
{ "dvorakukp", KBD_UNITED_STATES_DVORAK }, /* Dvorak (UK Punctuation) */
{ "mac", KBD_UNITED_KINGDOM }, /* Macintosh */
{ "colemak", 0 }, /* Colemak */
{ "", 0 },
};
/* Uzbekistan */
static const XKB_VARIANT uz_variants[] =
{
{ "latin", 0 }, /* Latin */
{ "crh", KBD_TATAR }, /* Crimean Tatar (Turkish Q) */
{ "crh_f", KBD_TURKISH_F }, /* Crimean Tatar (Turkish F) */
{ "crh_alt", KBD_TURKISH_Q }, /* Crimean Tatar (Turkish Alt-Q) */
{ "", 0 },
};
/* Korea, Republic of */
static const XKB_VARIANT kr_variants[] =
{
{ "kr104", KBD_KOREAN_INPUT_SYSTEM_IME_2000 }, /* 101/104 key Compatible */
{ "", 0 },
};
/* Ireland */
static const XKB_VARIANT ie_variants[] =
{
{ "CloGaelach", KBD_GAELIC }, /* CloGaelach */
{ "UnicodeExpert", KBD_GAELIC }, /* UnicodeExpert */
{ "ogam", KBD_GAELIC }, /* Ogham */
{ "ogam_is434", KBD_GAELIC }, /* Ogham IS434 */
{ "", 0 },
};
/* Pakistan */
static const XKB_VARIANT pk_variants[] =
{
{ "urd-crulp", 0 }, /* CRULP */
{ "urd-nla", 0 }, /* NLA */
{ "ara", KBD_ARABIC_101 }, /* Arabic */
{ "", 0 },
};
/* Esperanto */
static const XKB_VARIANT epo_variants[] =
{
{ "legacy", 0 }, /* displaced semicolon and quote (obsolete) */
{ "", 0 },
};
/* Nigeria */
static const XKB_VARIANT ng_variants[] =
{
{ "igbo", 0 }, /* Igbo */
{ "yoruba", 0 }, /* Yoruba */
{ "hausa", 0 }, /* Hausa */
{ "", 0 },
};
/* Braille */
static const XKB_VARIANT brai_variants[] =
{
{ "left_hand", 0 }, /* Left hand */
{ "right_hand", 0 }, /* Right hand */
{ "", 0 },
};
/* Turkmenistan */
static const XKB_VARIANT tm_variants[] =
{
{ "alt", KBD_TURKISH_Q }, /* Alt-Q */
{ "", 0 },
};
static const XKB_LAYOUT xkbLayouts[] =
{
{ "us", KBD_US, us_variants }, /* USA */
{ "ad", 0, NULL }, /* Andorra */
{ "af", KBD_FARSI, af_variants }, /* Afghanistan */
{ "ara", KBD_ARABIC_101, ara_variants }, /* Arabic */
{ "al", 0, NULL }, /* Albania */
{ "am", KBD_ARMENIAN_EASTERN, am_variants }, /* Armenia */
{ "az", KBD_AZERI_CYRILLIC, az_variants }, /* Azerbaijan */
{ "by", KBD_BELARUSIAN, by_variants }, /* Belarus */
{ "be", KBD_BELGIAN_FRENCH, be_variants }, /* Belgium */
{ "bd", KBD_BENGALI, bd_variants }, /* Bangladesh */
{ "in", KBD_HINDI_TRADITIONAL, in_variants }, /* India */
{ "ba", KBD_CROATIAN, ba_variants }, /* Bosnia and Herzegovina */
{ "br", KBD_PORTUGUESE_BRAZILIAN_ABNT, br_variants }, /* Brazil */
{ "bg", KBD_BULGARIAN_LATIN, bg_variants }, /* Bulgaria */
{ "ma", KBD_FRENCH, ma_variants }, /* Morocco */
{ "mm", 0, NULL }, /* Myanmar */
{ "ca", KBD_US, ca_variants }, /* Canada */
{ "cd", 0, NULL }, /* Congo, Democratic Republic of the */
{ "cn", KBD_CHINESE_TRADITIONAL_PHONETIC, cn_variants }, /* China */
{ "hr", KBD_CROATIAN, hr_variants }, /* Croatia */
{ "cz", KBD_CZECH, cz_variants }, /* Czechia */
{ "dk", KBD_DANISH, dk_variants }, /* Denmark */
{ "nl", KBD_DUTCH, nl_variants }, /* Netherlands */
{ "bt", 0, NULL }, /* Bhutan */
{ "ee", KBD_ESTONIAN, ee_variants }, /* Estonia */
{ "ir", 0, ir_variants }, /* Iran */
{ "iq", 0, iq_variants }, /* Iraq */
{ "fo", 0, fo_variants }, /* Faroe Islands */
{ "fi", KBD_FINNISH, fi_variants }, /* Finland */
{ "fr", KBD_FRENCH, fr_variants }, /* France */
{ "gh", 0, gh_variants }, /* Ghana */
{ "gn", 0, NULL }, /* Guinea */
{ "ge", KBD_GEORGIAN, ge_variants }, /* Georgia */
{ "de", KBD_GERMAN, de_variants }, /* Germany */
{ "gr", KBD_GREEK, gr_variants }, /* Greece */
{ "hu", KBD_HUNGARIAN, hu_variants }, /* Hungary */
{ "is", KBD_ICELANDIC, is_variants }, /* Iceland */
{ "il", KBD_HEBREW, il_variants }, /* Israel */
{ "it", KBD_ITALIAN, it_variants }, /* Italy */
{ "jp", KBD_JAPANESE_INPUT_SYSTEM_MS_IME2002, jp_variants }, /* Japan */
{ "kg", 0, kg_variants }, /* Kyrgyzstan */
{ "kh", 0, NULL }, /* Cambodia */
{ "kz", KBD_KAZAKH, kz_variants }, /* Kazakhstan */
{ "la", 0, NULL }, /* Laos */
{ "latam", KBD_LATIN_AMERICAN, latam_variants }, /* Latin America */
{ "lt", KBD_LITHUANIAN, lt_variants }, /* Lithuania */
{ "lv", KBD_LATVIAN, lv_variants }, /* Latvia */
{ "mao", KBD_MAORI, NULL }, /* Maori */
{ "me", KBD_SERBIAN_LATIN, me_variants }, /* Montenegro */
{ "mk", KBD_FYRO_MACEDONIAN, mk_variants }, /* Macedonia */
{ "mt", KBD_MALTESE_48_KEY, mt_variants }, /* Malta */
{ "mn", KBD_MONGOLIAN_CYRILLIC, NULL }, /* Mongolia */
{ "no", KBD_NORWEGIAN, no_variants }, /* Norway */
{ "pl", KBD_POLISH_214, pl_variants }, /* Poland */
{ "pt", KBD_PORTUGUESE, pt_variants }, /* Portugal */
{ "ro", KBD_ROMANIAN, ro_variants }, /* Romania */
{ "ru", KBD_RUSSIAN, ru_variants }, /* Russia */
{ "rs", KBD_SERBIAN_LATIN, rs_variants }, /* Serbia */
{ "si", KBD_SLOVENIAN, si_variants }, /* Slovenia */
{ "sk", KBD_SLOVAK, sk_variants }, /* Slovakia */
{ "es", KBD_SPANISH, es_variants }, /* Spain */
{ "se", KBD_SWEDISH, se_variants }, /* Sweden */
{ "ch", KBD_SWISS_FRENCH, ch_variants }, /* Switzerland */
{ "sy", KBD_SYRIAC, sy_variants }, /* Syria */
{ "tj", 0, tj_variants }, /* Tajikistan */
{ "lk", 0, lk_variants }, /* Sri Lanka */
{ "th", KBD_THAI_KEDMANEE, th_variants }, /* Thailand */
{ "tr", KBD_TURKISH_Q, tr_variants }, /* Turkey */
{ "ua", KBD_UKRAINIAN, ua_variants }, /* Ukraine */
{ "gb", KBD_UNITED_KINGDOM, gb_variants }, /* United Kingdom */
{ "uz", KBD_UZBEK_CYRILLIC, uz_variants }, /* Uzbekistan */
{ "vn", KBD_VIETNAMESE, NULL }, /* Vietnam */
{ "kr", KBD_KOREAN_INPUT_SYSTEM_IME_2000, kr_variants }, /* Korea, Republic of */
{ "ie", KBD_UNITED_KINGDOM, ie_variants }, /* Ireland */
{ "pk", 0, pk_variants }, /* Pakistan */
{ "mv", 0, NULL }, /* Maldives */
{ "za", 0, NULL }, /* South Africa */
{ "epo", 0, epo_variants }, /* Esperanto */
{ "np", KBD_NEPALI, NULL }, /* Nepal */
{ "ng", 0, ng_variants }, /* Nigeria */
{ "et", 0, NULL }, /* Ethiopia */
{ "sn", 0, NULL }, /* Senegal */
{ "brai", 0, brai_variants }, /* Braille */
{ "tm", KBD_TURKISH_Q, tm_variants }, /* Turkmenistan */
};
uint32 find_keyboard_layout_in_xorg_rules(char* layout, char* variant)
{
int i, j;
if ((layout == NULL) || (variant == NULL))
return 0;
DEBUG_KBD("xkbLayout: %s\txkbVariant: %s", layout, variant);
for (i = 0; i < ARRAY_SIZE(xkbLayouts); i++)
{
if (strcmp(xkbLayouts[i].layout, layout) == 0)
{
for (j = 0; xkbLayouts[i].variants[j].variant != NULL && strlen(xkbLayouts[i].variants[j].variant) > 0; j++)
{
if (strcmp(xkbLayouts[i].variants[j].variant, variant) == 0)
{
return xkbLayouts[i].variants[j].keyboardLayoutID;
}
}
return xkbLayouts[i].keyboardLayoutID;
}
}
return 0;
}

View File

@ -0,0 +1,27 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* RDP Keyboard layout ID detection from common X11 xkb keyboard layout names
*
* Copyright 2009-2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef __FREERDP_XKB_LAYOUT_IDS_H
#define __FREERDP_XKB_LAYOUT_IDS_H
#include <freerdp/types.h>
uint32 find_keyboard_layout_in_xorg_rules(char* layout, char* variant);
#endif /* __FREERDP_XKB_LAYOUT_IDS_H */