Merge pull request #1058 from awakecoding/master

Keyboard Input Overhaul (Part 1)
This commit is contained in:
Marc-André Moreau 2013-03-07 10:59:21 -08:00
commit a6f3c50bed
57 changed files with 3134 additions and 4184 deletions

View File

@ -334,7 +334,6 @@ endif()
# Path to put FreeRDP data
set(FREERDP_DATA_PATH "${CMAKE_INSTALL_PREFIX}/share/freerdp")
set(FREERDP_KEYMAP_PATH "${FREERDP_DATA_PATH}/keymaps")
# Path to put plugins
@ -364,9 +363,7 @@ set(CMAKE_INSTALL_RPATH "\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}:\$ORIGIN/..")
include(CTest)
if(BUILD_TESTING)
find_package(Cmockery)
if(BUILD_TESTING)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DFREERDP_TEST_EXPORTS")
enable_testing()
@ -417,10 +414,6 @@ if(WITH_THIRD_PARTY)
add_subdirectory(third-party)
endif()
if(NOT MSVC)
add_subdirectory(keymaps)
endif()
# Packaging
SET(CPACK_BINARY_ZIP "ON")

View File

@ -37,6 +37,11 @@ set_complex_link_libraries(VARIABLE ${MODULE_PREFIX}_LIBS
MONOLITHIC ${MONOLITHIC_BUILD}
MODULE freerdp
MODULES freerdp-core freerdp-gdi freerdp-locale freerdp-codec freerdp-primitives freerdp-utils)
set_complex_link_libraries(VARIABLE ${MODULE_PREFIX}_LIBS
MONOLITHIC ${MONOLITHIC_BUILD}
MODULE winpr
MODULES winpr-input winpr-crt)
target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS})
install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR})

View File

@ -17,6 +17,9 @@
* limitations under the License.
*/
#include <winpr/crt.h>
#include <winpr/input.h>
#include <freerdp/locale/keyboard.h>
#include "df_event.h"
@ -26,7 +29,7 @@ static BYTE functionmap[128];
void df_keyboard_init()
{
memset(keymap, 0, sizeof(keymap));
ZeroMemory(keymap, sizeof(keymap));
/* Map DirectFB keycodes to Virtual Key Codes */
@ -146,8 +149,7 @@ void df_keyboard_init()
keymap[DIKI_META_R - DIKI_UNKNOWN] = VK_RWIN;
keymap[DIKI_SUPER_L - DIKI_UNKNOWN] = VK_APPS;
memset(functionmap, 0, sizeof(functionmap));
ZeroMemory(functionmap, sizeof(functionmap));
functionmap[DFB_FUNCTION_KEY(23) - DFB_FUNCTION_KEY(0)] = VK_HANGUL;
functionmap[DFB_FUNCTION_KEY(24) - DFB_FUNCTION_KEY(0)] = VK_HANJA;
@ -190,19 +192,19 @@ void df_send_mouse_wheel_event(rdpInput* input, INT16 axisrel, UINT16 x, UINT16
void df_send_keyboard_event(rdpInput* input, BOOL down, BYTE keycode, BYTE function)
{
BYTE vkcode;
RDP_SCANCODE rdp_scancode;
DWORD scancode = 0;
BYTE vkcode = VK_NONE;
if (keycode)
vkcode = keymap[keycode];
else if (function)
vkcode = functionmap[function];
else
return;
rdp_scancode = freerdp_keyboard_get_rdp_scancode_from_virtual_key_code(vkcode);
if (vkcode != VK_NONE)
scancode = GetVirtualScanCodeFromVirtualKeyCode(vkcode, input->context->settings->KeyboardType);
freerdp_input_send_keyboard_event_ex(input, down, rdp_scancode);
if (scancode)
freerdp_input_send_keyboard_event_ex(input, down, scancode);
}
BOOL df_event_process(freerdp* instance, DFBEvent* event)

View File

@ -41,7 +41,7 @@ extern HCURSOR g_default_cursor;
LRESULT CALLBACK wf_ll_kbd_proc(int nCode, WPARAM wParam, LPARAM lParam)
{
wfInfo* wfi;
RDP_SCANCODE rdp_scancode;
DWORD rdp_scancode;
rdpInput* input;
PKBDLLHOOKSTRUCT p;

View File

@ -68,7 +68,7 @@ void xf_kbd_unset_keypress(xfInfo* xfi, BYTE keycode)
void xf_kbd_release_all_keypress(xfInfo* xfi)
{
int keycode;
RDP_SCANCODE rdp_scancode;
DWORD rdp_scancode;
for (keycode = 0; keycode < ARRAYSIZE(xfi->pressed_keys); keycode++)
{
@ -89,7 +89,7 @@ BOOL xf_kbd_key_pressed(xfInfo* xfi, KeySym keysym)
void xf_kbd_send_key(xfInfo* xfi, BOOL down, BYTE keycode)
{
RDP_SCANCODE rdp_scancode;
DWORD rdp_scancode;
rdpInput* input;
input = xfi->instance->input;

View File

@ -1,41 +0,0 @@
# - Find Cmockery
# Find the Cmockery libraries
#
# This module defines the following variables:
# CMOCKERY_FOUND - true if CMOCKERY_INCLUDE_DIR & CMOCKERY_LIBRARY are found
# CMOCKERY_LIBRARIES - Set when CMOCKERY_LIBRARY is found
# CMOCKERY_INCLUDE_DIRS - Set when CMOCKERY_INCLUDE_DIR is found
#
#=============================================================================
# Copyright 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.
#=============================================================================
find_path(CMOCKERY_INCLUDE_DIR NAMES cmockery.h
PATH_SUFFIXES google)
find_library(CMOCKERY_LIBRARY NAMES cmockery
DOC "The Cmockery library")
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Cmockery DEFAULT_MSG CMOCKERY_LIBRARY CMOCKERY_INCLUDE_DIR)
if(CMOCKERY_FOUND)
set(CMOCKERY_LIBRARIES ${CMOCKERY_LIBRARY})
set(CMOCKERY_INCLUDE_DIRS ${CMOCKERY_INCLUDE_DIR})
endif()
mark_as_advanced(CMOCKERY_INCLUDE_DIR CMOCKERY_LIBRARY)

View File

@ -20,10 +20,11 @@
#ifndef FREERDP_LOCALE_KEYBOARD_H
#define FREERDP_LOCALE_KEYBOARD_H
#include <winpr/input.h>
#include <freerdp/api.h>
#include <freerdp/types.h>
#include <freerdp/scancode.h>
#include <freerdp/locale/vkcodes.h>
#define RDP_KEYBOARD_LAYOUT_TYPE_STANDARD 1
#define RDP_KEYBOARD_LAYOUT_TYPE_VARIANT 2
@ -31,7 +32,7 @@
struct _RDP_KEYBOARD_LAYOUT
{
UINT32 code; /* Keyboard layout code */
DWORD code; /* Keyboard layout code */
char* name; /* Keyboard layout name */
};
typedef struct _RDP_KEYBOARD_LAYOUT RDP_KEYBOARD_LAYOUT;
@ -198,11 +199,10 @@ typedef struct _RDP_KEYBOARD_LAYOUT RDP_KEYBOARD_LAYOUT;
#define KBD_TYPE_NOKIA_9140 0x00000006 /* Nokia 9140 and similar keyboards */
#define KBD_TYPE_JAPANESE 0x00000007 /* Japanese keyboard */
FREERDP_API UINT32 freerdp_keyboard_init(UINT32 keyboardLayoutId);
FREERDP_API RDP_KEYBOARD_LAYOUT* freerdp_keyboard_get_layouts(UINT32 types);
FREERDP_API const char* freerdp_keyboard_get_layout_name_from_id(UINT32 keyboardLayoutId);
FREERDP_API RDP_SCANCODE freerdp_keyboard_get_rdp_scancode_from_x11_keycode(UINT32 keycode);
FREERDP_API UINT32 freerdp_keyboard_get_x11_keycode_from_rdp_scancode(UINT32 scancode, BOOL extended);
FREERDP_API RDP_SCANCODE freerdp_keyboard_get_rdp_scancode_from_virtual_key_code(UINT32 vkcode);
FREERDP_API DWORD freerdp_keyboard_init(DWORD keyboardLayoutId);
FREERDP_API RDP_KEYBOARD_LAYOUT* freerdp_keyboard_get_layouts(DWORD types);
FREERDP_API const char* freerdp_keyboard_get_layout_name_from_id(DWORD keyboardLayoutId);
FREERDP_API DWORD freerdp_keyboard_get_rdp_scancode_from_x11_keycode(DWORD keycode);
FREERDP_API DWORD freerdp_keyboard_get_x11_keycode_from_rdp_scancode(DWORD scancode, BOOL extended);
#endif /* FREERDP_LOCALE_KEYBOARD_H */

View File

@ -230,8 +230,8 @@
#define YORUBA 0x046A
#define ZULU 0x0435
FREERDP_API UINT32 freerdp_get_system_locale_id(void);
FREERDP_API UINT32 freerdp_detect_keyboard_layout_from_system_locale(void);
FREERDP_API const char* freerdp_get_system_locale_name_from_id(UINT32 localeId);
FREERDP_API DWORD freerdp_get_system_locale_id(void);
FREERDP_API const char* freerdp_get_system_locale_name_from_id(DWORD localeId);
FREERDP_API int freerdp_detect_keyboard_layout_from_system_locale(DWORD* keyboardLayoutId);
#endif /* FREERDP_LOCALE_H */

View File

@ -1,309 +0,0 @@
/**
* 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

@ -20,6 +20,8 @@
#ifndef FREERDP_LOCALE_KEYBOARD_RDP_SCANCODE_H
#define FREERDP_LOCALE_KEYBOARD_RDP_SCANCODE_H
#include <winpr/input.h>
/* @msdn{cc240584} says:
* "... (a scancode is an 8-bit value specifying a key location on the keyboard).
* The server accepts a scancode value and translates it into the correct character depending on the language locale and keyboard layout used in the session."
@ -27,10 +29,9 @@
* The extended flag is for all practical an important 9th bit with a strange encoding - not just a modifier.
*/
typedef UINT32 RDP_SCANCODE; /* Our own representation of a RDP protocol scancode */
#define RDP_SCANCODE_CODE(_rdp_scancode) ((BYTE)(_rdp_scancode & 0xFF))
#define RDP_SCANCODE_EXTENDED(_rdp_scancode) (((_rdp_scancode) & 0x100) ? TRUE : FALSE)
#define MAKE_RDP_SCANCODE(_code, _extended) (((_code) & 0xFF) | ((_extended) ? 0x100 : 0))
#define RDP_SCANCODE_EXTENDED(_rdp_scancode) (((_rdp_scancode) & KBDEXT) ? TRUE : FALSE)
#define MAKE_RDP_SCANCODE(_code, _extended) (((_code) & 0xFF) | ((_extended) ? KBDEXT : 0))
/* Defines for known RDP_SCANCODE protocol values.
* Mostly the same as the PKBDLLHOOKSTRUCT scanCode, "A hardware scan code for the key", @msdn{ms644967}.
@ -147,8 +148,8 @@ typedef UINT32 RDP_SCANCODE; /* Our own representation of a RDP protocol scancod
#define RDP_SCANCODE_KANA_HANGUL MAKE_RDP_SCANCODE(0x72, FALSE) /* VK_KANA / VK_HANGUL (undocumented?) */
#define RDP_SCANCODE_ABNT_C1 MAKE_RDP_SCANCODE(0x73, FALSE) /* VK_ABNT_C1 JP OEM_102 */
#define RDP_SCANCODE_F24_JP MAKE_RDP_SCANCODE(0x76, FALSE) /* JP F24 */
#define RDP_SCANCODE_CONVERT_JP MAKE_RDP_SCANCODE(0x79, FALSE) /* JP CONVERT */
#define RDP_SCANCODE_NONCONVERT_JP MAKE_RDP_SCANCODE(0x7B, FALSE) /* JP NONCONVERT */
#define RDP_SCANCODE_CONVERT_JP MAKE_RDP_SCANCODE(0x79, FALSE) /* JP VK_CONVERT */
#define RDP_SCANCODE_NONCONVERT_JP MAKE_RDP_SCANCODE(0x7B, FALSE) /* JP VK_NONCONVERT */
#define RDP_SCANCODE_TAB_JP MAKE_RDP_SCANCODE(0x7C, FALSE) /* JP TAB */
#define RDP_SCANCODE_BACKSLASH_JP MAKE_RDP_SCANCODE(0x7D, FALSE) /* JP OEM_5 ('\') */
#define RDP_SCANCODE_ABNT_C2 MAKE_RDP_SCANCODE(0x7E, FALSE) /* VK_ABNT_C2, JP */

View File

@ -1,24 +0,0 @@
# FreeRDP: A Remote Desktop Protocol Implementation
# keymaps cmake build script
#
# Copyright 2011 O.S. Systems Software Ltda.
# Copyright 2011 Otavio Salvador <otavio@ossystems.com.br>
# Copyright 2011 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.
if(NOT WITH_XKBFILE)
install(FILES aliases amiga ataritt empty evdev fujitsu hp ibm macintosh macosx sony sun xfree86 xfree98 DESTINATION ${FREERDP_KEYMAP_PATH})
install(DIRECTORY digital_vndr DESTINATION ${FREERDP_KEYMAP_PATH} FILES_MATCHING PATTERN "*")
install(DIRECTORY sgi_vndr DESTINATION ${FREERDP_KEYMAP_PATH} FILES_MATCHING PATTERN "*")
endif()

View File

@ -1,17 +0,0 @@
# This file was generated with xkb.pl (Wed Aug 11 09:09:10 2010)
# and is based on the X Keyboard Configuration Database version 1.9
# Please use xkb.pl to re-export newer versions of XKB
keyboard "qwerty"
{
};
keyboard "azerty"
{
};
keyboard "qwertz"
{
};

View File

@ -1,193 +0,0 @@
# This file was generated with xkb.pl (Wed Aug 11 09:09:10 2010)
# and is based on the X Keyboard Configuration Database version 1.9
# Please use xkb.pl to re-export newer versions of XKB
keyboard "usa1"
{
VK_ESCAPE <77>
VK_F1 <88>
VK_F2 <89>
VK_F3 <90>
VK_F4 <91>
VK_F5 <92>
VK_F6 <93>
VK_F7 <94>
VK_F8 <95>
VK_F9 <96>
VK_F10 <97>
VK_OEM_3 <8>
VK_KEY_1 <9>
VK_KEY_2 <10>
VK_KEY_3 <11>
VK_KEY_4 <12>
VK_KEY_5 <13>
VK_KEY_6 <14>
VK_KEY_7 <15>
VK_KEY_8 <16>
VK_KEY_9 <17>
VK_KEY_0 <18>
VK_OEM_MINUS <19>
VK_OEM_PLUS <20>
VK_OEM_5 <21>
VK_BACK <73>
VK_TAB <74>
VK_KEY_Q <24>
VK_KEY_W <25>
VK_KEY_E <26>
VK_KEY_R <27>
VK_KEY_T <28>
VK_KEY_Y <29>
VK_KEY_U <30>
VK_KEY_I <31>
VK_KEY_O <32>
VK_KEY_P <33>
VK_OEM_4 <34>
VK_OEM_6 <35>
VK_RETURN <76>
VK_LCONTROL <107>
VK_CAPITAL <106>
VK_KEY_A <40>
VK_KEY_S <41>
VK_KEY_D <42>
VK_KEY_F <43>
VK_KEY_G <44>
VK_KEY_H <45>
VK_KEY_J <46>
VK_KEY_K <47>
VK_KEY_L <48>
VK_OEM_1 <49>
VK_OEM_7 <50>
VK_LSHIFT <104>
VK_KEY_Z <57>
VK_KEY_X <58>
VK_KEY_C <59>
VK_KEY_V <60>
VK_KEY_B <61>
VK_KEY_N <62>
VK_KEY_M <63>
VK_OEM_COMMA <64>
VK_OEM_PERIOD <65>
VK_OEM_2 <66>
VK_RSHIFT <105>
VK_LMENU <108>
VK_SPACE <72>
VK_RMENU <109>
VK_DELETE <78>
VK_HELP <103>
VK_UP <84>
VK_LEFT <87>
VK_DOWN <85>
VK_RIGHT <86>
VK_DIVIDE <100>
VK_MULTIPLY <101>
VK_NUMPAD7 <69>
VK_NUMPAD8 <70>
VK_NUMPAD9 <71>
VK_SUBTRACT <82>
VK_NUMPAD4 <53>
VK_NUMPAD5 <54>
VK_NUMPAD6 <55>
VK_ADD <102>
VK_NUMPAD1 <37>
VK_NUMPAD2 <38>
VK_NUMPAD3 <39>
VK_NUMPAD0 <23>
VK_RETURN <75>
};
keyboard "de"
{
VK_ESCAPE <77>
VK_F1 <88>
VK_F2 <89>
VK_F3 <90>
VK_F4 <91>
VK_F5 <92>
VK_F6 <93>
VK_F7 <94>
VK_F8 <95>
VK_F9 <96>
VK_F10 <97>
VK_OEM_3 <8>
VK_KEY_1 <9>
VK_KEY_2 <10>
VK_KEY_3 <11>
VK_KEY_4 <12>
VK_KEY_5 <13>
VK_KEY_6 <14>
VK_KEY_7 <15>
VK_KEY_8 <16>
VK_KEY_9 <17>
VK_KEY_0 <18>
VK_OEM_MINUS <19>
VK_OEM_PLUS <20>
VK_OEM_5 <21>
VK_BACK <73>
VK_TAB <74>
VK_KEY_Q <24>
VK_KEY_W <25>
VK_KEY_E <26>
VK_KEY_R <27>
VK_KEY_T <28>
VK_KEY_Y <29>
VK_KEY_U <30>
VK_KEY_I <31>
VK_KEY_O <32>
VK_KEY_P <33>
VK_OEM_4 <34>
VK_OEM_6 <35>
VK_RETURN <76>
VK_LCONTROL <107>
VK_CAPITAL <106>
VK_KEY_A <40>
VK_KEY_S <41>
VK_KEY_D <42>
VK_KEY_F <43>
VK_KEY_G <44>
VK_KEY_H <45>
VK_KEY_J <46>
VK_KEY_K <47>
VK_KEY_L <48>
VK_OEM_1 <49>
VK_OEM_7 <50>
VK_OEM_5 <51>
VK_LSHIFT <104>
VK_OEM_102 <56>
VK_KEY_Z <57>
VK_KEY_X <58>
VK_KEY_C <59>
VK_KEY_V <60>
VK_KEY_B <61>
VK_KEY_N <62>
VK_KEY_M <63>
VK_OEM_COMMA <64>
VK_OEM_PERIOD <65>
VK_OEM_2 <66>
VK_RSHIFT <105>
VK_LMENU <108>
VK_SPACE <72>
VK_RMENU <109>
VK_DELETE <78>
VK_HELP <103>
VK_UP <84>
VK_LEFT <87>
VK_DOWN <85>
VK_RIGHT <86>
VK_DIVIDE <100>
VK_MULTIPLY <101>
VK_NUMPAD7 <69>
VK_NUMPAD8 <70>
VK_NUMPAD9 <71>
VK_SUBTRACT <82>
VK_NUMPAD4 <53>
VK_NUMPAD5 <54>
VK_NUMPAD6 <55>
VK_ADD <102>
VK_NUMPAD1 <37>
VK_NUMPAD2 <38>
VK_NUMPAD3 <39>
VK_NUMPAD0 <23>
VK_RETURN <75>
};

View File

@ -1,104 +0,0 @@
# This file was generated with xkb.pl (Wed Aug 11 09:09:10 2010)
# and is based on the X Keyboard Configuration Database version 1.9
# Please use xkb.pl to re-export newer versions of XKB
keyboard "us"
{
VK_ESCAPE <9>
VK_KEY_1 <10>
VK_KEY_2 <11>
VK_KEY_3 <12>
VK_KEY_4 <13>
VK_KEY_5 <14>
VK_KEY_6 <15>
VK_KEY_7 <16>
VK_KEY_8 <17>
VK_KEY_9 <18>
VK_KEY_0 <19>
VK_OEM_MINUS <20>
VK_OEM_PLUS <21>
VK_OEM_3 <49>
VK_BACK <22>
VK_TAB <23>
VK_KEY_Q <24>
VK_KEY_W <25>
VK_KEY_E <26>
VK_KEY_R <27>
VK_KEY_T <28>
VK_KEY_Y <29>
VK_KEY_U <30>
VK_KEY_I <31>
VK_KEY_O <32>
VK_KEY_P <33>
VK_OEM_4 <34>
VK_OEM_6 <35>
VK_RETURN <36>
VK_DELETE <91>
VK_LCONTROL <37>
VK_KEY_A <38>
VK_KEY_S <39>
VK_KEY_D <40>
VK_KEY_F <41>
VK_KEY_G <42>
VK_KEY_H <43>
VK_KEY_J <44>
VK_KEY_K <45>
VK_KEY_L <46>
VK_OEM_1 <47>
VK_OEM_7 <48>
VK_OEM_5 <51>
VK_LSHIFT <50>
VK_KEY_Z <52>
VK_KEY_X <53>
VK_KEY_C <54>
VK_KEY_V <55>
VK_KEY_B <56>
VK_KEY_N <57>
VK_KEY_M <58>
VK_OEM_COMMA <59>
VK_OEM_PERIOD <60>
VK_OEM_2 <61>
VK_RSHIFT <62>
VK_SPACE <65>
VK_CAPITAL <66>
VK_F1 <67>
VK_F2 <68>
VK_F3 <69>
VK_F4 <70>
VK_F5 <71>
VK_F6 <72>
VK_F7 <73>
VK_F8 <74>
VK_F9 <75>
VK_F10 <76>
VK_HELP <106>
VK_INSERT <90>
VK_HOME <79>
VK_UP <80>
VK_LEFT <83>
VK_DOWN <88>
VK_RIGHT <85>
VK_DIVIDE <109>
VK_MULTIPLY <110>
VK_NUMPAD7 <111>
VK_NUMPAD8 <112>
VK_NUMPAD9 <113>
VK_SUBTRACT <82>
VK_NUMPAD4 <114>
VK_NUMPAD5 <115>
VK_NUMPAD6 <116>
VK_ADD <86>
VK_NUMPAD1 <117>
VK_NUMPAD2 <118>
VK_NUMPAD3 <119>
VK_NUMPAD0 <120>
VK_RETURN <122>
};
keyboard "de"
: extends "ataritt(us)"
{
VK_OEM_102 <104>
};

View File

@ -1,197 +0,0 @@
# This file was generated with xkb.pl (Wed Aug 11 09:09:10 2010)
# and is based on the X Keyboard Configuration Database version 1.9
# Please use xkb.pl to re-export newer versions of XKB
keyboard "lk_common"
{
VK_F1 <86>
VK_F2 <87>
VK_F3 <88>
VK_F4 <89>
VK_F5 <90>
VK_F6 <100>
VK_F7 <101>
VK_F8 <102>
VK_F9 <103>
VK_F10 <104>
VK_F11 <113>
VK_F12 <114>
VK_UP <170>
VK_LEFT <167>
VK_DOWN <169>
VK_RIGHT <168>
VK_NUMPAD7 <157>
VK_NUMPAD8 <158>
VK_NUMPAD9 <159>
VK_NUMPAD4 <153>
VK_NUMPAD5 <154>
VK_NUMPAD6 <155>
VK_NUMPAD1 <150>
VK_NUMPAD2 <151>
VK_NUMPAD3 <152>
VK_RETURN <149>
VK_NUMPAD0 <146>
VK_DECIMAL <148>
VK_TILDE <191>
VK_KEY_1 <192>
VK_KEY_2 <197>
VK_KEY_3 <203>
VK_KEY_4 <208>
VK_KEY_5 <214>
VK_KEY_6 <219>
VK_KEY_7 <224>
VK_KEY_8 <229>
VK_KEY_9 <234>
VK_KEY_0 <239>
VK_OEM_MINUS <249>
VK_OEM_PLUS <245>
VK_BACK <188>
VK_TAB <190>
VK_KEY_Q <193>
VK_KEY_W <198>
VK_KEY_E <204>
VK_KEY_R <209>
VK_KEY_T <215>
VK_KEY_Y <220>
VK_KEY_U <225>
VK_KEY_I <230>
VK_KEY_O <235>
VK_KEY_P <240>
VK_OEM_4 <250>
VK_OEM_6 <246>
VK_RETURN <189>
VK_LCONTROL <175>
VK_CAPITAL <176>
VK_KEY_A <194>
VK_KEY_S <199>
VK_KEY_D <205>
VK_KEY_F <210>
VK_KEY_G <216>
VK_KEY_H <221>
VK_KEY_J <226>
VK_KEY_K <231>
VK_KEY_L <236>
VK_OEM_1 <242>
VK_OEM_7 <251>
VK_LSHIFT <174>
VK_KEY_Z <195>
VK_KEY_X <200>
VK_KEY_C <206>
VK_KEY_V <211>
VK_KEY_B <217>
VK_KEY_N <222>
VK_KEY_M <227>
VK_OEM_COMMA <232>
VK_OEM_PERIOD <237>
VK_OEM_2 <243>
VK_RSHIFT <171>
VK_SPACE <212>
};
keyboard "lkx01"
: extends "digital_vndr/lk(lk_common)"
{
VK_LSHIFT <201>
VK_F13 <115>
VK_F14 <116>
VK_F17 <128>
VK_F18 <129>
VK_F19 <130>
VK_F20 <131>
VK_HELP <124>
VK_INSERT <139>
VK_DELETE <140>
VK_SELECT <141>
VK_PRIOR <142>
VK_NEXT <143>
VK_NUMLOCK <161>
VK_DIVIDE <162>
VK_MULTIPLY <163>
VK_SUBTRACT <164>
VK_SUBTRACT <160>
VK_ADD <156>
VK_OEM_5 <247>
};
keyboard "lk201"
: extends "digital_vndr/lk(lkx01)"
{
};
keyboard "lk421"
: extends "digital_vndr/lk(lkx01)"
{
VK_LMENU <172>
VK_RMENU <178>
};
keyboard "lk401"
: extends "digital_vndr/lk(lk421)"
{
};
keyboard "lk44x"
: extends "digital_vndr/lk(lk_common)"
{
VK_ESCAPE <85>
VK_SNAPSHOT <115>
VK_SCROLL <116>
VK_PAUSE <124>
VK_INSERT <138>
VK_HOME <139>
VK_PRIOR <140>
VK_DELETE <141>
VK_END <142>
VK_NEXT <143>
VK_NUMLOCK <161>
VK_DIVIDE <162>
VK_MULTIPLY <163>
VK_SUBTRACT <164>
VK_ADD <156>
VK_LMENU <172>
VK_RMENU <178>
VK_RCONTROL <173>
};
keyboard "lk443"
: extends "digital_vndr/lk(lk44x)"
{
VK_OEM_5 <247>
};
keyboard "lk444"
: extends "digital_vndr/lk(lk44x)"
{
VK_OEM_5 <201>
VK_OEM_5 <247>
};
keyboard "lk421aj"
: extends "digital_vndr/lk(lk421)"
{
VK_ABNT_C1 <252>
};
keyboard "lk421jj"
: extends "digital_vndr/lk(lk421aj)"
{
VK_NONCONVERT <94>
VK_KANJI <95>
VK_KANA <97>
};
keyboard "lk401bj"
: extends "digital_vndr/lk(lk401)"
{
VK_NONCONVERT <94>
VK_KANJI <95>
VK_KANA <97>
};
keyboard "lk401jj"
: extends "digital_vndr/lk(lk401bj)"
{
VK_ABNT_C1 <252>
};

View File

@ -1,192 +0,0 @@
# This file was generated with xkb.pl (Wed Aug 11 09:09:10 2010)
# and is based on the X Keyboard Configuration Database version 1.9
# Please use xkb.pl to re-export newer versions of XKB
keyboard "pc_common"
{
VK_F1 <9>
VK_F2 <15>
VK_F3 <23>
VK_F4 <31>
VK_F5 <39>
VK_F6 <47>
VK_F7 <55>
VK_F8 <63>
VK_F9 <71>
VK_F10 <79>
VK_F11 <86>
VK_F12 <94>
VK_UP <99>
VK_LEFT <97>
VK_DOWN <96>
VK_RIGHT <106>
VK_NUMPAD7 <108>
VK_NUMPAD8 <117>
VK_NUMPAD9 <125>
VK_NUMPAD4 <107>
VK_NUMPAD5 <115>
VK_NUMPAD6 <116>
VK_NUMPAD1 <105>
VK_NUMPAD2 <114>
VK_NUMPAD3 <122>
VK_RETURN <121>
VK_NUMPAD0 <112>
VK_DECIMAL <113>
VK_KEY_1 <22>
VK_KEY_2 <30>
VK_KEY_3 <38>
VK_KEY_4 <37>
VK_KEY_5 <46>
VK_KEY_6 <54>
VK_KEY_7 <61>
VK_KEY_8 <62>
VK_KEY_9 <70>
VK_KEY_0 <69>
VK_OEM_MINUS <78>
VK_OEM_PLUS <85>
VK_BACK <102>
VK_TAB <13>
VK_KEY_Q <21>
VK_KEY_W <29>
VK_KEY_E <36>
VK_KEY_R <45>
VK_KEY_T <44>
VK_KEY_Y <53>
VK_KEY_U <60>
VK_KEY_I <67>
VK_KEY_O <68>
VK_KEY_P <77>
VK_OEM_4 <84>
VK_OEM_6 <91>
VK_CAPITAL <20>
VK_KEY_A <28>
VK_KEY_S <27>
VK_KEY_D <35>
VK_KEY_F <43>
VK_KEY_G <52>
VK_KEY_H <51>
VK_KEY_J <59>
VK_KEY_K <66>
VK_KEY_L <75>
VK_OEM_1 <76>
VK_OEM_7 <82>
VK_RETURN <90>
VK_LSHIFT <18>
VK_KEY_Z <26>
VK_KEY_X <34>
VK_KEY_C <33>
VK_KEY_V <42>
VK_KEY_B <50>
VK_KEY_N <49>
VK_KEY_M <58>
VK_OEM_COMMA <65>
VK_OEM_PERIOD <73>
VK_OEM_2 <74>
VK_RSHIFT <89>
VK_LCONTROL <17>
VK_LMENU <25>
VK_SPACE <41>
VK_RMENU <57>
};
keyboard "pc10x"
: extends "digital_vndr/pc(pc_common)"
{
VK_ESCAPE <8>
VK_TILDE <14>
VK_SNAPSHOT <87>
VK_SCROLL <95>
VK_PAUSE <98>
VK_INSERT <103>
VK_HOME <110>
VK_PRIOR <111>
VK_DELETE <100>
VK_END <101>
VK_NEXT <109>
VK_NUMLOCK <118>
VK_DIVIDE <119>
VK_MULTIPLY <126>
VK_SUBTRACT <132>
VK_ADD <124>
VK_RCONTROL <88>
};
keyboard "pc101"
: extends "digital_vndr/pc(pc10x)"
{
VK_OEM_5 <92>
};
keyboard "pc102"
: extends "digital_vndr/pc(pc10x)"
{
VK_OEM_5 <19>
VK_OEM_5 <83>
};
keyboard "pc104"
: extends "digital_vndr/pc(pc101)"
{
VK_LWIN <139>
VK_RWIN <140>
VK_APPS <141>
};
keyboard "lk411_common"
: extends "digital_vndr/pc(pc_common)"
{
VK_TILDE <8>
VK_LSHIFT <14>
VK_F13 <24>
VK_F14 <10>
VK_F17 <16>
VK_F18 <87>
VK_F19 <95>
VK_F20 <98>
VK_HELP <11>
VK_INSERT <103>
VK_DELETE <100>
VK_SELECT <101>
VK_PRIOR <111>
VK_NEXT <109>
VK_NUMLOCK <118>
VK_DIVIDE <119>
VK_MULTIPLY <126>
VK_SUBTRACT <132>
VK_SUBTRACT <19>
VK_ADD <124>
};
keyboard "lk411"
: extends "digital_vndr/pc(lk411_common)"
{
VK_OEM_5 <92>
};
keyboard "lk450"
: extends "digital_vndr/pc(lk411)"
{
};
keyboard "pcxajaa"
: extends "digital_vndr/pc(pc10x)"
{
VK_OEM_5 <93>
VK_OEM_5 <83>
VK_ABNT_C1 <81>
VK_NONCONVERT <133>
VK_KANJI <134>
VK_KANA <135>
};
keyboard "lk411jj"
: extends "digital_vndr/pc(lk411_common)"
{
VK_ABNT_C1 <81>
VK_OEM_5 <83>
VK_NONCONVERT <133>
VK_KANJI <134>
VK_KANA <135>
};

View File

@ -1,13 +0,0 @@
# This file was generated with xkb.pl (Wed Aug 11 09:09:10 2010)
# and is based on the X Keyboard Configuration Database version 1.9
# Please use xkb.pl to re-export newer versions of XKB
keyboard "empty"
{
};
keyboard "empty"
{
};

View File

@ -1,135 +0,0 @@
# This file was generated with xkb.pl (Wed Aug 11 09:09:10 2010)
# and is based on the X Keyboard Configuration Database version 1.9
# Please use xkb.pl to re-export newer versions of XKB
keyboard "evdev"
{
VK_OEM_102 <94>
VK_OEM_3 <49>
VK_KEY_1 <10>
VK_KEY_2 <11>
VK_KEY_3 <12>
VK_KEY_4 <13>
VK_KEY_5 <14>
VK_KEY_6 <15>
VK_KEY_7 <16>
VK_KEY_8 <17>
VK_KEY_9 <18>
VK_KEY_0 <19>
VK_OEM_MINUS <20>
VK_OEM_PLUS <21>
VK_BACK <22>
VK_TAB <23>
VK_KEY_Q <24>
VK_KEY_W <25>
VK_KEY_E <26>
VK_KEY_R <27>
VK_KEY_T <28>
VK_KEY_Y <29>
VK_KEY_U <30>
VK_KEY_I <31>
VK_KEY_O <32>
VK_KEY_P <33>
VK_OEM_4 <34>
VK_OEM_6 <35>
VK_OEM_5 <51>
VK_RETURN <36>
VK_CAPITAL <66>
VK_KEY_A <38>
VK_KEY_S <39>
VK_KEY_D <40>
VK_KEY_F <41>
VK_KEY_G <42>
VK_KEY_H <43>
VK_KEY_J <44>
VK_KEY_K <45>
VK_KEY_L <46>
VK_OEM_1 <47>
VK_OEM_7 <48>
VK_LSHIFT <50>
VK_KEY_Z <52>
VK_KEY_X <53>
VK_KEY_C <54>
VK_KEY_V <55>
VK_KEY_B <56>
VK_KEY_N <57>
VK_KEY_M <58>
VK_OEM_COMMA <59>
VK_OEM_PERIOD <60>
VK_OEM_2 <61>
VK_RSHIFT <62>
VK_LMENU <64>
VK_LCONTROL <37>
VK_SPACE <65>
VK_RCONTROL <105>
VK_RMENU <108>
VK_LWIN <133>
VK_RWIN <134>
VK_APPS <135>
VK_ESCAPE <9>
VK_F1 <67>
VK_F2 <68>
VK_F3 <69>
VK_F4 <70>
VK_F5 <71>
VK_F6 <72>
VK_F7 <73>
VK_F8 <74>
VK_F9 <75>
VK_F10 <76>
VK_F11 <95>
VK_F12 <96>
VK_SNAPSHOT <107>
VK_SCROLL <78>
VK_PAUSE <127>
VK_INSERT <118>
VK_HOME <110>
VK_PRIOR <112>
VK_DELETE <119>
VK_END <115>
VK_NEXT <117>
VK_UP <111>
VK_LEFT <113>
VK_DOWN <116>
VK_RIGHT <114>
VK_NUMLOCK <77>
VK_DIVIDE <106>
VK_MULTIPLY <63>
VK_SUBTRACT <82>
VK_NUMPAD7 <79>
VK_NUMPAD8 <80>
VK_NUMPAD9 <81>
VK_ADD <86>
VK_NUMPAD4 <83>
VK_NUMPAD5 <84>
VK_NUMPAD6 <85>
VK_NUMPAD1 <87>
VK_NUMPAD2 <88>
VK_NUMPAD3 <89>
VK_RETURN <104>
VK_NUMPAD0 <90>
VK_DECIMAL <91>
VK_F13 <191>
VK_F14 <192>
VK_F15 <193>
VK_F16 <194>
VK_F17 <195>
VK_F18 <196>
VK_F19 <197>
VK_F20 <198>
VK_F21 <199>
VK_F22 <200>
VK_F23 <201>
VK_F24 <202>
VK_ABNT_C1 <97>
VK_NONCONVERT <102>
VK_KANA <99>
VK_HELP <146>
};
keyboard "pc98"
: extends "evdev(evdev)"
{
};

View File

@ -1,119 +0,0 @@
# This file was generated with xkb.pl (Wed Aug 11 09:09:10 2010)
# and is based on the X Keyboard Configuration Database version 1.9
# Please use xkb.pl to re-export newer versions of XKB
keyboard "138"
{
VK_ESCAPE <37>
VK_KEY_1 <38>
VK_KEY_2 <39>
VK_KEY_3 <40>
VK_KEY_4 <41>
VK_KEY_5 <42>
VK_KEY_6 <43>
VK_KEY_7 <44>
VK_KEY_8 <45>
VK_KEY_9 <46>
VK_KEY_0 <47>
VK_OEM_MINUS <48>
VK_OEM_PLUS <49>
VK_OEM_3 <50>
VK_BACK <51>
VK_TAB <61>
VK_KEY_Q <62>
VK_KEY_W <63>
VK_KEY_E <64>
VK_KEY_R <65>
VK_KEY_T <66>
VK_KEY_Y <67>
VK_KEY_U <68>
VK_KEY_I <69>
VK_KEY_O <70>
VK_KEY_P <71>
VK_OEM_4 <72>
VK_OEM_6 <73>
VK_LCONTROL <84>
VK_KEY_A <85>
VK_KEY_S <86>
VK_KEY_D <87>
VK_KEY_F <88>
VK_KEY_G <89>
VK_KEY_H <90>
VK_KEY_J <91>
VK_KEY_K <92>
VK_KEY_L <93>
VK_OEM_1 <94>
VK_OEM_7 <95>
VK_OEM_5 <96>
VK_RETURN <97>
VK_LSHIFT <107>
VK_KEY_Z <108>
VK_KEY_X <109>
VK_KEY_C <110>
VK_KEY_V <111>
VK_KEY_B <112>
VK_KEY_N <113>
VK_KEY_M <114>
VK_OEM_COMMA <115>
VK_OEM_PERIOD <116>
VK_OEM_2 <117>
VK_ABNT_C1 <52>
VK_RSHIFT <118>
VK_CAPITAL <127>
VK_LMENU <27>
VK_SPACE <129>
VK_RMENU <23>
VK_APPS <75>
VK_F1 <13>
VK_F2 <14>
VK_F3 <16>
VK_F4 <18>
VK_F5 <20>
VK_F6 <22>
VK_F7 <24>
VK_F8 <25>
VK_F9 <26>
VK_F10 <15>
VK_F11 <17>
VK_F12 <19>
VK_F13 <137>
VK_F14 <138>
VK_F15 <139>
VK_F16 <140>
VK_F17 <141>
VK_F18 <142>
VK_F19 <143>
VK_F20 <144>
VK_F21 <145>
VK_F22 <146>
VK_F23 <147>
VK_F24 <148>
VK_HELP <126>
VK_SNAPSHOT <30>
VK_PAUSE <29>
VK_PRIOR <35>
VK_HOME <32>
VK_NEXT <36>
VK_INSERT <60>
VK_UP <33>
VK_DOWN <103>
VK_LEFT <57>
VK_RIGHT <80>
VK_MULTIPLY <55>
VK_DIVIDE <54>
VK_ADD <133>
VK_SUBTRACT <79>
VK_NUMPAD7 <76>
VK_NUMPAD8 <77>
VK_NUMPAD9 <78>
VK_NUMPAD4 <99>
VK_NUMPAD5 <100>
VK_NUMPAD6 <101>
VK_NUMPAD1 <120>
VK_NUMPAD2 <121>
VK_NUMPAD3 <122>
VK_RETURN <98>
VK_NUMPAD0 <102>
};

View File

@ -1,105 +0,0 @@
# This file was generated with xkb.pl (Wed Aug 11 09:09:10 2010)
# and is based on the X Keyboard Configuration Database version 1.9
# Please use xkb.pl to re-export newer versions of XKB
keyboard "hil"
{
VK_OEM_3 <71>
VK_KEY_1 <70>
VK_KEY_2 <69>
VK_KEY_3 <68>
VK_KEY_4 <67>
VK_KEY_5 <66>
VK_KEY_6 <65>
VK_KEY_7 <64>
VK_KEY_8 <96>
VK_KEY_9 <97>
VK_KEY_0 <98>
VK_OEM_MINUS <99>
VK_OEM_PLUS <100>
VK_BACK <101>
VK_TAB <63>
VK_KEY_Q <62>
VK_KEY_W <61>
VK_KEY_E <60>
VK_KEY_R <59>
VK_KEY_T <58>
VK_KEY_Y <57>
VK_KEY_U <56>
VK_KEY_I <104>
VK_KEY_O <105>
VK_KEY_P <106>
VK_OEM_4 <107>
VK_OEM_6 <108>
VK_OEM_5 <109>
VK_CAPITAL <55>
VK_KEY_A <53>
VK_KEY_S <52>
VK_KEY_D <51>
VK_KEY_F <50>
VK_KEY_G <49>
VK_KEY_H <48>
VK_KEY_J <112>
VK_KEY_K <113>
VK_KEY_L <114>
VK_OEM_1 <115>
VK_OEM_7 <116>
VK_RETURN <117>
VK_LSHIFT <13>
VK_KEY_Z <36>
VK_KEY_X <35>
VK_KEY_C <34>
VK_KEY_V <33>
VK_KEY_B <32>
VK_KEY_N <128>
VK_KEY_M <120>
VK_OEM_COMMA <121>
VK_OEM_PERIOD <122>
VK_OEM_2 <123>
VK_RSHIFT <12>
VK_LCONTROL <14>
VK_LMENU <11>
VK_SPACE <129>
VK_RMENU <10>
VK_SNAPSHOT <87>
VK_ESCAPE <39>
VK_F1 <84>
VK_F2 <83>
VK_F3 <82>
VK_F4 <81>
VK_APPS <80>
VK_F5 <89>
VK_F6 <90>
VK_F7 <91>
VK_F8 <92>
VK_F9 <45>
VK_F10 <41>
VK_F11 <43>
VK_F12 <47>
VK_HOME <118>
VK_PRIOR <119>
VK_NEXT <127>
VK_SELECT <125>
VK_UP <134>
VK_LEFT <132>
VK_DOWN <133>
VK_RIGHT <135>
VK_DIVIDE <25>
VK_MULTIPLY <29>
VK_ADD <27>
VK_SUBTRACT <31>
VK_NUMPAD7 <21>
VK_NUMPAD8 <17>
VK_NUMPAD9 <19>
VK_RETURN <23>
VK_NUMPAD4 <16>
VK_NUMPAD5 <18>
VK_NUMPAD6 <20>
VK_NUMPAD1 <24>
VK_NUMPAD2 <26>
VK_NUMPAD3 <28>
VK_NUMPAD0 <30>
VK_DECIMAL <44>
};

View File

@ -1,5 +0,0 @@
# This file was generated with xkb.pl (Wed Aug 11 09:09:10 2010)
# and is based on the X Keyboard Configuration Database version 1.9
# Please use xkb.pl to re-export newer versions of XKB

View File

@ -1,142 +0,0 @@
# This file was generated with xkb.pl (Wed Aug 11 09:09:10 2010)
# and is based on the X Keyboard Configuration Database version 1.9
# Please use xkb.pl to re-export newer versions of XKB
keyboard "macintosh"
: extends "xfree86"
{
VK_F13 <182>
VK_F14 <183>
VK_F15 <184>
};
keyboard "old"
{
VK_ESCAPE <61>
VK_OEM_3 <58>
VK_KEY_1 <26>
VK_KEY_2 <27>
VK_KEY_3 <28>
VK_KEY_4 <29>
VK_KEY_5 <31>
VK_KEY_6 <30>
VK_KEY_7 <34>
VK_KEY_8 <36>
VK_KEY_9 <33>
VK_KEY_0 <37>
VK_OEM_MINUS <35>
VK_OEM_PLUS <32>
VK_BACK <59>
VK_TAB <56>
VK_KEY_Q <20>
VK_KEY_W <21>
VK_KEY_E <22>
VK_KEY_R <23>
VK_KEY_T <25>
VK_KEY_Y <24>
VK_KEY_U <40>
VK_KEY_I <42>
VK_KEY_O <39>
VK_KEY_P <43>
VK_OEM_4 <41>
VK_OEM_6 <38>
VK_OEM_5 <50>
VK_CAPITAL <65>
VK_KEY_A <8>
VK_KEY_S <9>
VK_KEY_D <10>
VK_KEY_F <11>
VK_KEY_G <13>
VK_KEY_H <12>
VK_KEY_J <46>
VK_KEY_K <48>
VK_KEY_L <45>
VK_OEM_1 <49>
VK_OEM_7 <47>
VK_RETURN <44>
VK_OEM_102 <18>
VK_KEY_Z <14>
VK_KEY_X <15>
VK_KEY_C <16>
VK_KEY_V <17>
VK_KEY_B <19>
VK_KEY_N <53>
VK_KEY_M <54>
VK_OEM_COMMA <51>
VK_OEM_PERIOD <55>
VK_OEM_2 <52>
VK_SPACE <57>
VK_LCONTROL <62>
VK_LMENU <63>
VK_LSHIFT <64>
VK_RMENU <66>
VK_RSHIFT <131>
VK_RMENU <132>
VK_RCONTROL <133>
VK_F1 <130>
VK_F2 <128>
VK_F3 <107>
VK_F4 <126>
VK_F5 <104>
VK_F6 <105>
VK_F7 <106>
VK_F8 <108>
VK_F9 <109>
VK_F10 <117>
VK_F11 <111>
VK_F12 <119>
VK_SNAPSHOT <113>
VK_SCROLL <115>
VK_PAUSE <121>
VK_INSERT <122>
VK_HOME <123>
VK_PRIOR <124>
VK_DELETE <125>
VK_END <127>
VK_NEXT <129>
VK_UP <70>
VK_LEFT <67>
VK_DOWN <69>
VK_RIGHT <68>
VK_NUMLOCK <79>
VK_DIVIDE <83>
VK_MULTIPLY <75>
VK_NUMPAD7 <97>
VK_NUMPAD8 <99>
VK_NUMPAD9 <100>
VK_SUBTRACT <86>
VK_NUMPAD4 <94>
VK_NUMPAD5 <95>
VK_NUMPAD6 <96>
VK_ADD <77>
VK_NUMPAD1 <91>
VK_NUMPAD2 <92>
VK_NUMPAD3 <93>
VK_RETURN <84>
VK_NUMPAD0 <90>
VK_DECIMAL <73>
};
keyboard "hhk"
: extends "macintosh"
{
VK_OEM_5 <51>
VK_LWIN <49>
VK_RWIN <208>
VK_F13 <111>
VK_F14 <78>
VK_F15 <110>
};
keyboard "alukbd"
: extends "xfree86"
{
VK_F18 <129>
VK_F19 <130>
};
keyboard "jisevdev"
{
};

View File

@ -1,109 +0,0 @@
# This file is manually edited from the "macintosh" keymap
# X11.app is a special case, and xfreerdp on Mac OS X uses this hard-coded keymap instead
keyboard "macosx"
{
VK_ESCAPE <61>
VK_OEM_3 <58>
VK_KEY_1 <26>
VK_KEY_2 <27>
VK_KEY_3 <28>
VK_KEY_4 <29>
VK_KEY_5 <31>
VK_KEY_6 <30>
VK_KEY_7 <34>
VK_KEY_8 <36>
VK_KEY_9 <33>
VK_KEY_0 <37>
VK_OEM_MINUS <35>
VK_OEM_PLUS <32>
VK_BACK <59>
VK_TAB <56>
VK_KEY_Q <20>
VK_KEY_W <21>
VK_KEY_E <22>
VK_KEY_R <23>
VK_KEY_T <25>
VK_KEY_Y <24>
VK_KEY_U <40>
VK_KEY_I <42>
VK_KEY_O <39>
VK_KEY_P <43>
VK_OEM_4 <41>
VK_OEM_6 <38>
VK_OEM_5 <50>
VK_CAPITAL <65>
VK_KEY_A <8>
VK_KEY_S <9>
VK_KEY_D <10>
VK_KEY_F <11>
VK_KEY_G <13>
VK_KEY_H <12>
VK_KEY_J <46>
VK_KEY_K <48>
VK_KEY_L <45>
VK_OEM_1 <49>
VK_OEM_7 <47>
VK_RETURN <44>
VK_OEM_102 <18>
VK_KEY_Z <14>
VK_KEY_X <15>
VK_KEY_C <16>
VK_KEY_V <17>
VK_KEY_B <19>
VK_KEY_N <53>
VK_KEY_M <54>
VK_OEM_COMMA <51>
VK_OEM_PERIOD <55>
VK_OEM_2 <52>
VK_SPACE <57>
VK_LWIN <63>
VK_RWIN <71>
VK_LCONTROL <67>
VK_LMENU <66>
VK_LSHIFT <64>
VK_RMENU <69>
VK_RSHIFT <68>
VK_F1 <130>
VK_F2 <128>
VK_F3 <107>
VK_F4 <126>
VK_F5 <104>
VK_F6 <105>
VK_F7 <106>
VK_F8 <108>
VK_F9 <109>
VK_F10 <117>
VK_F11 <111>
VK_F12 <119>
VK_SNAPSHOT <113>
VK_SCROLL <115>
VK_PAUSE <121>
VK_INSERT <122>
VK_HOME <123>
VK_PRIOR <124>
VK_DELETE <125>
VK_END <127>
VK_NEXT <129>
VK_UP <134>
VK_LEFT <131>
VK_DOWN <133>
VK_RIGHT <132>
VK_NUMLOCK <79>
VK_DIVIDE <83>
VK_MULTIPLY <75>
VK_NUMPAD7 <97>
VK_NUMPAD8 <99>
VK_NUMPAD9 <100>
VK_SUBTRACT <86>
VK_NUMPAD4 <94>
VK_NUMPAD5 <95>
VK_NUMPAD6 <96>
VK_ADD <77>
VK_NUMPAD1 <91>
VK_NUMPAD2 <92>
VK_NUMPAD3 <93>
VK_RETURN <84>
VK_NUMPAD0 <90>
VK_DECIMAL <73>
};

View File

@ -1,116 +0,0 @@
# This file was generated with xkb.pl (Wed Aug 11 09:09:10 2010)
# and is based on the X Keyboard Configuration Database version 1.9
# Please use xkb.pl to re-export newer versions of XKB
keyboard "pc101"
{
VK_OEM_3 <62>
VK_KEY_1 <15>
VK_KEY_2 <21>
VK_KEY_3 <22>
VK_KEY_4 <29>
VK_KEY_5 <30>
VK_KEY_6 <37>
VK_KEY_7 <38>
VK_KEY_8 <45>
VK_KEY_9 <46>
VK_KEY_0 <53>
VK_OEM_MINUS <54>
VK_OEM_PLUS <61>
VK_BACK <68>
VK_TAB <16>
VK_KEY_Q <17>
VK_KEY_W <23>
VK_KEY_E <24>
VK_KEY_R <31>
VK_KEY_T <32>
VK_KEY_Y <39>
VK_KEY_U <40>
VK_KEY_I <47>
VK_KEY_O <48>
VK_KEY_P <55>
VK_OEM_4 <56>
VK_OEM_6 <63>
VK_RETURN <58>
VK_CAPITAL <11>
VK_KEY_A <18>
VK_KEY_S <19>
VK_KEY_D <25>
VK_KEY_F <26>
VK_KEY_G <33>
VK_KEY_H <34>
VK_KEY_J <41>
VK_KEY_K <42>
VK_KEY_L <49>
VK_OEM_1 <50>
VK_OEM_7 <57>
VK_LSHIFT <13>
VK_KEY_Z <27>
VK_KEY_X <28>
VK_KEY_C <35>
VK_KEY_V <36>
VK_KEY_B <43>
VK_KEY_N <44>
VK_KEY_M <51>
VK_OEM_COMMA <52>
VK_OEM_PERIOD <59>
VK_OEM_2 <60>
VK_RSHIFT <12>
VK_OEM_5 <64>
VK_LMENU <91>
VK_LCONTROL <10>
VK_SPACE <90>
VK_RCONTROL <93>
VK_RMENU <92>
VK_ESCAPE <14>
VK_F1 <94>
VK_F2 <95>
VK_F3 <96>
VK_F4 <97>
VK_F5 <98>
VK_F6 <99>
VK_F7 <100>
VK_F8 <101>
VK_F9 <102>
VK_F10 <103>
VK_F11 <104>
VK_F12 <105>
VK_SNAPSHOT <106>
VK_SCROLL <107>
VK_PAUSE <108>
VK_INSERT <109>
VK_HOME <110>
VK_PRIOR <111>
VK_DELETE <69>
VK_END <112>
VK_NEXT <113>
VK_UP <88>
VK_LEFT <80>
VK_DOWN <81>
VK_RIGHT <87>
VK_NUMLOCK <114>
VK_DIVIDE <115>
VK_MULTIPLY <116>
VK_SUBTRACT <83>
VK_NUMPAD7 <74>
VK_NUMPAD8 <75>
VK_NUMPAD9 <82>
VK_ADD <117>
VK_NUMPAD4 <70>
VK_NUMPAD5 <76>
VK_NUMPAD6 <77>
VK_NUMPAD1 <65>
VK_NUMPAD2 <71>
VK_NUMPAD3 <72>
VK_RETURN <89>
VK_NUMPAD0 <66>
VK_DECIMAL <73>
};
keyboard "pc102"
: extends "sgi_vndr/indigo(pc101)"
{
VK_OEM_102 <118>
};

View File

@ -1,148 +0,0 @@
# This file was generated with xkb.pl (Wed Aug 11 09:09:10 2010)
# and is based on the X Keyboard Configuration Database version 1.9
# Please use xkb.pl to re-export newer versions of XKB
keyboard "universal"
{
VK_OEM_5 <91>
VK_OEM_5 <100>
VK_OEM_5 <101>
};
keyboard "pc101"
{
VK_OEM_3 <22>
VK_KEY_1 <30>
VK_KEY_2 <38>
VK_KEY_3 <46>
VK_KEY_4 <45>
VK_KEY_5 <54>
VK_KEY_6 <62>
VK_KEY_7 <69>
VK_KEY_8 <70>
VK_KEY_9 <78>
VK_KEY_0 <77>
VK_OEM_MINUS <86>
VK_OEM_PLUS <93>
VK_BACK <110>
VK_TAB <21>
VK_KEY_Q <29>
VK_KEY_W <37>
VK_KEY_E <44>
VK_KEY_R <53>
VK_KEY_T <52>
VK_KEY_Y <61>
VK_KEY_U <68>
VK_KEY_I <75>
VK_KEY_O <76>
VK_KEY_P <85>
VK_OEM_4 <92>
VK_OEM_6 <99>
VK_RETURN <98>
VK_CAPITAL <28>
VK_KEY_A <36>
VK_KEY_S <35>
VK_KEY_D <43>
VK_KEY_F <51>
VK_KEY_G <60>
VK_KEY_H <59>
VK_KEY_J <67>
VK_KEY_K <74>
VK_KEY_L <83>
VK_OEM_1 <84>
VK_OEM_7 <90>
VK_LSHIFT <26>
VK_KEY_Z <34>
VK_KEY_X <42>
VK_KEY_C <41>
VK_KEY_V <50>
VK_KEY_B <58>
VK_KEY_N <57>
VK_KEY_M <66>
VK_OEM_COMMA <73>
VK_OEM_PERIOD <81>
VK_OEM_2 <82>
VK_RSHIFT <97>
VK_OEM_5 <100>
VK_LMENU <33>
VK_LCONTROL <25>
VK_SPACE <49>
VK_RCONTROL <96>
VK_RMENU <65>
VK_ESCAPE <16>
VK_F1 <15>
VK_F2 <23>
VK_F3 <31>
VK_F4 <39>
VK_F5 <47>
VK_F6 <55>
VK_F7 <63>
VK_F8 <71>
VK_F9 <79>
VK_F10 <87>
VK_F11 <94>
VK_F12 <102>
VK_SNAPSHOT <95>
VK_SCROLL <103>
VK_PAUSE <106>
VK_INSERT <111>
VK_HOME <118>
VK_PRIOR <119>
VK_DELETE <108>
VK_END <109>
VK_NEXT <117>
VK_UP <107>
VK_LEFT <105>
VK_DOWN <104>
VK_RIGHT <114>
VK_NUMLOCK <126>
VK_DIVIDE <127>
VK_MULTIPLY <134>
VK_SUBTRACT <140>
VK_NUMPAD7 <116>
VK_NUMPAD8 <125>
VK_NUMPAD9 <133>
VK_ADD <132>
VK_NUMPAD4 <115>
VK_NUMPAD5 <123>
VK_NUMPAD6 <124>
VK_NUMPAD1 <113>
VK_NUMPAD2 <122>
VK_NUMPAD3 <130>
VK_RETURN <129>
VK_NUMPAD0 <120>
VK_DECIMAL <121>
};
keyboard "pc102"
{
VK_OEM_102 <27>
};
keyboard "pc104"
: extends "sgi_vndr/indy(pc101)"
{
VK_LWIN <147>
VK_RWIN <148>
VK_APPS <149>
};
keyboard "pc105"
{
};
keyboard "jp106"
{
VK_ABNT_C1 <89>
VK_OEM_5 <91>
};
keyboard "overlayKeypad"
{
};
keyboard "shiftLock"
{
};

View File

@ -1,10 +0,0 @@
# This file was generated with xkb.pl (Wed Aug 11 09:09:10 2010)
# and is based on the X Keyboard Configuration Database version 1.9
# Please use xkb.pl to re-export newer versions of XKB
keyboard "iris"
: extends "sgi_vndr/indigo(pc101)"
{
};

View File

@ -1,103 +0,0 @@
# This file was generated with xkb.pl (Wed Aug 11 09:09:10 2010)
# and is based on the X Keyboard Configuration Database version 1.9
# Please use xkb.pl to re-export newer versions of XKB
keyboard "nwp5461"
{
VK_ESCAPE <18>
VK_KEY_1 <19>
VK_KEY_2 <20>
VK_KEY_3 <21>
VK_KEY_4 <22>
VK_KEY_5 <23>
VK_KEY_6 <24>
VK_KEY_7 <25>
VK_KEY_8 <26>
VK_KEY_9 <27>
VK_KEY_0 <28>
VK_OEM_MINUS <29>
VK_OEM_PLUS <30>
VK_OEM_5 <31>
VK_BACK <32>
VK_TAB <33>
VK_KEY_Q <34>
VK_KEY_W <35>
VK_KEY_E <36>
VK_KEY_R <37>
VK_KEY_T <38>
VK_KEY_Y <39>
VK_KEY_U <40>
VK_KEY_I <41>
VK_KEY_O <42>
VK_KEY_P <43>
VK_OEM_4 <44>
VK_OEM_6 <45>
VK_DELETE <46>
VK_LCONTROL <47>
VK_KEY_A <48>
VK_KEY_S <49>
VK_KEY_D <50>
VK_KEY_F <51>
VK_KEY_G <52>
VK_KEY_H <53>
VK_KEY_J <54>
VK_KEY_K <55>
VK_KEY_L <56>
VK_OEM_1 <57>
VK_OEM_7 <58>
VK_OEM_3 <59>
VK_RETURN <60>
VK_LSHIFT <61>
VK_KEY_Z <62>
VK_KEY_X <63>
VK_KEY_C <64>
VK_KEY_V <65>
VK_KEY_B <66>
VK_KEY_N <67>
VK_KEY_M <68>
VK_OEM_COMMA <69>
VK_OEM_PERIOD <70>
VK_OEM_2 <71>
VK_ABNT_C1 <72>
VK_RSHIFT <73>
VK_LMENU <74>
VK_CAPITAL <75>
VK_SPACE <77>
VK_F1 <8>
VK_F2 <9>
VK_F3 <10>
VK_F4 <11>
VK_F5 <12>
VK_F6 <13>
VK_F7 <14>
VK_F8 <15>
VK_F9 <16>
VK_F10 <17>
VK_F11 <111>
VK_F12 <112>
VK_HELP <113>
VK_INSERT <114>
VK_PRIOR <116>
VK_NEXT <117>
VK_UP <95>
VK_LEFT <98>
VK_DOWN <99>
VK_RIGHT <100>
VK_MULTIPLY <107>
VK_DIVIDE <108>
VK_ADD <89>
VK_NUMPAD7 <82>
VK_NUMPAD8 <83>
VK_NUMPAD9 <84>
VK_SUBTRACT <85>
VK_NUMPAD4 <86>
VK_NUMPAD5 <87>
VK_NUMPAD6 <88>
VK_NUMPAD1 <90>
VK_NUMPAD2 <91>
VK_NUMPAD3 <92>
VK_RETURN <97>
VK_NUMPAD0 <94>
};

View File

@ -1,618 +0,0 @@
# This file was generated with xkb.pl (Wed Aug 11 09:09:10 2010)
# and is based on the X Keyboard Configuration Database version 1.9
# Please use xkb.pl to re-export newer versions of XKB
keyboard "type4"
{
VK_ESCAPE <36>
VK_KEY_1 <37>
VK_KEY_2 <38>
VK_KEY_3 <39>
VK_KEY_4 <40>
VK_KEY_5 <41>
VK_KEY_6 <42>
VK_KEY_7 <43>
VK_KEY_8 <44>
VK_KEY_9 <45>
VK_KEY_0 <46>
VK_OEM_MINUS <47>
VK_OEM_PLUS <48>
VK_OEM_3 <49>
VK_BACK <50>
VK_TAB <60>
VK_KEY_Q <61>
VK_KEY_W <62>
VK_KEY_E <63>
VK_KEY_R <64>
VK_KEY_T <65>
VK_KEY_Y <66>
VK_KEY_U <67>
VK_KEY_I <68>
VK_KEY_O <69>
VK_KEY_P <70>
VK_OEM_4 <71>
VK_OEM_6 <72>
VK_DELETE <73>
VK_LCONTROL <83>
VK_KEY_A <84>
VK_KEY_S <85>
VK_KEY_D <86>
VK_KEY_F <87>
VK_KEY_G <88>
VK_KEY_H <89>
VK_KEY_J <90>
VK_KEY_K <91>
VK_KEY_L <92>
VK_OEM_1 <93>
VK_OEM_7 <94>
VK_OEM_5 <95>
VK_RETURN <96>
VK_LSHIFT <106>
VK_KEY_Z <107>
VK_KEY_X <108>
VK_KEY_C <109>
VK_KEY_V <110>
VK_KEY_B <111>
VK_KEY_N <112>
VK_KEY_M <113>
VK_OEM_COMMA <114>
VK_OEM_PERIOD <115>
VK_OEM_2 <116>
VK_RSHIFT <117>
VK_HELP <125>
VK_CAPITAL <126>
VK_LMENU <26>
VK_SPACE <128>
VK_APPS <74>
VK_F1 <12>
VK_F2 <13>
VK_F3 <15>
VK_F4 <17>
VK_F5 <19>
VK_F6 <21>
VK_F7 <23>
VK_F8 <24>
VK_F9 <25>
VK_F10 <14>
VK_F11 <16>
VK_F12 <18>
VK_SNAPSHOT <29>
VK_SCROLL <30>
VK_PAUSE <28>
VK_NUMLOCK <105>
VK_DIVIDE <53>
VK_MULTIPLY <54>
VK_SUBTRACT <78>
VK_NUMPAD7 <75>
VK_NUMPAD8 <76>
VK_NUMPAD9 <77>
VK_ADD <132>
VK_NUMPAD4 <98>
VK_NUMPAD5 <99>
VK_NUMPAD6 <100>
VK_NUMPAD1 <119>
VK_NUMPAD2 <120>
VK_NUMPAD3 <121>
VK_RETURN <97>
VK_NUMPAD0 <101>
VK_DECIMAL <57>
};
keyboard "type5"
{
VK_ESCAPE <36>
VK_KEY_1 <37>
VK_KEY_2 <38>
VK_KEY_3 <39>
VK_KEY_4 <40>
VK_KEY_5 <41>
VK_KEY_6 <42>
VK_KEY_7 <43>
VK_KEY_8 <44>
VK_KEY_9 <45>
VK_KEY_0 <46>
VK_OEM_MINUS <47>
VK_OEM_PLUS <48>
VK_OEM_3 <49>
VK_BACK <50>
VK_TAB <60>
VK_KEY_Q <61>
VK_KEY_W <62>
VK_KEY_E <63>
VK_KEY_R <64>
VK_KEY_T <65>
VK_KEY_Y <66>
VK_KEY_U <67>
VK_KEY_I <68>
VK_KEY_O <69>
VK_KEY_P <70>
VK_OEM_4 <71>
VK_OEM_6 <72>
VK_DELETE <73>
VK_APPS <74>
VK_LCONTROL <83>
VK_KEY_A <84>
VK_KEY_S <85>
VK_KEY_D <86>
VK_KEY_F <87>
VK_KEY_G <88>
VK_KEY_H <89>
VK_KEY_J <90>
VK_KEY_K <91>
VK_KEY_L <92>
VK_OEM_1 <93>
VK_OEM_7 <94>
VK_OEM_5 <95>
VK_RETURN <96>
VK_LSHIFT <106>
VK_KEY_Z <107>
VK_KEY_X <108>
VK_KEY_C <109>
VK_KEY_V <110>
VK_KEY_B <111>
VK_KEY_N <112>
VK_KEY_M <113>
VK_OEM_COMMA <114>
VK_OEM_PERIOD <115>
VK_OEM_2 <116>
VK_RSHIFT <117>
VK_LMENU <26>
VK_CAPITAL <126>
VK_SPACE <128>
VK_F1 <12>
VK_F2 <13>
VK_F3 <15>
VK_F4 <17>
VK_F5 <19>
VK_F6 <21>
VK_F7 <23>
VK_F8 <24>
VK_F9 <25>
VK_F10 <14>
VK_F11 <16>
VK_F12 <18>
VK_SNAPSHOT <29>
VK_SCROLL <30>
VK_PAUSE <28>
VK_NUMLOCK <105>
VK_DIVIDE <53>
VK_MULTIPLY <54>
VK_SUBTRACT <78>
VK_NUMPAD7 <75>
VK_NUMPAD8 <76>
VK_NUMPAD9 <77>
VK_ADD <132>
VK_NUMPAD4 <98>
VK_NUMPAD5 <99>
VK_NUMPAD6 <100>
VK_NUMPAD1 <119>
VK_NUMPAD2 <120>
VK_NUMPAD3 <121>
VK_RETURN <97>
VK_NUMPAD0 <101>
VK_DECIMAL <57>
VK_UP <27>
VK_LEFT <31>
VK_DOWN <34>
VK_RIGHT <35>
VK_INSERT <51>
VK_HOME <59>
VK_END <81>
VK_PRIOR <103>
VK_NEXT <130>
VK_HELP <125>
};
keyboard "type4tuv"
: extends "sun(type4)"
{
VK_OEM_102 <131>
};
keyboard "type4_ca"
: extends "sun(type4)"
{
VK_OEM_102 <131>
};
keyboard "type4_jp"
: extends "sun(type4)"
{
VK_KANJI <123>
};
keyboard "type4_euro"
: extends "sun(type4)"
{
VK_OEM_102 <131>
};
keyboard "type5tuv"
: extends "sun(type5)"
{
VK_OEM_102 <131>
};
keyboard "type5_jp"
: extends "sun(type5)"
{
VK_KANJI <123>
};
keyboard "type5_euro"
: extends "sun(type5)"
{
VK_OEM_102 <131>
};
keyboard "type5hobo"
{
VK_ESCAPE <36>
VK_KEY_1 <37>
VK_KEY_2 <38>
VK_KEY_3 <39>
VK_KEY_4 <40>
VK_KEY_5 <41>
VK_KEY_6 <42>
VK_KEY_7 <43>
VK_KEY_8 <44>
VK_KEY_9 <45>
VK_KEY_0 <46>
VK_OEM_MINUS <47>
VK_OEM_PLUS <48>
VK_OEM_3 <49>
VK_BACK <50>
VK_TAB <60>
VK_KEY_Q <61>
VK_KEY_W <62>
VK_KEY_E <63>
VK_KEY_R <64>
VK_KEY_T <65>
VK_KEY_Y <66>
VK_KEY_U <67>
VK_KEY_I <68>
VK_KEY_O <69>
VK_KEY_P <70>
VK_OEM_4 <71>
VK_OEM_6 <72>
VK_DELETE <73>
VK_APPS <74>
VK_LCONTROL <83>
VK_KEY_A <84>
VK_KEY_S <85>
VK_KEY_D <86>
VK_KEY_F <87>
VK_KEY_G <88>
VK_KEY_H <89>
VK_KEY_J <90>
VK_KEY_K <91>
VK_KEY_L <92>
VK_OEM_1 <93>
VK_OEM_7 <94>
VK_OEM_5 <95>
VK_RETURN <96>
VK_LSHIFT <106>
VK_KEY_Z <107>
VK_KEY_X <108>
VK_KEY_C <109>
VK_KEY_V <110>
VK_KEY_B <111>
VK_KEY_N <112>
VK_KEY_M <113>
VK_OEM_COMMA <114>
VK_OEM_PERIOD <115>
VK_OEM_2 <116>
VK_RSHIFT <117>
VK_LMENU <26>
VK_CAPITAL <126>
VK_SPACE <128>
VK_F1 <12>
VK_F2 <13>
VK_F3 <15>
VK_F4 <17>
VK_F5 <19>
VK_F6 <21>
VK_F7 <23>
VK_F8 <24>
VK_F9 <25>
VK_F10 <14>
VK_F11 <16>
VK_F12 <18>
VK_SNAPSHOT <29>
VK_SCROLL <30>
VK_PAUSE <28>
VK_NUMLOCK <105>
VK_DIVIDE <53>
VK_MULTIPLY <54>
VK_SUBTRACT <78>
VK_NUMPAD7 <75>
VK_NUMPAD8 <76>
VK_NUMPAD9 <77>
VK_ADD <132>
VK_NUMPAD4 <98>
VK_NUMPAD5 <99>
VK_NUMPAD6 <100>
VK_NUMPAD1 <119>
VK_NUMPAD2 <120>
VK_NUMPAD3 <121>
VK_RETURN <97>
VK_NUMPAD0 <101>
VK_DECIMAL <57>
VK_UP <27>
VK_LEFT <31>
VK_DOWN <34>
VK_RIGHT <35>
VK_INSERT <51>
VK_HOME <59>
VK_END <81>
VK_PRIOR <103>
VK_NEXT <130>
VK_HELP <125>
};
keyboard "type5tuvhobo"
: extends "sun(type5hobo)"
{
VK_OEM_102 <131>
};
keyboard "type5_jphobo"
: extends "sun(type5hobo)"
{
VK_KANJI <123>
};
keyboard "type6"
: extends "sun(type5)"
{
};
keyboard "type6tuv"
: extends "sun(type5tuv)"
{
};
keyboard "type6unix"
: extends "sun(type5)"
{
};
keyboard "type6_jp"
: extends "sun(type5_jp)"
{
};
keyboard "type6_euro"
: extends "sun(type5_euro)"
{
};
keyboard "type6_usb"
: extends "xfree86"
{
VK_HELP <245>
};
keyboard "type6tuv_usb"
: extends "sun(type6_usb)"
{
VK_OEM_102 <94>
VK_OEM_5 <51>
};
keyboard "type6_jp_usb"
: extends "sun(type6_usb)"
{
};
keyboard "type5_se"
{
VK_HELP <125>
VK_ESCAPE <36>
VK_F1 <12>
VK_F2 <13>
VK_F3 <15>
VK_F4 <17>
VK_F5 <19>
VK_F6 <21>
VK_F7 <23>
VK_F8 <24>
VK_F9 <25>
VK_F10 <14>
VK_F11 <16>
VK_F12 <18>
VK_SNAPSHOT <29>
VK_SCROLL <30>
VK_PAUSE <28>
VK_TILDE <49>
VK_KEY_1 <37>
VK_KEY_2 <38>
VK_KEY_3 <39>
VK_KEY_4 <40>
VK_KEY_5 <41>
VK_KEY_6 <42>
VK_KEY_7 <43>
VK_KEY_8 <44>
VK_KEY_9 <45>
VK_KEY_0 <46>
VK_OEM_MINUS <47>
VK_OEM_PLUS <48>
VK_BACK <50>
VK_INSERT <51>
VK_HOME <59>
VK_PRIOR <103>
VK_NUMLOCK <105>
VK_DIVIDE <53>
VK_MULTIPLY <54>
VK_SUBTRACT <78>
VK_KEY_Q <61>
VK_KEY_W <62>
VK_KEY_E <63>
VK_KEY_R <64>
VK_KEY_T <65>
VK_KEY_Y <66>
VK_KEY_U <67>
VK_KEY_I <68>
VK_KEY_O <69>
VK_KEY_P <70>
VK_OEM_4 <71>
VK_OEM_6 <72>
VK_DELETE <73>
VK_END <81>
VK_NEXT <130>
VK_NUMPAD7 <75>
VK_NUMPAD8 <76>
VK_NUMPAD9 <77>
VK_ADD <132>
VK_KEY_A <84>
VK_KEY_S <85>
VK_KEY_D <86>
VK_KEY_F <87>
VK_KEY_G <88>
VK_KEY_H <89>
VK_KEY_J <90>
VK_KEY_K <91>
VK_KEY_L <92>
VK_OEM_1 <93>
VK_OEM_7 <94>
VK_OEM_5 <95>
VK_RETURN <96>
VK_NUMPAD4 <98>
VK_NUMPAD5 <99>
VK_NUMPAD6 <100>
VK_LSHIFT <106>
VK_LSHIFT <131>
VK_KEY_Z <107>
VK_KEY_X <108>
VK_KEY_C <109>
VK_KEY_V <110>
VK_KEY_B <111>
VK_KEY_N <112>
VK_KEY_M <113>
VK_OEM_COMMA <114>
VK_OEM_PERIOD <115>
VK_OEM_2 <116>
VK_RSHIFT <117>
VK_UP <27>
VK_NUMPAD1 <119>
VK_NUMPAD2 <120>
VK_NUMPAD3 <121>
VK_RETURN <97>
VK_LCONTROL <83>
VK_LMENU <26>
VK_SPACE <128>
VK_APPS <74>
VK_LEFT <31>
VK_DOWN <34>
VK_RIGHT <35>
VK_NUMPAD0 <101>
VK_DECIMAL <57>
};
keyboard "type5c_se"
: extends "sun(type5_se)"
{
};
keyboard "type4__se"
{
VK_F1 <12>
VK_F2 <13>
VK_F3 <15>
VK_F4 <17>
VK_F5 <19>
VK_F6 <21>
VK_F7 <23>
VK_F8 <24>
VK_F9 <25>
VK_F10 <14>
VK_F11 <16>
VK_F12 <18>
VK_DELETE <73>
VK_PAUSE <28>
VK_SNAPSHOT <29>
VK_SCROLL <30>
VK_NUMLOCK <105>
VK_TILDE <36>
VK_KEY_1 <37>
VK_KEY_2 <38>
VK_KEY_3 <39>
VK_KEY_4 <40>
VK_KEY_5 <41>
VK_KEY_6 <42>
VK_KEY_7 <43>
VK_KEY_8 <44>
VK_KEY_9 <45>
VK_KEY_0 <46>
VK_OEM_MINUS <47>
VK_OEM_PLUS <48>
VK_BACK <50>
VK_DIVIDE <53>
VK_MULTIPLY <54>
VK_SUBTRACT <78>
VK_KEY_Q <61>
VK_KEY_W <62>
VK_KEY_E <63>
VK_KEY_R <64>
VK_KEY_T <65>
VK_KEY_Y <66>
VK_KEY_U <67>
VK_KEY_I <68>
VK_KEY_O <69>
VK_KEY_P <70>
VK_OEM_4 <71>
VK_OEM_6 <72>
VK_NUMPAD7 <75>
VK_NUMPAD8 <76>
VK_NUMPAD9 <77>
VK_ADD <132>
VK_KEY_A <84>
VK_KEY_S <85>
VK_KEY_D <86>
VK_KEY_F <87>
VK_KEY_G <88>
VK_KEY_H <89>
VK_KEY_J <90>
VK_KEY_K <91>
VK_KEY_L <92>
VK_OEM_1 <93>
VK_OEM_7 <94>
VK_OEM_5 <49>
VK_RETURN <96>
VK_NUMPAD4 <98>
VK_NUMPAD5 <99>
VK_NUMPAD6 <100>
VK_LSHIFT <106>
VK_LSHIFT <131>
VK_KEY_Z <107>
VK_KEY_X <108>
VK_KEY_C <109>
VK_KEY_V <110>
VK_KEY_B <111>
VK_KEY_N <112>
VK_KEY_M <113>
VK_OEM_COMMA <114>
VK_OEM_PERIOD <115>
VK_OEM_2 <116>
VK_RSHIFT <117>
VK_NUMPAD1 <119>
VK_NUMPAD2 <120>
VK_NUMPAD3 <121>
VK_RETURN <97>
VK_HELP <125>
VK_LMENU <26>
VK_SPACE <128>
VK_APPS <74>
VK_NUMPAD0 <101>
VK_DECIMAL <57>
};
keyboard "type4_se"
{
};
keyboard "type4_se_swapctl"
{
};

View File

@ -1,152 +0,0 @@
# This file was generated with xkb.pl (Wed Aug 11 09:09:10 2010)
# and is based on the X Keyboard Configuration Database version 1.9
# Please use xkb.pl to re-export newer versions of XKB
keyboard "xfree86"
: extends "xfree86(basic)"
{
VK_OEM_5 <51>
VK_OEM_102 <94>
};
keyboard "basic"
{
VK_OEM_3 <49>
VK_KEY_1 <10>
VK_KEY_2 <11>
VK_KEY_3 <12>
VK_KEY_4 <13>
VK_KEY_5 <14>
VK_KEY_6 <15>
VK_KEY_7 <16>
VK_KEY_8 <17>
VK_KEY_9 <18>
VK_KEY_0 <19>
VK_OEM_MINUS <20>
VK_OEM_PLUS <21>
VK_BACK <22>
VK_TAB <23>
VK_KEY_Q <24>
VK_KEY_W <25>
VK_KEY_E <26>
VK_KEY_R <27>
VK_KEY_T <28>
VK_KEY_Y <29>
VK_KEY_U <30>
VK_KEY_I <31>
VK_KEY_O <32>
VK_KEY_P <33>
VK_OEM_4 <34>
VK_OEM_6 <35>
VK_RETURN <36>
VK_CAPITAL <66>
VK_KEY_A <38>
VK_KEY_S <39>
VK_KEY_D <40>
VK_KEY_F <41>
VK_KEY_G <42>
VK_KEY_H <43>
VK_KEY_J <44>
VK_KEY_K <45>
VK_KEY_L <46>
VK_OEM_1 <47>
VK_OEM_7 <48>
VK_LSHIFT <50>
VK_KEY_Z <52>
VK_KEY_X <53>
VK_KEY_C <54>
VK_KEY_V <55>
VK_KEY_B <56>
VK_KEY_N <57>
VK_KEY_M <58>
VK_OEM_COMMA <59>
VK_OEM_PERIOD <60>
VK_OEM_2 <61>
VK_RSHIFT <62>
VK_LMENU <64>
VK_LCONTROL <37>
VK_SPACE <65>
VK_RCONTROL <109>
VK_RMENU <113>
VK_LWIN <115>
VK_RWIN <116>
VK_APPS <117>
VK_ESCAPE <9>
VK_F1 <67>
VK_F2 <68>
VK_F3 <69>
VK_F4 <70>
VK_F5 <71>
VK_F6 <72>
VK_F7 <73>
VK_F8 <74>
VK_F9 <75>
VK_F10 <76>
VK_F11 <95>
VK_F12 <96>
VK_SNAPSHOT <111>
VK_SCROLL <78>
VK_PAUSE <110>
VK_INSERT <106>
VK_HOME <97>
VK_PRIOR <99>
VK_DELETE <107>
VK_END <103>
VK_NEXT <105>
VK_UP <98>
VK_LEFT <100>
VK_DOWN <104>
VK_RIGHT <102>
VK_NUMLOCK <77>
VK_DIVIDE <112>
VK_MULTIPLY <63>
VK_SUBTRACT <82>
VK_NUMPAD7 <79>
VK_NUMPAD8 <80>
VK_NUMPAD9 <81>
VK_ADD <86>
VK_NUMPAD4 <83>
VK_NUMPAD5 <84>
VK_NUMPAD6 <85>
VK_NUMPAD1 <87>
VK_NUMPAD2 <88>
VK_NUMPAD3 <89>
VK_RETURN <108>
VK_NUMPAD0 <90>
VK_DECIMAL <91>
VK_F13 <118>
VK_F14 <119>
VK_F15 <120>
VK_F16 <121>
VK_F17 <122>
VK_ABNT_C1 <211>
};
keyboard "102"
: extends "xfree86(xfree86)"
{
VK_RMENU <122>
VK_RCONTROL <123>
VK_SNAPSHOT <121>
VK_PAUSE <118>
VK_INSERT <131>
VK_HOME <135>
VK_PRIOR <119>
VK_DELETE <129>
VK_END <130>
VK_NEXT <134>
VK_UP <128>
VK_LEFT <132>
VK_DOWN <120>
VK_RIGHT <133>
VK_DIVIDE <125>
VK_RETURN <124>
};
keyboard "thinkpadz60"
: extends "xfree86(xfree86)"
{
VK_APPS <227>
};

View File

@ -1,106 +0,0 @@
# This file was generated with xkb.pl (Wed Aug 11 09:09:10 2010)
# and is based on the X Keyboard Configuration Database version 1.9
# Please use xkb.pl to re-export newer versions of XKB
keyboard "pc98"
{
VK_ESCAPE <8>
VK_KEY_1 <9>
VK_KEY_2 <10>
VK_KEY_3 <11>
VK_KEY_4 <12>
VK_KEY_5 <13>
VK_KEY_6 <14>
VK_KEY_7 <15>
VK_KEY_8 <16>
VK_KEY_9 <17>
VK_KEY_0 <18>
VK_OEM_MINUS <19>
VK_OEM_PLUS <20>
VK_OEM_5 <21>
VK_BACK <22>
VK_TAB <23>
VK_KEY_Q <24>
VK_KEY_W <25>
VK_KEY_E <26>
VK_KEY_R <27>
VK_KEY_T <28>
VK_KEY_Y <29>
VK_KEY_U <30>
VK_KEY_I <31>
VK_KEY_O <32>
VK_KEY_P <33>
VK_OEM_4 <34>
VK_OEM_6 <35>
VK_RETURN <36>
VK_LCONTROL <124>
VK_CAPITAL <121>
VK_KEY_A <37>
VK_KEY_S <38>
VK_KEY_D <39>
VK_KEY_F <40>
VK_KEY_G <41>
VK_KEY_H <42>
VK_KEY_J <43>
VK_KEY_K <44>
VK_KEY_L <45>
VK_OEM_1 <46>
VK_OEM_7 <47>
VK_OEM_5 <48>
VK_LSHIFT <120>
VK_KEY_Z <49>
VK_KEY_X <50>
VK_KEY_C <51>
VK_KEY_V <52>
VK_KEY_B <53>
VK_KEY_N <54>
VK_KEY_M <55>
VK_OEM_COMMA <56>
VK_OEM_PERIOD <57>
VK_OEM_2 <58>
VK_ABNT_C1 <59>
VK_LMENU <123>
VK_SPACE <60>
VK_SNAPSHOT <105>
VK_F1 <106>
VK_F2 <107>
VK_F3 <108>
VK_F4 <109>
VK_F5 <110>
VK_F6 <111>
VK_F7 <112>
VK_F8 <113>
VK_F9 <114>
VK_F10 <115>
VK_F11 <90>
VK_F12 <91>
VK_F13 <92>
VK_F14 <93>
VK_F15 <94>
VK_INSERT <64>
VK_DELETE <65>
VK_PRIOR <63>
VK_NEXT <62>
VK_UP <66>
VK_LEFT <67>
VK_RIGHT <68>
VK_DOWN <69>
VK_HOME <70>
VK_HELP <71>
VK_SUBTRACT <72>
VK_DIVIDE <73>
VK_NUMPAD7 <74>
VK_NUMPAD8 <75>
VK_NUMPAD9 <76>
VK_MULTIPLY <77>
VK_NUMPAD4 <78>
VK_NUMPAD5 <79>
VK_NUMPAD6 <80>
VK_ADD <81>
VK_NUMPAD1 <82>
VK_NUMPAD2 <83>
VK_NUMPAD3 <84>
VK_NUMPAD0 <86>
};

View File

@ -147,9 +147,4 @@ endif()
set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "FreeRDP/libfreerdp")
if(BUILD_TESTING)
if(CMOCKERY_FOUND)
add_subdirectory(test)
endif()
endif()

View File

@ -1,2 +0,0 @@
TestCore
TestCore.c

View File

@ -1,40 +0,0 @@
set(MODULE_NAME "TestCore")
set(MODULE_PREFIX "TEST_CORE")
set(${MODULE_PREFIX}_DRIVER ${MODULE_NAME}.c)
set(${MODULE_PREFIX}_TESTS
TestCoreRts.c)
create_test_sourcelist(${MODULE_PREFIX}_SRCS
${${MODULE_PREFIX}_DRIVER}
${${MODULE_PREFIX}_TESTS})
include_directories(..)
add_executable(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS})
set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} ${CMOCKERY_LIBRARIES})
set_complex_link_libraries(VARIABLE ${MODULE_PREFIX}_LIBS
MONOLITHIC ${MONOLITHIC_BUILD}
MODULE freerdp
MODULES freerdp-core)
set_complex_link_libraries(VARIABLE ${MODULE_PREFIX}_LIBS
MONOLITHIC ${MONOLITHIC_BUILD}
MODULE winpr
MODULES winpr-crt winpr-utils)
target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS})
set_target_properties(${MODULE_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${TESTING_OUTPUT_DIRECTORY}")
foreach(test ${${MODULE_PREFIX}_TESTS})
get_filename_component(TestName ${test} NAME_WE)
add_test(${TestName} ${TESTING_OUTPUT_DIRECTORY}/${MODULE_NAME} ${TestName})
endforeach()
set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "WinPR/Test")

View File

@ -1,66 +0,0 @@
#include <stdarg.h>
#include <stddef.h>
#include <setjmp.h>
#include <google/cmockery.h>
#include <winpr/crt.h>
#include <winpr/winpr.h>
#include <winpr/print.h>
#include <freerdp/freerdp.h>
#include "gateway/rts.h"
/* mocks */
extern void rts_generate_cookie(BYTE* cookie);
extern int rpc_in_write(rdpRpc* rpc, BYTE* data, int length);
extern int rpc_out_write(rdpRpc* rpc, BYTE* data, int length);
BYTE testCookie[16] = "\xCC\xCC\xCC\xCC\xCC\xCC\xCC\xCC\xCC\xCC\xCC\xCC\xCC\xCC\xCC\xCC";
void rts_generate_cookie(BYTE* cookie)
{
CopyMemory(cookie, testCookie, 16);
}
int rpc_in_write(rdpRpc* rpc, BYTE* data, int length)
{
printf("rpc_in_write: %d\n", length);
//winpr_HexDump(data, length);
return length;
}
int rpc_out_write(rdpRpc* rpc, BYTE* data, int length)
{
printf("rpc_out_write: %d\n", length);
//winpr_HexDump(data, length);
return length;
}
/* tests */
void test_rts_generate_cookie(void **state)
{
BYTE cookie[16];
rts_generate_cookie(cookie);
assert_memory_equal(cookie, testCookie, 16);
}
void test_rpc_in_write(void **state)
{
int status;
status = rpc_in_write(NULL, NULL, 64);
assert_int_equal(status, 64);
}
int TestCoreRts(int argc, char* argv[])
{
const UnitTest tests[] =
{
unit_test(test_rts_generate_cookie),
unit_test(test_rpc_in_write),
};
return run_tests(tests);
}

View File

@ -19,7 +19,6 @@ set(MODULE_NAME "freerdp-locale")
set(MODULE_PREFIX "FREERDP_LOCALE")
set(${MODULE_PREFIX}_SRCS
virtual_key_codes.c
keyboard_layout.c
keyboard.c
locale.c
@ -27,15 +26,11 @@ set(${MODULE_PREFIX}_SRCS
liblocale.h)
set(${MODULE_PREFIX}_X11_SRCS
keyboard_x11.c
keyboard_x11.h
xkb_layout_ids.c
xkb_layout_ids.h)
set(${MODULE_PREFIX}_X11_KEYMAP_SRCS
keyboard_keymap.c
keyboard_keymap.h
keyboard_x11.c
keyboard_x11.h)
set(${MODULE_PREFIX}_XKBFILE_SRCS
keyboard_xkbfile.c
keyboard_xkbfile.h)
@ -89,7 +84,7 @@ set_complex_link_libraries(VARIABLE ${MODULE_PREFIX}_LIBS
set_complex_link_libraries(VARIABLE ${MODULE_PREFIX}_LIBS
MONOLITHIC ${MONOLITHIC_BUILD}
MODULE winpr
MODULES winpr-crt)
MODULES winpr-input winpr-crt)
if(MONOLITHIC_BUILD)
set(FREERDP_LIBS ${FREERDP_LIBS} ${${MODULE_PREFIX}_LIBS} PARENT_SCOPE)

View File

@ -30,10 +30,10 @@
#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
@ -42,73 +42,106 @@
#endif
UINT32 RDP_SCANCODE_TO_X11_KEYCODE[256][2];
RDP_SCANCODE X11_KEYCODE_TO_RDP_SCANCODE[256];
DWORD VIRTUAL_SCANCODE_TO_X11_KEYCODE[256][2];
DWORD X11_KEYCODE_TO_VIRTUAL_SCANCODE[256];
extern const RDP_SCANCODE VIRTUAL_KEY_CODE_TO_DEFAULT_RDP_SCANCODE_TABLE[256];
UINT32 freerdp_detect_keyboard(UINT32 keyboardLayoutID)
int freerdp_detect_keyboard(DWORD* keyboardLayoutId)
{
if (keyboardLayoutID != 0)
DEBUG_KBD("keyboard layout configuration: %X", keyboardLayoutID);
if (*keyboardLayoutId == 0)
freerdp_detect_keyboard_layout_from_xkb(keyboardLayoutId);
if (keyboardLayoutID == 0)
{
keyboardLayoutID = freerdp_detect_keyboard_layout_from_system_locale();
DEBUG_KBD("detect_keyboard_layout_from_locale: %X", keyboardLayoutID);
}
if (*keyboardLayoutId == 0)
freerdp_detect_keyboard_layout_from_system_locale(keyboardLayoutId);
if (keyboardLayoutID == 0)
{
keyboardLayoutID = 0x0409;
DEBUG_KBD("using default keyboard layout: %X", keyboardLayoutID);
}
if (*keyboardLayoutId == 0)
*keyboardLayoutId = ENGLISH_UNITED_STATES;
return keyboardLayoutID;
return 0;
}
UINT32 freerdp_keyboard_init(UINT32 keyboardLayoutId)
int freerdp_keyboard_init_apple(DWORD* keyboardLayoutId, DWORD x11_keycode_to_rdp_scancode[256])
{
UINT32 keycode;
DWORD vkcode;
DWORD keycode;
DWORD keycode_to_vkcode[256];
ZeroMemory(keycode_to_vkcode, sizeof(keycode_to_vkcode));
for (keycode = 0; keycode < 256; keycode++)
{
vkcode = keycode_to_vkcode[keycode] = GetVirtualKeyCodeFromKeycode(keycode, KEYCODE_TYPE_APPLE);
x11_keycode_to_rdp_scancode[keycode] = GetVirtualScanCodeFromVirtualKeyCode(vkcode, 4);
}
return 0;
}
int freerdp_keyboard_init_x11_evdev(DWORD* keyboardLayoutId, DWORD x11_keycode_to_rdp_scancode[256])
{
DWORD vkcode;
DWORD keycode;
DWORD keycode_to_vkcode[256];
ZeroMemory(keycode_to_vkcode, sizeof(keycode_to_vkcode));
for (keycode = 0; keycode < 256; keycode++)
{
vkcode = keycode_to_vkcode[keycode] = GetVirtualKeyCodeFromKeycode(keycode, KEYCODE_TYPE_EVDEV);
x11_keycode_to_rdp_scancode[keycode] = GetVirtualScanCodeFromVirtualKeyCode(vkcode, 4);
}
return 0;
}
DWORD freerdp_keyboard_init(DWORD keyboardLayoutId)
{
DWORD keycode;
int status = -1;
#ifdef __APPLE__
if (status < 0)
status = freerdp_keyboard_init_apple(&keyboardLayoutId, X11_KEYCODE_TO_VIRTUAL_SCANCODE);
#endif
#ifdef WITH_X11
#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);
if (status < 0)
status = freerdp_keyboard_init_xkbfile(&keyboardLayoutId, X11_KEYCODE_TO_VIRTUAL_SCANCODE);
#endif
#endif
keyboardLayoutId = freerdp_detect_keyboard(keyboardLayoutId);
if (status < 0)
status = freerdp_keyboard_init_x11_evdev(&keyboardLayoutId, X11_KEYCODE_TO_VIRTUAL_SCANCODE);
memset(RDP_SCANCODE_TO_X11_KEYCODE, 0, sizeof(RDP_SCANCODE_TO_X11_KEYCODE));
for (keycode=0; keycode < ARRAYSIZE(RDP_SCANCODE_TO_X11_KEYCODE); keycode++)
RDP_SCANCODE_TO_X11_KEYCODE
[RDP_SCANCODE_CODE(X11_KEYCODE_TO_RDP_SCANCODE[keycode])]
[RDP_SCANCODE_EXTENDED(X11_KEYCODE_TO_RDP_SCANCODE[keycode]) ? 1 : 0] = keycode;
#endif
freerdp_detect_keyboard(&keyboardLayoutId);
ZeroMemory(VIRTUAL_SCANCODE_TO_X11_KEYCODE, sizeof(VIRTUAL_SCANCODE_TO_X11_KEYCODE));
for (keycode = 0; keycode < ARRAYSIZE(VIRTUAL_SCANCODE_TO_X11_KEYCODE); keycode++)
{
VIRTUAL_SCANCODE_TO_X11_KEYCODE
[RDP_SCANCODE_CODE(X11_KEYCODE_TO_VIRTUAL_SCANCODE[keycode])]
[RDP_SCANCODE_EXTENDED(X11_KEYCODE_TO_VIRTUAL_SCANCODE[keycode]) ? 1 : 0] = keycode;
}
return keyboardLayoutId;
}
RDP_SCANCODE freerdp_keyboard_get_rdp_scancode_from_x11_keycode(UINT32 keycode)
DWORD freerdp_keyboard_get_rdp_scancode_from_x11_keycode(DWORD keycode)
{
DEBUG_KBD("x11 keycode: %02X -> rdp code: %02X%s", keycode,
RDP_SCANCODE_CODE(X11_KEYCODE_TO_RDP_SCANCODE[keycode]),
RDP_SCANCODE_EXTENDED(X11_KEYCODE_TO_RDP_SCANCODE[keycode]) ? " extended" : "");
RDP_SCANCODE_CODE(X11_KEYCODE_TO_VIRTUAL_SCANCODE[keycode]),
RDP_SCANCODE_EXTENDED(X11_KEYCODE_TO_VIRTUAL_SCANCODE[keycode]) ? " extended" : "");
return X11_KEYCODE_TO_RDP_SCANCODE[keycode];
return X11_KEYCODE_TO_VIRTUAL_SCANCODE[keycode];
}
UINT32 freerdp_keyboard_get_x11_keycode_from_rdp_scancode(UINT32 scancode, BOOL extended)
DWORD freerdp_keyboard_get_x11_keycode_from_rdp_scancode(DWORD scancode, BOOL extended)
{
if (extended)
return RDP_SCANCODE_TO_X11_KEYCODE[scancode][1];
return VIRTUAL_SCANCODE_TO_X11_KEYCODE[scancode][1];
else
return RDP_SCANCODE_TO_X11_KEYCODE[scancode][0];
}
RDP_SCANCODE freerdp_keyboard_get_rdp_scancode_from_virtual_key_code(UINT32 vkcode)
{
return VIRTUAL_KEY_CODE_TO_DEFAULT_RDP_SCANCODE_TABLE[vkcode];
return VIRTUAL_SCANCODE_TO_X11_KEYCODE[scancode][0];
}

View File

@ -1,212 +0,0 @@
/**
* 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.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "keyboard_keymap.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <winpr/crt.h>
#include <freerdp/utils/file.h>
#include <freerdp/locale/vkcodes.h>
#include <freerdp/locale/keyboard.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;
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] = "";
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);
free(keymap_path);
return 0;
}
free(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 > 255)
break;
/* Load this key mapping in the keyboard mapping */
vkcode = freerdp_keyboard_get_virtual_key_code_from_name(vkcode_name);
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;
ZeroMemory(keycode_to_vkcode, sizeof(UINT32) * 256);
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

@ -1,28 +0,0 @@
/**
* 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

@ -128,8 +128,8 @@ static const RDP_KEYBOARD_LAYOUT RDP_KEYBOARD_LAYOUT_TABLE[] =
struct _RDP_KEYBOARD_LAYOUT_VARIANT
{
UINT32 code; /* Keyboard layout code */
UINT32 id; /* Keyboard variant ID */
DWORD code; /* Keyboard layout code */
DWORD id; /* Keyboard variant ID */
const char* name; /* Keyboard layout variant name */
};
typedef struct _RDP_KEYBOARD_LAYOUT_VARIANT RDP_KEYBOARD_LAYOUT_VARIANT;
@ -185,7 +185,7 @@ static const RDP_KEYBOARD_LAYOUT_VARIANT RDP_KEYBOARD_LAYOUT_VARIANT_TABLE[] =
struct _RDP_KEYBOARD_IME
{
UINT32 code; /* Keyboard layout code */
DWORD code; /* Keyboard layout code */
const char* file; /* IME file */
const char* name; /* Keyboard layout name */
};
@ -214,270 +214,7 @@ static const RDP_KEYBOARD_IME RDP_KEYBOARD_IME_TABLE[] =
{ KBD_CHINESE_TRADITIONAL_ALPHANUMERIC, "romanime.ime", "Chinese (Traditional) - Alphanumeric" }
};
/* the index in this table is the virtual key code */
const RDP_SCANCODE VIRTUAL_KEY_CODE_TO_DEFAULT_RDP_SCANCODE_TABLE[256] =
{
RDP_SCANCODE_UNKNOWN,
RDP_SCANCODE_UNKNOWN, /* VK_LBUTTON */
RDP_SCANCODE_UNKNOWN, /* VK_RBUTTON */
RDP_SCANCODE_UNKNOWN, /* VK_CANCEL */
RDP_SCANCODE_UNKNOWN, /* VK_MBUTTON */
RDP_SCANCODE_UNKNOWN, /* VK_XBUTTON1 */
RDP_SCANCODE_UNKNOWN, /* VK_XBUTTON2 */
RDP_SCANCODE_UNKNOWN,
RDP_SCANCODE_BACKSPACE, /* VK_BACK */
RDP_SCANCODE_TAB, /* VK_TAB */
RDP_SCANCODE_UNKNOWN,
RDP_SCANCODE_UNKNOWN,
RDP_SCANCODE_UNKNOWN, /* VK_CLEAR */
RDP_SCANCODE_RETURN, /* VK_RETURN */
RDP_SCANCODE_UNKNOWN,
RDP_SCANCODE_UNKNOWN,
RDP_SCANCODE_LSHIFT, /* VK_SHIFT */
RDP_SCANCODE_UNKNOWN, /* VK_CONTROL */
RDP_SCANCODE_LMENU, /* VK_MENU */
RDP_SCANCODE_PAUSE, /* VK_PAUSE */
RDP_SCANCODE_CAPSLOCK, /* VK_CAPITAL */
RDP_SCANCODE_UNKNOWN, /* VK_KANA / VK_HANGUL */
RDP_SCANCODE_UNKNOWN,
RDP_SCANCODE_UNKNOWN, /* VK_JUNJA */
RDP_SCANCODE_UNKNOWN, /* VK_FINAL */
RDP_SCANCODE_UNKNOWN, /* VK_HANJA / VK_KANJI */
RDP_SCANCODE_UNKNOWN,
RDP_SCANCODE_ESCAPE, /* VK_ESCAPE */
RDP_SCANCODE_UNKNOWN, /* VK_CONVERT */
RDP_SCANCODE_UNKNOWN, /* VK_NONCONVERT */
RDP_SCANCODE_UNKNOWN, /* VK_ACCEPT */
RDP_SCANCODE_UNKNOWN, /* VK_MODECHANGE */
RDP_SCANCODE_SPACE, /* VK_SPACE */
RDP_SCANCODE_PRIOR, /* VK_PRIOR */
RDP_SCANCODE_NEXT, /* VK_NEXT */
RDP_SCANCODE_END, /* VK_END */
RDP_SCANCODE_HOME, /* VK_HOME */
RDP_SCANCODE_LEFT, /* VK_LEFT */
RDP_SCANCODE_UP, /* VK_UP */
RDP_SCANCODE_RIGHT, /* VK_RIGHT */
RDP_SCANCODE_DOWN, /* VK_DOWN */
RDP_SCANCODE_UNKNOWN, /* VK_SELECT */
RDP_SCANCODE_PRINTSCREEN,/* VK_PRINT */
RDP_SCANCODE_PRINTSCREEN,/* VK_EXECUTE */
RDP_SCANCODE_PRINTSCREEN,/* VK_SNAPSHOT */
RDP_SCANCODE_INSERT, /* VK_INSERT */
RDP_SCANCODE_DELETE, /* VK_DELETE */
RDP_SCANCODE_HELP, /* VK_HELP */
RDP_SCANCODE_KEY_0, /* VK_KEY_0 */
RDP_SCANCODE_KEY_1, /* VK_KEY_1 */
RDP_SCANCODE_KEY_2, /* VK_KEY_2 */
RDP_SCANCODE_KEY_3, /* VK_KEY_3 */
RDP_SCANCODE_KEY_4, /* VK_KEY_4 */
RDP_SCANCODE_KEY_5, /* VK_KEY_5 */
RDP_SCANCODE_KEY_6, /* VK_KEY_6 */
RDP_SCANCODE_KEY_7, /* VK_KEY_7 */
RDP_SCANCODE_KEY_8, /* VK_KEY_8 */
RDP_SCANCODE_KEY_9, /* VK_KEY_9 */
RDP_SCANCODE_UNKNOWN,
RDP_SCANCODE_UNKNOWN,
RDP_SCANCODE_UNKNOWN,
RDP_SCANCODE_UNKNOWN,
RDP_SCANCODE_UNKNOWN,
RDP_SCANCODE_UNKNOWN,
RDP_SCANCODE_UNKNOWN,
RDP_SCANCODE_KEY_A, /* VK_KEY_A */
RDP_SCANCODE_KEY_B, /* VK_KEY_B */
RDP_SCANCODE_KEY_C, /* VK_KEY_C */
RDP_SCANCODE_KEY_D, /* VK_KEY_D */
RDP_SCANCODE_KEY_E, /* VK_KEY_E */
RDP_SCANCODE_KEY_F, /* VK_KEY_F */
RDP_SCANCODE_KEY_G, /* VK_KEY_G */
RDP_SCANCODE_KEY_H, /* VK_KEY_H */
RDP_SCANCODE_KEY_I, /* VK_KEY_I */
RDP_SCANCODE_KEY_J, /* VK_KEY_J */
RDP_SCANCODE_KEY_K, /* VK_KEY_K */
RDP_SCANCODE_KEY_L, /* VK_KEY_L */
RDP_SCANCODE_KEY_M, /* VK_KEY_M */
RDP_SCANCODE_KEY_N, /* VK_KEY_N */
RDP_SCANCODE_KEY_O, /* VK_KEY_O */
RDP_SCANCODE_KEY_P, /* VK_KEY_P */
RDP_SCANCODE_KEY_Q, /* VK_KEY_Q */
RDP_SCANCODE_KEY_R, /* VK_KEY_R */
RDP_SCANCODE_KEY_S, /* VK_KEY_S */
RDP_SCANCODE_KEY_T, /* VK_KEY_T */
RDP_SCANCODE_KEY_U, /* VK_KEY_U */
RDP_SCANCODE_KEY_V, /* VK_KEY_V */
RDP_SCANCODE_KEY_W, /* VK_KEY_W */
RDP_SCANCODE_KEY_X, /* VK_KEY_X */
RDP_SCANCODE_KEY_Y, /* VK_KEY_Y */
RDP_SCANCODE_KEY_Z, /* VK_KEY_Z */
RDP_SCANCODE_LWIN, /* VK_LWIN */
RDP_SCANCODE_RWIN, /* VK_RWIN */
RDP_SCANCODE_APPS, /* VK_APPS */
RDP_SCANCODE_UNKNOWN,
RDP_SCANCODE_SLEEP, /* VK_SLEEP */
RDP_SCANCODE_NUMPAD0, /* VK_NUMPAD0 */
RDP_SCANCODE_NUMPAD1, /* VK_NUMPAD1 */
RDP_SCANCODE_NUMPAD2, /* VK_NUMPAD2 */
RDP_SCANCODE_NUMPAD3, /* VK_NUMPAD3 */
RDP_SCANCODE_NUMPAD4, /* VK_NUMPAD4 */
RDP_SCANCODE_NUMPAD5, /* VK_NUMPAD5 */
RDP_SCANCODE_NUMPAD6, /* VK_NUMPAD6 */
RDP_SCANCODE_NUMPAD7, /* VK_NUMPAD7 */
RDP_SCANCODE_NUMPAD8, /* VK_NUMPAD8 */
RDP_SCANCODE_NUMPAD9, /* VK_NUMPAD9 */
RDP_SCANCODE_MULTIPLY, /* VK_MULTIPLY */
RDP_SCANCODE_ADD, /* VK_ADD */
RDP_SCANCODE_UNKNOWN, /* VK_SEPARATOR */
RDP_SCANCODE_SUBTRACT, /* VK_SUBTRACT */
RDP_SCANCODE_DECIMAL, /* VK_DECIMAL */
RDP_SCANCODE_DIVIDE, /* VK_DIVIDE */
RDP_SCANCODE_F1, /* VK_F1 */
RDP_SCANCODE_F2, /* VK_F2 */
RDP_SCANCODE_F3, /* VK_F3 */
RDP_SCANCODE_F4, /* VK_F4 */
RDP_SCANCODE_F5, /* VK_F5 */
RDP_SCANCODE_F6, /* VK_F6 */
RDP_SCANCODE_F7, /* VK_F7 */
RDP_SCANCODE_F8, /* VK_F8 */
RDP_SCANCODE_F9, /* VK_F9 */
RDP_SCANCODE_F10, /* VK_F10 */
RDP_SCANCODE_F11, /* VK_F11 */
RDP_SCANCODE_F12, /* VK_F12 */
RDP_SCANCODE_F13, /* VK_F13 */
RDP_SCANCODE_F14, /* VK_F14 */
RDP_SCANCODE_F15, /* VK_F15 */
RDP_SCANCODE_F16, /* VK_F16 */
RDP_SCANCODE_F17, /* VK_F17 */
RDP_SCANCODE_F18, /* VK_F18 */
RDP_SCANCODE_F19, /* VK_F19 */
RDP_SCANCODE_F20, /* VK_F20 */
RDP_SCANCODE_F21, /* VK_F21 */
RDP_SCANCODE_F22, /* VK_F22 */
RDP_SCANCODE_F23, /* VK_F23 */
RDP_SCANCODE_F24, /* VK_F24 */
RDP_SCANCODE_UNKNOWN,
RDP_SCANCODE_UNKNOWN,
RDP_SCANCODE_UNKNOWN,
RDP_SCANCODE_UNKNOWN,
RDP_SCANCODE_UNKNOWN,
RDP_SCANCODE_UNKNOWN,
RDP_SCANCODE_UNKNOWN,
RDP_SCANCODE_UNKNOWN,
RDP_SCANCODE_NUMLOCK, /* VK_NUMLOCK */
RDP_SCANCODE_SCROLLLOCK, /* VK_SCROLL */
RDP_SCANCODE_UNKNOWN,
RDP_SCANCODE_UNKNOWN,
RDP_SCANCODE_UNKNOWN,
RDP_SCANCODE_UNKNOWN,
RDP_SCANCODE_UNKNOWN,
RDP_SCANCODE_UNKNOWN,
RDP_SCANCODE_UNKNOWN,
RDP_SCANCODE_UNKNOWN,
RDP_SCANCODE_UNKNOWN,
RDP_SCANCODE_UNKNOWN,
RDP_SCANCODE_UNKNOWN,
RDP_SCANCODE_UNKNOWN,
RDP_SCANCODE_UNKNOWN,
RDP_SCANCODE_UNKNOWN,
RDP_SCANCODE_LSHIFT, /* VK_LSHIFT */
RDP_SCANCODE_RSHIFT, /* VK_RSHIFT */
RDP_SCANCODE_LCONTROL, /* VK_LCONTROL */
RDP_SCANCODE_RCONTROL, /* VK_RCONTROL */
RDP_SCANCODE_LMENU, /* VK_LMENU */
RDP_SCANCODE_RMENU, /* VK_RMENU */
RDP_SCANCODE_UNKNOWN, /* VK_BROWSER_BACK */
RDP_SCANCODE_UNKNOWN, /* VK_BROWSER_FORWARD */
RDP_SCANCODE_UNKNOWN, /* VK_BROWSER_REFRESH */
RDP_SCANCODE_UNKNOWN, /* VK_BROWSER_STOP */
RDP_SCANCODE_UNKNOWN, /* VK_BROWSER_SEARCH */
RDP_SCANCODE_UNKNOWN, /* VK_BROWSER_FAVORITES */
RDP_SCANCODE_UNKNOWN, /* VK_BROWSER_HOME */
RDP_SCANCODE_UNKNOWN, /* VK_VOLUME_MUTE */
RDP_SCANCODE_UNKNOWN, /* VK_VOLUME_DOWN */
RDP_SCANCODE_UNKNOWN, /* VK_VOLUME_UP */
RDP_SCANCODE_UNKNOWN, /* VK_MEDIA_NEXT_TRACK */
RDP_SCANCODE_UNKNOWN, /* VK_MEDIA_PREV_TRACK */
RDP_SCANCODE_UNKNOWN, /* VK_MEDIA_STOP */
RDP_SCANCODE_UNKNOWN, /* VK_MEDIA_PLAY_PAUSE */
RDP_SCANCODE_UNKNOWN, /* VK_LAUNCH_MAIL */
RDP_SCANCODE_UNKNOWN, /* VK_MEDIA_SELECT */
RDP_SCANCODE_UNKNOWN, /* VK_LAUNCH_APP1 */
RDP_SCANCODE_UNKNOWN, /* VK_LAUNCH_APP2 */
RDP_SCANCODE_UNKNOWN,
RDP_SCANCODE_UNKNOWN,
RDP_SCANCODE_OEM_1, /* VK_OEM_1 */
RDP_SCANCODE_OEM_PLUS, /* VK_OEM_PLUS */
RDP_SCANCODE_OEM_COMMA, /* VK_OEM_COMMA */
RDP_SCANCODE_OEM_MINUS, /* VK_OEM_MINUS */
RDP_SCANCODE_OEM_PERIOD, /* VK_OEM_PERIOD */
RDP_SCANCODE_OEM_2, /* VK_OEM_2 */
RDP_SCANCODE_OEM_3, /* VK_OEM_3 */
RDP_SCANCODE_ABNT_C1, /* VK_ABNT_C1 */
RDP_SCANCODE_ABNT_C2, /* VK_ABNT_C2 */
RDP_SCANCODE_UNKNOWN,
RDP_SCANCODE_UNKNOWN,
RDP_SCANCODE_UNKNOWN,
RDP_SCANCODE_UNKNOWN,
RDP_SCANCODE_UNKNOWN,
RDP_SCANCODE_UNKNOWN,
RDP_SCANCODE_UNKNOWN,
RDP_SCANCODE_UNKNOWN,
RDP_SCANCODE_UNKNOWN,
RDP_SCANCODE_UNKNOWN,
RDP_SCANCODE_UNKNOWN,
RDP_SCANCODE_UNKNOWN,
RDP_SCANCODE_UNKNOWN,
RDP_SCANCODE_UNKNOWN,
RDP_SCANCODE_UNKNOWN,
RDP_SCANCODE_UNKNOWN,
RDP_SCANCODE_UNKNOWN,
RDP_SCANCODE_UNKNOWN,
RDP_SCANCODE_UNKNOWN,
RDP_SCANCODE_UNKNOWN,
RDP_SCANCODE_UNKNOWN,
RDP_SCANCODE_UNKNOWN,
RDP_SCANCODE_UNKNOWN,
RDP_SCANCODE_UNKNOWN,
RDP_SCANCODE_OEM_4, /* VK_OEM_4 */
RDP_SCANCODE_OEM_5, /* VK_OEM_5 */
RDP_SCANCODE_OEM_6, /* VK_OEM_6 */
RDP_SCANCODE_OEM_7, /* VK_OEM_7 */
RDP_SCANCODE_LCONTROL, /* VK_OEM_8 */
RDP_SCANCODE_UNKNOWN,
RDP_SCANCODE_UNKNOWN,
RDP_SCANCODE_OEM_102, /* VK_OEM_102 */
RDP_SCANCODE_UNKNOWN,
RDP_SCANCODE_UNKNOWN,
RDP_SCANCODE_UNKNOWN, /* VK_PROCESSKEY */
RDP_SCANCODE_UNKNOWN,
RDP_SCANCODE_UNKNOWN, /* VK_PACKET */
RDP_SCANCODE_UNKNOWN,
RDP_SCANCODE_UNKNOWN,
RDP_SCANCODE_UNKNOWN,
RDP_SCANCODE_UNKNOWN,
RDP_SCANCODE_UNKNOWN,
RDP_SCANCODE_UNKNOWN,
RDP_SCANCODE_UNKNOWN,
RDP_SCANCODE_UNKNOWN,
RDP_SCANCODE_UNKNOWN,
RDP_SCANCODE_UNKNOWN,
RDP_SCANCODE_UNKNOWN,
RDP_SCANCODE_UNKNOWN,
RDP_SCANCODE_UNKNOWN,
RDP_SCANCODE_UNKNOWN,
RDP_SCANCODE_UNKNOWN, /* VK_ATTN */
RDP_SCANCODE_UNKNOWN, /* VK_CRSEL */
RDP_SCANCODE_UNKNOWN, /* VK_EXSEL */
RDP_SCANCODE_UNKNOWN, /* VK_EREOF */
RDP_SCANCODE_UNKNOWN, /* VK_PLAY */
RDP_SCANCODE_ZOOM, /* VK_ZOOM */
RDP_SCANCODE_UNKNOWN, /* VK_NONAME */
RDP_SCANCODE_UNKNOWN, /* VK_PA1 */
RDP_SCANCODE_UNKNOWN, /* VK_OEM_CLEAR */
RDP_SCANCODE_UNKNOWN
};
RDP_KEYBOARD_LAYOUT* freerdp_keyboard_get_layouts(UINT32 types)
RDP_KEYBOARD_LAYOUT* freerdp_keyboard_get_layouts(DWORD types)
{
int num, length, i;
RDP_KEYBOARD_LAYOUT* layouts;
@ -519,12 +256,12 @@ RDP_KEYBOARD_LAYOUT* freerdp_keyboard_get_layouts(UINT32 types)
}
}
memset(&layouts[num], 0, sizeof(RDP_KEYBOARD_LAYOUT));
ZeroMemory(&layouts[num], sizeof(RDP_KEYBOARD_LAYOUT));
return layouts;
}
const char* freerdp_keyboard_get_layout_name_from_id(UINT32 keyboardLayoutID)
const char* freerdp_keyboard_get_layout_name_from_id(DWORD keyboardLayoutID)
{
int i;

View File

@ -25,6 +25,8 @@
#include <stdlib.h>
#include <string.h>
#include <winpr/crt.h>
#include "liblocale.h"
#include <freerdp/locale/keyboard.h>
@ -202,18 +204,12 @@ 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* keyboard_type, int length)
int freerdp_get_solaris_keyboard_layout_and_type(int* type, int* layout)
{
FILE* kbd;
int i;
int type = 0;
int layout = 0;
char* pch;
char* beg;
char* end;
char buffer[1024];
/*
@ -226,10 +222,13 @@ UINT32 freerdp_detect_keyboard_type_and_layout_solaris(char* keyboard_type, int
rate(ms)=40
*/
*type = 0;
*layout = 0;
kbd = popen("kbd -t -l", "r");
if (kbd < 0)
return 0;
return -1;
while (fgets(buffer, sizeof(buffer), kbd) != NULL)
{
@ -238,27 +237,37 @@ UINT32 freerdp_detect_keyboard_type_and_layout_solaris(char* keyboard_type, int
beg = pch + sizeof("type=") - 1;
end = strchr(beg, '\n');
end[0] = '\0';
type = atoi(beg);
*type = atoi(beg);
}
else if ((pch = strstr(buffer, "layout=")) != NULL)
{
beg = pch + sizeof("layout=") - 1;
end = strchr(beg, ' ');
end[0] = '\0';
layout = atoi(beg);
*layout = atoi(beg);
}
}
pclose(kbd);
return 0;
}
DWORD freerdp_detect_solaris_keyboard_layout()
{
int i;
int type;
int layout;
if (freerdp_get_solaris_keyboard_layout_and_type(&type, &layout) < 0)
return 0;
for (i = 0; i < ARRAYSIZE(SOLARIS_KEYBOARD_TABLE); i++)
{
if (SOLARIS_KEYBOARD_TABLE[i].type == type)
{
if (SOLARIS_KEYBOARD_TABLE[i].layout == layout)
{
strncpy(keyboard_type, SOLARIS_KEYBOARD_TABLE[i].xkbType, length);
return SOLARIS_KEYBOARD_TABLE[i].keyboardLayoutId;
}
}
}

View File

@ -17,9 +17,9 @@
* limitations under the License.
*/
#ifndef __LOCALE_KEYBOARD_SUN_H
#define __LOCALE_KEYBOARD_SUN_H
#ifndef FREERDP_LOCALE_KEYBOARD_SUN_H
#define FREERDP_LOCALE_KEYBOARD_SUN_H
UINT32 freerdp_detect_keyboard_type_and_layout_solaris(char* keyboard_type, int length);
DWORD freerdp_detect_solaris_keyboard_layout();
#endif /* __LOCALE_KEYBOARD_SUN_H */
#endif /* FREERDP_LOCALE_KEYBOARD_SUN_H */

View File

@ -26,6 +26,7 @@
#include <string.h>
#include <winpr/crt.h>
#include <winpr/input.h>
#include "liblocale.h"
@ -33,18 +34,9 @@
#include <freerdp/locale/keyboard.h>
#include "keyboard_x11.h"
#include "keyboard_keymap.h"
#include "xkb_layout_ids.h"
#ifdef WITH_SUN
#include "keyboard_sun.h"
#endif
extern const RDP_SCANCODE VIRTUAL_KEY_CODE_TO_DEFAULT_RDP_SCANCODE_TABLE[256];
UINT32 freerdp_detect_keyboard_layout_from_xkb(char** xkb_layout, char** xkb_variant)
int freerdp_detect_keyboard_layout_from_xkb(DWORD* keyboardLayoutId)
{
char* pch;
char* beg;
@ -53,7 +45,6 @@ UINT32 freerdp_detect_keyboard_layout_from_xkb(char** xkb_layout, char** xkb_var
char buffer[1024];
char* layout = NULL;
char* variant = NULL;
UINT32 keyboardLayoutId = 0;
/* We start by looking for _XKB_RULES_NAMES_BACKUP which appears to be used by libxklavier */
@ -68,12 +59,12 @@ UINT32 freerdp_detect_keyboard_layout_from_xkb(char** xkb_layout, char** xkb_var
* "multi" the keyboard layout variant
*/
while(fgets(buffer, sizeof(buffer), xprop) != NULL)
while (fgets(buffer, sizeof(buffer), xprop) != NULL)
{
if((pch = strstr(buffer, "_XKB_RULES_NAMES_BACKUP(STRING) = ")) != NULL)
if ((pch = strstr(buffer, "_XKB_RULES_NAMES_BACKUP(STRING) = ")) != NULL)
{
/* "rules" */
pch = strchr(&buffer[34], ','); // We assume it is xorg
pch = strchr(&buffer[34], ','); /* We assume it is xorg */
pch += 1;
/* "type" */
@ -98,25 +89,22 @@ UINT32 freerdp_detect_keyboard_layout_from_xkb(char** xkb_layout, char** xkb_var
variant = beg;
}
}
pclose(xprop);
DEBUG_KBD("_XKB_RULES_NAMES_BACKUP layout: %s, variant: %s", layout, variant);
keyboardLayoutId = find_keyboard_layout_in_xorg_rules(layout, variant);
*keyboardLayoutId = find_keyboard_layout_in_xorg_rules(layout, variant);
if (keyboardLayoutId > 0)
{
*xkb_layout = _strdup(layout);
*xkb_variant = _strdup(variant);
return keyboardLayoutId;
}
if (*keyboardLayoutId > 0)
return 0;
/* Check _XKB_RULES_NAMES if _XKB_RULES_NAMES_BACKUP fails */
xprop = popen("xprop -root _XKB_RULES_NAMES", "r");
while(fgets(buffer, sizeof(buffer), xprop) != NULL)
while (fgets(buffer, sizeof(buffer), xprop) != NULL)
{
if((pch = strstr(buffer, "_XKB_RULES_NAMES(STRING) = ")) != NULL)
if ((pch = strstr(buffer, "_XKB_RULES_NAMES(STRING) = ")) != NULL)
{
/* "rules" */
pch = strchr(&buffer[27], ','); // We assume it is xorg
@ -144,17 +132,14 @@ UINT32 freerdp_detect_keyboard_layout_from_xkb(char** xkb_layout, char** xkb_var
variant = beg;
}
}
pclose(xprop);
DEBUG_KBD("_XKB_RULES_NAMES layout: %s, variant: %s", layout, variant);
keyboardLayoutId = find_keyboard_layout_in_xorg_rules(layout, variant);
*keyboardLayoutId = find_keyboard_layout_in_xorg_rules(layout, variant);
if (keyboardLayoutId > 0)
{
*xkb_layout = _strdup(layout);
*xkb_variant = _strdup(variant);
return keyboardLayoutId;
}
if (*keyboardLayoutId > 0)
return *keyboardLayoutId;
return 0;
}
@ -209,329 +194,3 @@ char* freerdp_detect_keymap_from_xkb()
return keymap;
}
#ifdef __APPLE__
const UINT32 KEYCODE_TO_VKCODE_MACOSX[256] =
{
0, /* 0 */
0, /* 1 */
0, /* 2 */
0, /* 3 */
0, /* 4 */
0, /* 5 */
0, /* 6 */
0, /* 7 */
VK_KEY_A, /* 8 */
VK_KEY_S, /* 9 */
VK_KEY_D, /* 10 */
VK_KEY_F, /* 11 */
VK_KEY_H, /* 12 */
VK_KEY_G, /* 13 */
VK_KEY_Z, /* 14 */
VK_KEY_X, /* 15 */
VK_KEY_C, /* 16 */
VK_KEY_V, /* 17 */
VK_OEM_102, /* 18 */
VK_KEY_B, /* 19 */
VK_KEY_Q, /* 20 */
VK_KEY_W, /* 21 */
VK_KEY_E, /* 22 */
VK_KEY_R, /* 23 */
VK_KEY_Y, /* 24 */
VK_KEY_T, /* 25 */
VK_KEY_1, /* 26 */
VK_KEY_2, /* 27 */
VK_KEY_3, /* 28 */
VK_KEY_4, /* 29 */
VK_KEY_6, /* 30 */
VK_KEY_5, /* 31 */
VK_OEM_PLUS, /* 32 */
VK_KEY_9, /* 33 */
VK_KEY_7, /* 34 */
VK_OEM_MINUS, /* 35 */
VK_KEY_8, /* 36 */
VK_KEY_0, /* 37 */
VK_OEM_6, /* 38 */
VK_KEY_O, /* 39 */
VK_KEY_U, /* 40 */
VK_OEM_4, /* 41 */
VK_KEY_I, /* 42 */
VK_KEY_P, /* 43 */
VK_RETURN, /* 44 */
VK_KEY_L, /* 45 */
VK_KEY_J, /* 46 */
VK_OEM_7, /* 47 */
VK_KEY_K, /* 48 */
VK_OEM_1, /* 49 */
VK_OEM_5, /* 50 */
VK_OEM_COMMA, /* 51 */
VK_OEM_2, /* 52 */
VK_KEY_N, /* 53 */
VK_KEY_M, /* 54 */
VK_OEM_PERIOD, /* 55 */
VK_TAB, /* 56 */
VK_SPACE, /* 57 */
VK_OEM_3, /* 58 */
VK_BACK, /* 59 */
0, /* 60 */
VK_ESCAPE, /* 61 */
0, /* 62 */
VK_LWIN, /* 63 */
VK_LSHIFT, /* 64 */
VK_CAPITAL, /* 65 */
VK_LMENU, /* 66 */
VK_LCONTROL, /* 67 */
VK_RSHIFT, /* 68 */
VK_RMENU, /* 69 */
0, /* 70 */
VK_RWIN, /* 71 */
0, /* 72 */
VK_DECIMAL, /* 73 */
0, /* 74 */
VK_MULTIPLY, /* 75 */
0, /* 76 */
VK_ADD, /* 77 */
0, /* 78 */
VK_NUMLOCK, /* 79 */
0, /* 80 */
0, /* 81 */
0, /* 82 */
VK_DIVIDE, /* 83 */
VK_RETURN, /* 84 */
0, /* 85 */
VK_SUBTRACT, /* 86 */
0, /* 87 */
0, /* 88 */
0, /* 89 */
VK_NUMPAD0, /* 90 */
VK_NUMPAD1, /* 91 */
VK_NUMPAD2, /* 92 */
VK_NUMPAD3, /* 93 */
VK_NUMPAD4, /* 94 */
VK_NUMPAD5, /* 95 */
VK_NUMPAD6, /* 96 */
VK_NUMPAD7, /* 97 */
0, /* 98 */
VK_NUMPAD8, /* 99 */
VK_NUMPAD9, /* 100 */
0, /* 101 */
0, /* 102 */
0, /* 103 */
VK_F5, /* 104 */
VK_F6, /* 105 */
VK_F7, /* 106 */
VK_F3, /* 107 */
VK_F8, /* 108 */
VK_F9, /* 109 */
0, /* 110 */
VK_F11, /* 111 */
0, /* 112 */
VK_SNAPSHOT, /* 113 */
0, /* 114 */
VK_SCROLL, /* 115 */
0, /* 116 */
VK_F10, /* 117 */
0, /* 118 */
VK_F12, /* 119 */
0, /* 120 */
VK_PAUSE, /* 121 */
VK_INSERT, /* 122 */
VK_HOME, /* 123 */
VK_PRIOR, /* 124 */
VK_DELETE, /* 125 */
VK_F4, /* 126 */
VK_END, /* 127 */
VK_F2, /* 128 */
VK_NEXT, /* 129 */
VK_F1, /* 130 */
VK_LEFT, /* 131 */
VK_RIGHT, /* 132 */
VK_DOWN, /* 133 */
VK_UP, /* 134 */
0, /* 135 */
0, /* 136 */
0, /* 137 */
0, /* 138 */
0, /* 139 */
0, /* 140 */
0, /* 141 */
0, /* 142 */
0, /* 143 */
0, /* 144 */
0, /* 145 */
0, /* 146 */
0, /* 147 */
0, /* 148 */
0, /* 149 */
0, /* 150 */
0, /* 151 */
0, /* 152 */
0, /* 153 */
0, /* 154 */
0, /* 155 */
0, /* 156 */
0, /* 157 */
0, /* 158 */
0, /* 159 */
0, /* 160 */
0, /* 161 */
0, /* 162 */
0, /* 163 */
0, /* 164 */
0, /* 165 */
0, /* 166 */
0, /* 167 */
0, /* 168 */
0, /* 169 */
0, /* 170 */
0, /* 171 */
0, /* 172 */
0, /* 173 */
0, /* 174 */
0, /* 175 */
0, /* 176 */
0, /* 177 */
0, /* 178 */
0, /* 179 */
0, /* 180 */
0, /* 181 */
0, /* 182 */
0, /* 183 */
0, /* 184 */
0, /* 185 */
0, /* 186 */
0, /* 187 */
0, /* 188 */
0, /* 189 */
0, /* 190 */
0, /* 191 */
0, /* 192 */
0, /* 193 */
0, /* 194 */
0, /* 195 */
0, /* 196 */
0, /* 197 */
0, /* 198 */
0, /* 199 */
0, /* 200 */
0, /* 201 */
0, /* 202 */
0, /* 203 */
0, /* 204 */
0, /* 205 */
0, /* 206 */
0, /* 207 */
0, /* 208 */
0, /* 209 */
0, /* 210 */
0, /* 211 */
0, /* 212 */
0, /* 213 */
0, /* 214 */
0, /* 215 */
0, /* 216 */
0, /* 217 */
0, /* 218 */
0, /* 219 */
0, /* 220 */
0, /* 221 */
0, /* 222 */
0, /* 223 */
0, /* 224 */
0, /* 225 */
0, /* 226 */
0, /* 227 */
0, /* 228 */
0, /* 229 */
0, /* 230 */
0, /* 231 */
0, /* 232 */
0, /* 233 */
0, /* 234 */
0, /* 235 */
0, /* 236 */
0, /* 237 */
0, /* 238 */
0, /* 239 */
0, /* 240 */
0, /* 241 */
0, /* 242 */
0, /* 243 */
0, /* 244 */
0, /* 245 */
0, /* 246 */
0, /* 247 */
0, /* 248 */
0, /* 249 */
0, /* 250 */
0, /* 251 */
0, /* 252 */
0, /* 253 */
0, /* 254 */
0 /* 255 */
};
#endif
UINT32 freerdp_keyboard_init_x11(UINT32 keyboardLayoutId, RDP_SCANCODE x11_keycode_to_rdp_scancode[256])
{
UINT32 vkcode;
UINT32 keycode;
UINT32 keycode_to_vkcode[256];
ZeroMemory(keycode_to_vkcode, sizeof(keycode_to_vkcode));
ZeroMemory(x11_keycode_to_rdp_scancode, sizeof(RDP_SCANCODE) * 256);
#ifdef __APPLE__
/* Apple X11 breaks XKB detection */
CopyMemory(keycode_to_vkcode, KEYCODE_TO_VKCODE_MACOSX, sizeof(keycode_to_vkcode));
freerdp_keyboard_load_map(keycode_to_vkcode, "macosx(macosx)");
#elif defined(WITH_SUN)
{
char sunkeymap[32];
freerdp_detect_keyboard_type_and_layout_solaris(sunkeymap, sizeof(sunkeymap));
freerdp_keyboard_load_map(keycode_to_vkcode, sunkeymap);
}
#else
{
char* keymap;
char* xkb_layout = 0;
char* xkb_variant = 0;
if (keyboardLayoutId == 0)
{
keyboardLayoutId = freerdp_detect_keyboard_layout_from_xkb(&xkb_layout, &xkb_variant);
if (xkb_layout)
free(xkb_layout);
if (xkb_variant)
free(xkb_variant);
}
keymap = freerdp_detect_keymap_from_xkb();
if (keymap != NULL)
{
freerdp_keyboard_load_maps(keycode_to_vkcode, keymap);
free(keymap);
}
}
#endif
for (keycode = 0; keycode < 256; keycode++)
{
vkcode = keycode_to_vkcode[keycode];
if (!(vkcode > 0 && vkcode < 256))
continue;
x11_keycode_to_rdp_scancode[keycode] = VIRTUAL_KEY_CODE_TO_DEFAULT_RDP_SCANCODE_TABLE[vkcode];
}
return keyboardLayoutId;
}

View File

@ -17,9 +17,9 @@
* limitations under the License.
*/
#ifndef __LOCALE_KEYBOARD_X11_H
#define __LOCALE_KEYBOARD_X11_H
#ifndef FREERDP_LOCALE_KEYBOARD_X11_H
#define FREERDP_LOCALE_KEYBOARD_X11_H
UINT32 freerdp_keyboard_init_x11(UINT32 keyboardLayoutId, RDP_SCANCODE x11_keycode_to_rdp_scancode[256]);
int freerdp_detect_keyboard_layout_from_xkb(DWORD* keyboardLayoutId);
#endif /* __LOCALE_KEYBOARD_X11_H */
#endif /* FREERDP_LOCALE_KEYBOARD_X11_H */

View File

@ -28,6 +28,7 @@
#include <string.h>
#include <winpr/crt.h>
#include <winpr/input.h>
#include <freerdp/locale/keyboard.h>
@ -43,7 +44,7 @@
struct _XKB_KEY_NAME_SCANCODE
{
const char* xkb_keyname; /* XKB keyname */
RDP_SCANCODE rdp_scancode;
DWORD rdp_scancode;
};
typedef struct _XKB_KEY_NAME_SCANCODE XKB_KEY_NAME_SCANCODE;
@ -169,7 +170,7 @@ void* freerdp_keyboard_xkb_init()
Display* display = XOpenDisplay(NULL);
if (display == NULL)
if (!display)
return NULL;
status = XkbQueryExtension(display, NULL, NULL, NULL, NULL, NULL);
@ -180,23 +181,23 @@ void* freerdp_keyboard_xkb_init()
return (void*) display;
}
UINT32 freerdp_keyboard_init_xkbfile(UINT32 keyboardLayoutId, RDP_SCANCODE x11_keycode_to_rdp_scancode[256])
int freerdp_keyboard_init_xkbfile(DWORD* keyboardLayoutId, DWORD x11_keycode_to_rdp_scancode[256])
{
void* display;
ZeroMemory(x11_keycode_to_rdp_scancode, sizeof(RDP_SCANCODE) * 256);
ZeroMemory(x11_keycode_to_rdp_scancode, sizeof(DWORD) * 256);
display = freerdp_keyboard_xkb_init();
if (!display)
{
DEBUG_KBD("Error initializing xkb");
return 0;
return -1;
}
if (keyboardLayoutId == 0)
if (*keyboardLayoutId == 0)
{
keyboardLayoutId = detect_keyboard_layout_from_xkbfile(display);
detect_keyboard_layout_from_xkbfile(display, keyboardLayoutId);
DEBUG_KBD("detect_keyboard_layout_from_xkb: %X", keyboardLayoutId);
}
@ -204,13 +205,13 @@ UINT32 freerdp_keyboard_init_xkbfile(UINT32 keyboardLayoutId, RDP_SCANCODE x11_k
XCloseDisplay(display);
return keyboardLayoutId;
return 0;
}
/* return substring starting after nth comma, ending at following comma */
static char* comma_substring(char* s, int n)
{
char *p;
char* p;
if (!s)
return "";
@ -229,15 +230,14 @@ static char* comma_substring(char* s, int n)
return s;
}
UINT32 detect_keyboard_layout_from_xkbfile(void* display)
int detect_keyboard_layout_from_xkbfile(void* display, DWORD* keyboardLayoutId)
{
char* layout;
char* variant;
UINT32 group = 0;
UINT32 keyboard_layout = 0;
XkbRF_VarDefsRec rules_names;
XKeyboardState coreKbdState;
DWORD group = 0;
XkbStateRec state;
XKeyboardState coreKbdState;
XkbRF_VarDefsRec rules_names;
DEBUG_KBD("display: %p", display);
@ -259,7 +259,7 @@ UINT32 detect_keyboard_layout_from_xkbfile(void* display)
DEBUG_KBD("layout: %s", layout ? layout : "");
DEBUG_KBD("variant: %s", variant ? variant : "");
keyboard_layout = find_keyboard_layout_in_xorg_rules(layout, variant);
*keyboardLayoutId = find_keyboard_layout_in_xorg_rules(layout, variant);
free(rules_names.model);
free(rules_names.layout);
@ -267,10 +267,10 @@ UINT32 detect_keyboard_layout_from_xkbfile(void* display)
free(rules_names.options);
}
return keyboard_layout;
return 0;
}
int freerdp_keyboard_load_map_from_xkbfile(void* display, RDP_SCANCODE x11_keycode_to_rdp_scancode[256])
int freerdp_keyboard_load_map_from_xkbfile(void* display, DWORD x11_keycode_to_rdp_scancode[256])
{
int i, j;
BOOL found;
@ -286,14 +286,13 @@ int freerdp_keyboard_load_map_from_xkbfile(void* display, RDP_SCANCODE x11_keyco
for (i = xkb->min_key_code; i <= xkb->max_key_code; i++)
{
found = FALSE;
memcpy(xkb_keyname, xkb->names->keys[i].name, 4);
CopyMemory(xkb_keyname, xkb->names->keys[i].name, 4);
if (strlen(xkb_keyname) < 1)
continue;
for (j = 0; j < ARRAYSIZE(XKB_KEY_NAME_SCANCODE_TABLE); j++)
{
if (!strcmp(xkb_keyname, XKB_KEY_NAME_SCANCODE_TABLE[j].xkb_keyname))
{
DEBUG_KBD("%4s: keycode: 0x%02X -> rdp scancode: 0x%04X",

View File

@ -23,8 +23,9 @@
#include <freerdp/types.h>
#include <freerdp/locale/keyboard.h>
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]);
int freerdp_keyboard_init_xkbfile(DWORD* keyboardLayoutId, DWORD x11_keycode_to_rdp_scancode[256]);
int detect_keyboard_layout_from_xkbfile(void* display, DWORD* keyboardLayoutId);
int freerdp_keyboard_load_map_from_xkbfile(void* display, DWORD x11_keycode_to_rdp_scancode[256]);
#endif /* __LOCALE_KEYBOARD_XKB_H */

View File

@ -35,7 +35,7 @@ struct _SYSTEM_LOCALE
{
char language[4]; /* Two or three letter language code */
char country[10]; /* Two or three letter country code (Sometimes with Cyrl_ prefix) */
UINT32 code; /* 32-bit unsigned integer corresponding to the locale */
DWORD code; /* 32-bit unsigned integer corresponding to the locale */
};
typedef struct _SYSTEM_LOCALE SYSTEM_LOCALE;
@ -249,7 +249,7 @@ static const SYSTEM_LOCALE SYSTEM_LOCALE_TABLE[] =
struct _LOCALE_NAME
{
UINT32 localeId;
DWORD localeId;
const char* name;
};
typedef struct _LOCALE_NAME LOCALE_NAME;
@ -459,8 +459,8 @@ static const LOCALE_NAME LOCALE_NAME_TABLE[] =
struct _LOCALE_KEYBOARD_LAYOUTS
{
UINT32 locale; /* Locale ID */
UINT32 keyboardLayouts[5]; /* array of associated keyboard layouts */
DWORD locale; /* Locale ID */
DWORD keyboardLayouts[5]; /* array of associated keyboard layouts */
};
typedef struct _LOCALE_KEYBOARD_LAYOUTS LOCALE_KEYBOARD_LAYOUTS;
@ -692,7 +692,7 @@ SYSTEM_LOCALE* freerdp_detect_system_locale()
return locale;
}
UINT32 freerdp_get_system_locale_id()
DWORD freerdp_get_system_locale_id()
{
SYSTEM_LOCALE* locale;
@ -704,7 +704,7 @@ UINT32 freerdp_get_system_locale_id()
return 0;
}
const char* freerdp_get_system_locale_name_from_id(UINT32 localeId)
const char* freerdp_get_system_locale_name_from_id(DWORD localeId)
{
int index;
@ -717,7 +717,7 @@ const char* freerdp_get_system_locale_name_from_id(UINT32 localeId)
return NULL;
}
UINT32 freerdp_detect_keyboard_layout_from_system_locale()
int freerdp_detect_keyboard_layout_from_system_locale(DWORD* keyboardLayoutId)
{
int i, j;
char language[4];
@ -727,12 +727,15 @@ UINT32 freerdp_detect_keyboard_layout_from_system_locale()
freerdp_get_system_language_and_country_codes(language, country);
if ((strcmp(language, "C") == 0) || (strcmp(language, "POSIX") == 0))
return ENGLISH_UNITED_STATES; /* U.S. Keyboard Layout */
{
*keyboardLayoutId = ENGLISH_UNITED_STATES; /* U.S. Keyboard Layout */
return 0;
}
locale = freerdp_detect_system_locale();
if (locale == NULL)
return 0;
if (!locale)
return -1;
DEBUG_KBD("Found locale : %s_%s", locale->language, locale->country);
@ -741,6 +744,7 @@ UINT32 freerdp_detect_keyboard_layout_from_system_locale()
if (LOCALE_KEYBOARD_LAYOUTS_TABLE[i].locale == locale->code)
{
/* Locale found in list of default keyboard layouts */
for (j = 0; j < 5; j++)
{
if (LOCALE_KEYBOARD_LAYOUTS_TABLE[i].keyboardLayouts[j] == ENGLISH_UNITED_STATES)
@ -753,7 +757,8 @@ UINT32 freerdp_detect_keyboard_layout_from_system_locale()
}
else
{
return LOCALE_KEYBOARD_LAYOUTS_TABLE[i].keyboardLayouts[j];
*keyboardLayoutId = LOCALE_KEYBOARD_LAYOUTS_TABLE[i].keyboardLayouts[j];
return 0;
}
}
@ -763,11 +768,16 @@ UINT32 freerdp_detect_keyboard_layout_from_system_locale()
*/
if (j >= 1)
return ENGLISH_UNITED_STATES;
else
{
*keyboardLayoutId = ENGLISH_UNITED_STATES;
return 0;
}
else
{
return -1;
}
}
}
return 0; /* Could not detect the current keyboard layout from locale */
return -1; /* Could not detect the current keyboard layout from locale */
}

View File

@ -97,6 +97,6 @@ endif()
set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "FreeRDP/libfreerdp")
if(BUILD_TESTING AND ((NOT WIN32) AND (NOT APPLE)))
add_subdirectory(test)
# add_subdirectory(test)
endif()

873
winpr/include/winpr/input.h Normal file
View File

@ -0,0 +1,873 @@
/**
* WinPR: Windows Portable Runtime
* Input Functions
*
* Copyright 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 WINPR_INPUT_H
#define WINPR_INPUT_H
#include <winpr/winpr.h>
#include <winpr/wtypes.h>
/**
* Key Flags
*/
#define KBDEXT (USHORT) 0x0100
#define KBDMULTIVK (USHORT) 0x0200
#define KBDSPECIAL (USHORT) 0x0400
#define KBDNUMPAD (USHORT) 0x0800
#define KBDUNICODE (USHORT) 0x1000
#define KBDINJECTEDVK (USHORT) 0x2000
#define KBDMAPPEDVK (USHORT) 0x4000
#define KBDBREAK (USHORT) 0x8000
/*
* Virtual Key Codes (Windows):
* http://msdn.microsoft.com/en-us/library/windows/desktop/dd375731/
* http://msdn.microsoft.com/en-us/library/ms927178.aspx
*/
/* 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_POWER 0x5E /* Power key */
#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_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 */
#define VK_OEM_AX 0xE1 /* AX key on Japanese AX keyboard */
#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_OEM_RESET 0xE9
#define VK_OEM_JUMP 0xEA
#define VK_OEM_PA1 0xEB
#define VK_OEM_PA2 0xEC
#define VK_OEM_PA3 0xED
#define VK_OEM_WSCTRL 0xEE
#define VK_OEM_CUSEL 0xEF
#define VK_OEM_ATTN 0xF0
#define VK_OEM_FINISH 0xF1
#define VK_OEM_COPY 0xF2
#define VK_OEM_AUTO 0xF3
#define VK_OEM_ENLW 0xF4
#define VK_OEM_BACKTAB 0xF5
#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 */
#define VK_NONE 0xFF /* no key */
/**
* For East Asian Input Method Editors (IMEs)
* the following additional virtual keyboard definitions must be observed.
*/
#define VK_DBE_ALPHANUMERIC 0xF0 /* Changes the mode to alphanumeric. */
#define VK_DBE_KATAKANA 0xF1 /* Changes the mode to Katakana. */
#define VK_DBE_HIRAGANA 0xF2 /* Changes the mode to Hiragana. */
#define VK_DBE_SBCSCHAR 0xF3 /* Changes the mode to single-byte characters. */
#define VK_DBE_DBCSCHAR 0xF4 /* Changes the mode to double-byte characters. */
#define VK_DBE_ROMAN 0xF5 /* Changes the mode to Roman characters. */
#define VK_DBE_NOROMAN 0xF6 /* Changes the mode to non-Roman characters. */
#define VK_DBE_ENTERWORDREGISTERMODE 0xF7 /* Activates the word registration dialog box. */
#define VK_DBE_ENTERIMECONFIGMODE 0xF8 /* Activates a dialog box for setting up an IME environment. */
#define VK_DBE_FLUSHSTRING 0xF9 /* Deletes the undetermined string without determining it. */
#define VK_DBE_CODEINPUT 0xFA /* Changes the mode to code input. */
#define VK_DBE_NOCODEINPUT 0xFB /* Changes the mode to no-code input. */
/*
* Virtual Scan Codes
*/
/**
* Keyboard Type 4
*/
#define KBD4_T00 VK_NONE
#define KBD4_T01 VK_ESCAPE
#define KBD4_T02 VK_KEY_1
#define KBD4_T03 VK_KEY_2
#define KBD4_T04 VK_KEY_3
#define KBD4_T05 VK_KEY_4
#define KBD4_T06 VK_KEY_5
#define KBD4_T07 VK_KEY_6
#define KBD4_T08 VK_KEY_7
#define KBD4_T09 VK_KEY_8
#define KBD4_T0A VK_KEY_9
#define KBD4_T0B VK_KEY_0
#define KBD4_T0C VK_OEM_MINUS
#define KBD4_T0D VK_OEM_PLUS /* NE */
#define KBD4_T0E VK_BACK
#define KBD4_T0F VK_TAB
#define KBD4_T10 VK_KEY_Q
#define KBD4_T11 VK_KEY_W
#define KBD4_T12 VK_KEY_E
#define KBD4_T13 VK_KEY_R
#define KBD4_T14 VK_KEY_T
#define KBD4_T15 VK_KEY_Y
#define KBD4_T16 VK_KEY_U
#define KBD4_T17 VK_KEY_I
#define KBD4_T18 VK_KEY_O
#define KBD4_T19 VK_KEY_P
#define KBD4_T1A VK_OEM_4 /* NE */
#define KBD4_T1B VK_OEM_6 /* NE */
#define KBD4_T1C VK_RETURN
#define KBD4_T1D VK_LCONTROL
#define KBD4_T1E VK_KEY_A
#define KBD4_T1F VK_KEY_S
#define KBD4_T20 VK_KEY_D
#define KBD4_T21 VK_KEY_F
#define KBD4_T22 VK_KEY_G
#define KBD4_T23 VK_KEY_H
#define KBD4_T24 VK_KEY_J
#define KBD4_T25 VK_KEY_K
#define KBD4_T26 VK_KEY_L
#define KBD4_T27 VK_OEM_1 /* NE */
#define KBD4_T28 VK_OEM_7 /* NE */
#define KBD4_T29 VK_OEM_3 /* NE */
#define KBD4_T2A VK_LSHIFT
#define KBD4_T2B VK_OEM_5
#define KBD4_T2C VK_KEY_Z
#define KBD4_T2D VK_KEY_X
#define KBD4_T2E VK_KEY_C
#define KBD4_T2F VK_KEY_V
#define KBD4_T30 VK_KEY_B
#define KBD4_T31 VK_KEY_N
#define KBD4_T32 VK_KEY_M
#define KBD4_T33 VK_OEM_COMMA
#define KBD4_T34 VK_OEM_PERIOD
#define KBD4_T35 VK_OEM_2
#define KBD4_T36 VK_RSHIFT
#define KBD4_T37 VK_MULTIPLY
#define KBD4_T38 VK_LMENU
#define KBD4_T39 VK_SPACE
#define KBD4_T3A VK_CAPITAL
#define KBD4_T3B VK_F1
#define KBD4_T3C VK_F2
#define KBD4_T3D VK_F3
#define KBD4_T3E VK_F4
#define KBD4_T3F VK_F5
#define KBD4_T40 VK_F6
#define KBD4_T41 VK_F7
#define KBD4_T42 VK_F8
#define KBD4_T43 VK_F9
#define KBD4_T44 VK_F10
#define KBD4_T45 VK_NUMLOCK
#define KBD4_T46 VK_SCROLL
#define KBD4_T47 VK_NUMPAD7 /* VK_HOME */
#define KBD4_T48 VK_NUMPAD8 /* VK_UP */
#define KBD4_T49 VK_NUMPAD9 /* VK_PRIOR */
#define KBD4_T4A VK_SUBTRACT
#define KBD4_T4B VK_NUMPAD4 /* VK_LEFT */
#define KBD4_T4C VK_NUMPAD5 /* VK_CLEAR */
#define KBD4_T4D VK_NUMPAD6 /* VK_RIGHT */
#define KBD4_T4E VK_ADD
#define KBD4_T4F VK_NUMPAD1 /* VK_END */
#define KBD4_T50 VK_NUMPAD2 /* VK_DOWN */
#define KBD4_T51 VK_NUMPAD3 /* VK_NEXT */
#define KBD4_T52 VK_NUMPAD0 /* VK_INSERT */
#define KBD4_T53 VK_DECIMAL /* VK_DELETE */
#define KBD4_T54 VK_SNAPSHOT
#define KBD4_T55 VK_NONE
#define KBD4_T56 VK_OEM_102 /* NE */
#define KBD4_T57 VK_F11 /* NE */
#define KBD4_T58 VK_F12 /* NE */
#define KBD4_T59 VK_CLEAR
#define KBD4_T5A VK_OEM_WSCTRL
#define KBD4_T5B VK_OEM_FINISH
#define KBD4_T5C VK_OEM_JUMP
#define KBD4_T5D VK_EREOF
#define KBD4_T5E VK_OEM_BACKTAB
#define KBD4_T5F VK_OEM_AUTO
#define KBD4_T60 VK_NONE
#define KBD4_T61 VK_NONE
#define KBD4_T62 VK_ZOOM
#define KBD4_T63 VK_HELP
#define KBD4_T64 VK_F13
#define KBD4_T65 VK_F14
#define KBD4_T66 VK_F15
#define KBD4_T67 VK_F16
#define KBD4_T68 VK_F17
#define KBD4_T69 VK_F18
#define KBD4_T6A VK_F19
#define KBD4_T6B VK_F20
#define KBD4_T6C VK_F21
#define KBD4_T6D VK_F22
#define KBD4_T6E VK_F23
#define KBD4_T6F VK_OEM_PA3
#define KBD4_T70 VK_NONE
#define KBD4_T71 VK_OEM_RESET
#define KBD4_T72 VK_NONE
#define KBD4_T73 VK_ABNT_C1
#define KBD4_T74 VK_NONE
#define KBD4_T75 VK_NONE
#define KBD4_T76 VK_F24
#define KBD4_T77 VK_NONE
#define KBD4_T78 VK_NONE
#define KBD4_T79 VK_NONE
#define KBD4_T7A VK_NONE
#define KBD4_T7B VK_OEM_PA1
#define KBD4_T7C VK_TAB
#define KBD4_T7D VK_NONE
#define KBD4_T7E VK_ABNT_C2
#define KBD4_T7F VK_OEM_PA2
#define KBD4_X10 VK_MEDIA_PREV_TRACK
#define KBD4_X19 VK_MEDIA_NEXT_TRACK
#define KBD4_X1C VK_RETURN
#define KBD4_X1D VK_RCONTROL
#define KBD4_X20 VK_VOLUME_MUTE
#define KBD4_X21 VK_LAUNCH_APP2
#define KBD4_X22 VK_MEDIA_PLAY_PAUSE
#define KBD4_X24 VK_MEDIA_STOP
#define KBD4_X2E VK_VOLUME_DOWN
#define KBD4_X30 VK_VOLUME_UP
#define KBD4_X32 VK_BROWSER_HOME
#define KBD4_X35 VK_DIVIDE
#define KBD4_X37 VK_SNAPSHOT
#define KBD4_X38 VK_RMENU
#define KBD4_X46 VK_PAUSE /* VK_CANCEL */
#define KBD4_X47 VK_HOME
#define KBD4_X48 VK_UP
#define KBD4_X49 VK_PRIOR
#define KBD4_X4B VK_LEFT
#define KBD4_X4D VK_RIGHT
#define KBD4_X4F VK_END
#define KBD4_X50 VK_DOWN
#define KBD4_X51 VK_NEXT /* NE */
#define KBD4_X52 VK_INSERT
#define KBD4_X53 VK_DELETE
#define KBD4_X5B VK_LWIN
#define KBD4_X5C VK_RWIN
#define KBD4_X5D VK_APPS
#define KBD4_X5E VK_POWER
#define KBD4_X5F VK_SLEEP
#define KBD4_X65 VK_BROWSER_SEARCH
#define KBD4_X66 VK_BROWSER_FAVORITES
#define KBD4_X67 VK_BROWSER_REFRESH
#define KBD4_X68 VK_BROWSER_STOP
#define KBD4_X69 VK_BROWSER_FORWARD
#define KBD4_X6A VK_BROWSER_BACK
#define KBD4_X6B VK_LAUNCH_APP1
#define KBD4_X6C VK_LAUNCH_MAIL
#define KBD4_X6D VK_LAUNCH_MEDIA_SELECT
#define KBD4_Y1D VK_PAUSE
/**
* Keyboard Type 7
*/
#define KBD7_T00 VK_NONE
#define KBD7_T01 VK_ESCAPE
#define KBD7_T02 VK_KEY_1
#define KBD7_T03 VK_KEY_2
#define KBD7_T04 VK_KEY_3
#define KBD7_T05 VK_KEY_4
#define KBD7_T06 VK_KEY_5
#define KBD7_T07 VK_KEY_6
#define KBD7_T08 VK_KEY_7
#define KBD7_T09 VK_KEY_8
#define KBD7_T0A VK_KEY_9
#define KBD7_T0B VK_KEY_0
#define KBD7_T0C VK_OEM_MINUS
#define KBD7_T0D VK_OEM_7 /* NE */
#define KBD7_T0E VK_BACK
#define KBD7_T0F VK_TAB
#define KBD7_T10 VK_KEY_Q
#define KBD7_T11 VK_KEY_W
#define KBD7_T12 VK_KEY_E
#define KBD7_T13 VK_KEY_R
#define KBD7_T14 VK_KEY_T
#define KBD7_T15 VK_KEY_Y
#define KBD7_T16 VK_KEY_U
#define KBD7_T17 VK_KEY_I
#define KBD7_T18 VK_KEY_O
#define KBD7_T19 VK_KEY_P
#define KBD7_T1A VK_OEM_4 /* NE */
#define KBD7_T1B VK_OEM_6 /* NE */
#define KBD7_T1C VK_RETURN
#define KBD7_T1D VK_LCONTROL
#define KBD7_T1E VK_KEY_A
#define KBD7_T1F VK_KEY_S
#define KBD7_T20 VK_KEY_D
#define KBD7_T21 VK_KEY_F
#define KBD7_T22 VK_KEY_G
#define KBD7_T23 VK_KEY_H
#define KBD7_T24 VK_KEY_J
#define KBD7_T25 VK_KEY_K
#define KBD7_T26 VK_KEY_L
#define KBD7_T27 VK_OEM_PLUS /* NE */
#define KBD7_T28 VK_OEM_1 /* NE */
#define KBD7_T29 VK_OEM_3 /* NE */
#define KBD7_T2A VK_LSHIFT
#define KBD7_T2B VK_OEM_5 /* NE */
#define KBD7_T2C VK_KEY_Z
#define KBD7_T2D VK_KEY_X
#define KBD7_T2E VK_KEY_C
#define KBD7_T2F VK_KEY_V
#define KBD7_T30 VK_KEY_B
#define KBD7_T31 VK_KEY_N
#define KBD7_T32 VK_KEY_M
#define KBD7_T33 VK_OEM_COMMA
#define KBD7_T34 VK_OEM_PERIOD
#define KBD7_T35 VK_OEM_2
#define KBD7_T36 VK_RSHIFT
#define KBD7_T37 VK_MULTIPLY
#define KBD7_T38 VK_LMENU
#define KBD7_T39 VK_SPACE
#define KBD7_T3A VK_DBE_ALPHANUMERIC /* NE */
#define KBD7_T3B VK_F1
#define KBD7_T3C VK_F2
#define KBD7_T3D VK_F3
#define KBD7_T3E VK_F4
#define KBD7_T3F VK_F5
#define KBD7_T40 VK_F6
#define KBD7_T41 VK_F7
#define KBD7_T42 VK_F8
#define KBD7_T43 VK_F9
#define KBD7_T44 VK_F10
#define KBD7_T45 VK_NUMLOCK
#define KBD7_T46 VK_SCROLL
#define KBD7_T47 VK_HOME
#define KBD7_T48 VK_UP
#define KBD7_T49 VK_PRIOR
#define KBD7_T4A VK_SUBTRACT
#define KBD7_T4B VK_LEFT
#define KBD7_T4C VK_CLEAR
#define KBD7_T4D VK_RIGHT
#define KBD7_T4E VK_ADD
#define KBD7_T4F VK_END
#define KBD7_T50 VK_DOWN
#define KBD7_T51 VK_NEXT
#define KBD7_T52 VK_INSERT
#define KBD7_T53 VK_DELETE
#define KBD7_T54 VK_SNAPSHOT
#define KBD7_T55 VK_NONE
#define KBD7_T56 VK_NONE /* NE */
#define KBD7_T57 VK_F11
#define KBD7_T58 VK_F12
#define KBD7_T59 VK_CLEAR
#define KBD7_T5A VK_NONAME /* NE */
#define KBD7_T5B VK_NONAME /* NE */
#define KBD7_T5C VK_NONAME /* NE */
#define KBD7_T5D VK_EREOF
#define KBD7_T5E VK_NONE /* NE */
#define KBD7_T5F VK_NONAME /* NE */
#define KBD7_T60 VK_NONE
#define KBD7_T61 VK_NONE /* NE */
#define KBD7_T62 VK_NONE /* NE */
#define KBD7_T63 VK_NONE
#define KBD7_T64 VK_F13
#define KBD7_T65 VK_F14
#define KBD7_T66 VK_F15
#define KBD7_T67 VK_F16
#define KBD7_T68 VK_F17
#define KBD7_T69 VK_F18
#define KBD7_T6A VK_F19
#define KBD7_T6B VK_F20
#define KBD7_T6C VK_F21
#define KBD7_T6D VK_F22
#define KBD7_T6E VK_F23
#define KBD7_T6F VK_NONE /* NE */
#define KBD7_T70 VK_DBE_KATAKANA /* NE */
#define KBD7_T71 VK_NONE /* NE */
#define KBD7_T72 VK_NONE
#define KBD7_T73 VK_OEM_102 /* NE */
#define KBD7_T74 VK_NONE
#define KBD7_T75 VK_NONE
#define KBD7_T76 VK_F24
#define KBD7_T77 VK_DBE_SBCSCHAR /* NE */
#define KBD7_T78 VK_NONE
#define KBD7_T79 VK_CONVERT /* NE */
#define KBD7_T7A VK_NONE
#define KBD7_T7B VK_NONCONVERT /* NE */
#define KBD7_T7C VK_TAB
#define KBD7_T7D VK_NONE /* NE */
#define KBD7_T7E VK_ABNT_C2
#define KBD7_T7F VK_OEM_PA2
#define KBD7_X10 VK_MEDIA_PREV_TRACK
#define KBD7_X19 VK_MEDIA_NEXT_TRACK
#define KBD7_X1C VK_RETURN
#define KBD7_X1D VK_RCONTROL /* NE */
#define KBD7_X20 VK_VOLUME_MUTE
#define KBD7_X21 VK_LAUNCH_APP2
#define KBD7_X22 VK_MEDIA_PLAY_PAUSE
#define KBD7_X24 VK_MEDIA_STOP
#define KBD7_X2E VK_VOLUME_DOWN
#define KBD7_X30 VK_VOLUME_UP
#define KBD7_X32 VK_BROWSER_HOME
#define KBD7_X33 VK_OEM_8 /* NE */
#define KBD7_X35 VK_DIVIDE
#define KBD7_X37 VK_SNAPSHOT
#define KBD7_X38 VK_DBE_HIRAGANA /* NE */
#define KBD7_X42 VK_NONE
#define KBD7_X43 VK_NONE
#define KBD7_X44 VK_NONE
#define KBD7_X46 VK_CANCEL
#define KBD7_X47 VK_HOME
#define KBD7_X48 VK_UP
#define KBD7_X49 VK_PRIOR
#define KBD7_X4B VK_LEFT
#define KBD7_X4D VK_RIGHT
#define KBD7_X4F VK_END
#define KBD7_X50 VK_DOWN
#define KBD7_X51 VK_NEXT
#define KBD7_X52 VK_INSERT
#define KBD7_X53 VK_DELETE
#define KBD7_X5B VK_LWIN
#define KBD7_X5C VK_RWIN
#define KBD7_X5D VK_APPS
#define KBD7_X5E VK_POWER
#define KBD7_X5F VK_SLEEP
#define KBD7_X65 VK_BROWSER_SEARCH
#define KBD7_X66 VK_BROWSER_FAVORITES
#define KBD7_X67 VK_BROWSER_REFRESH
#define KBD7_X68 VK_BROWSER_STOP
#define KBD7_X69 VK_BROWSER_FORWARD
#define KBD7_X6A VK_BROWSER_BACK
#define KBD7_X6B VK_LAUNCH_APP1
#define KBD7_X6C VK_LAUNCH_MAIL
#define KBD7_X6D VK_LAUNCH_MEDIA_SELECT
#define KBD7_XF1 VK_NONE /* NE */
#define KBD7_XF2 VK_NONE /* NE */
#define KBD7_Y1D VK_PAUSE
/**
* X11 Keycodes
*/
/**
* Mac OS X
*/
#define APPLE_VK_ANSI_A 0x00
#define APPLE_VK_ANSI_S 0x01
#define APPLE_VK_ANSI_D 0x02
#define APPLE_VK_ANSI_F 0x03
#define APPLE_VK_ANSI_H 0x04
#define APPLE_VK_ANSI_G 0x05
#define APPLE_VK_ANSI_Z 0x06
#define APPLE_VK_ANSI_X 0x07
#define APPLE_VK_ANSI_C 0x08
#define APPLE_VK_ANSI_V 0x09
#define APPLE_VK_ISO_Section 0x0A
#define APPLE_VK_ANSI_B 0x0B
#define APPLE_VK_ANSI_Q 0x0C
#define APPLE_VK_ANSI_W 0x0D
#define APPLE_VK_ANSI_E 0x0E
#define APPLE_VK_ANSI_R 0x0F
#define APPLE_VK_ANSI_Y 0x10
#define APPLE_VK_ANSI_T 0x11
#define APPLE_VK_ANSI_1 0x12
#define APPLE_VK_ANSI_2 0x13
#define APPLE_VK_ANSI_3 0x14
#define APPLE_VK_ANSI_4 0x15
#define APPLE_VK_ANSI_6 0x16
#define APPLE_VK_ANSI_5 0x17
#define APPLE_VK_ANSI_Equal 0x18
#define APPLE_VK_ANSI_9 0x19
#define APPLE_VK_ANSI_7 0x1A
#define APPLE_VK_ANSI_Minus 0x1B
#define APPLE_VK_ANSI_8 0x1C
#define APPLE_VK_ANSI_0 0x1D
#define APPLE_VK_ANSI_RightBracket 0x1E
#define APPLE_VK_ANSI_O 0x1F
#define APPLE_VK_ANSI_U 0x20
#define APPLE_VK_ANSI_LeftBracket 0x21
#define APPLE_VK_ANSI_I 0x22
#define APPLE_VK_ANSI_P 0x23
#define APPLE_VK_Return 0x24
#define APPLE_VK_ANSI_L 0x25
#define APPLE_VK_ANSI_J 0x26
#define APPLE_VK_ANSI_Quote 0x27
#define APPLE_VK_ANSI_K 0x28
#define APPLE_VK_ANSI_Semicolon 0x29
#define APPLE_VK_ANSI_Backslash 0x2A
#define APPLE_VK_ANSI_Comma 0x2B
#define APPLE_VK_ANSI_Slash 0x2C
#define APPLE_VK_ANSI_N 0x2D
#define APPLE_VK_ANSI_M 0x2E
#define APPLE_VK_ANSI_Period 0x2F
#define APPLE_VK_Tab 0x30
#define APPLE_VK_Space 0x31
#define APPLE_VK_ANSI_Grave 0x32
#define APPLE_VK_Delete 0x33
#define APPLE_VK_0x34 0x34
#define APPLE_VK_Escape 0x35
#define APPLE_VK_0x36 0x36
#define APPLE_VK_Command 0x37
#define APPLE_VK_Shift 0x38
#define APPLE_VK_CapsLock 0x39
#define APPLE_VK_Option 0x3A
#define APPLE_VK_Control 0x3B
#define APPLE_VK_RightShift 0x3C
#define APPLE_VK_RightOption 0x3D
#define APPLE_VK_RightControl 0x3E
#define APPLE_VK_Function 0x3F
#define APPLE_VK_F17 0x40
#define APPLE_VK_ANSI_KeypadDecimal 0x41
#define APPLE_VK_0x42 0x42
#define APPLE_VK_ANSI_KeypadMultiply 0x43
#define APPLE_VK_0x44 0x44
#define APPLE_VK_ANSI_KeypadPlus 0x45
#define APPLE_VK_0x46 0x46
#define APPLE_VK_ANSI_KeypadClear 0x47
#define APPLE_VK_VolumeUp 0x48
#define APPLE_VK_VolumeDown 0x49
#define APPLE_VK_Mute 0x4A
#define APPLE_VK_ANSI_KeypadDivide 0x4B
#define APPLE_VK_ANSI_KeypadEnter 0x4C
#define APPLE_VK_0x4D 0x4D
#define APPLE_VK_ANSI_KeypadMinus 0x4E
#define APPLE_VK_F18 0x4F
#define APPLE_VK_F19 0x50
#define APPLE_VK_ANSI_KeypadEquals 0x51
#define APPLE_VK_ANSI_Keypad0 0x52
#define APPLE_VK_ANSI_Keypad1 0x53
#define APPLE_VK_ANSI_Keypad2 0x54
#define APPLE_VK_ANSI_Keypad3 0x55
#define APPLE_VK_ANSI_Keypad4 0x56
#define APPLE_VK_ANSI_Keypad5 0x57
#define APPLE_VK_ANSI_Keypad6 0x58
#define APPLE_VK_ANSI_Keypad7 0x59
#define APPLE_VK_F20 0x5A
#define APPLE_VK_ANSI_Keypad8 0x5B
#define APPLE_VK_ANSI_Keypad9 0x5C
#define APPLE_VK_JIS_Yen 0x5D
#define APPLE_VK_JIS_Underscore 0x5E
#define APPLE_VK_JIS_KeypadComma 0x5F
#define APPLE_VK_F5 0x60
#define APPLE_VK_F6 0x61
#define APPLE_VK_F7 0x62
#define APPLE_VK_F3 0x63
#define APPLE_VK_F8 0x64
#define APPLE_VK_F9 0x65
#define APPLE_VK_JIS_Eisu 0x66
#define APPLE_VK_F11 0x67
#define APPLE_VK_JIS_Kana 0x68
#define APPLE_VK_F13 0x69
#define APPLE_VK_F16 0x6A
#define APPLE_VK_F14 0x6B
#define APPLE_VK_F10 0x6D
#define APPLE_VK_0x6C 0x6C
#define APPLE_VK_0x6E 0x6E
#define APPLE_VK_F12 0x6F
#define APPLE_VK_0x70 0x70
#define APPLE_VK_F15 0x71
#define APPLE_VK_Help 0x72
#define APPLE_VK_Home 0x73
#define APPLE_VK_PageUp 0x74
#define APPLE_VK_ForwardDelete 0x75
#define APPLE_VK_F4 0x76
#define APPLE_VK_End 0x77
#define APPLE_VK_F2 0x78
#define APPLE_VK_PageDown 0x79
#define APPLE_VK_F1 0x7A
#define APPLE_VK_LeftArrow 0x7B
#define APPLE_VK_RightArrow 0x7C
#define APPLE_VK_DownArrow 0x7D
#define APPLE_VK_UpArrow 0x7E
/**
* Functions
*/
WINPR_API char* GetVirtualKeyName(DWORD vkcode);
WINPR_API DWORD GetVirtualKeyCodeFromName(const char* vkname);
WINPR_API DWORD GetVirtualKeyCodeFromXkbKeyName(const char* xkbname);
WINPR_API DWORD GetVirtualKeyCodeFromVirtualScanCode(DWORD scancode, DWORD dwKeyboardType);
WINPR_API DWORD GetVirtualScanCodeFromVirtualKeyCode(DWORD vkcode, DWORD dwKeyboardType);
#define KEYCODE_TYPE_APPLE 0x00000001
#define KEYCODE_TYPE_EVDEV 0x00000002
WINPR_API DWORD GetVirtualKeyCodeFromKeycode(DWORD keycode, DWORD dwFlags);
#endif /* WINPR_INPUT_H */

View File

@ -27,4 +27,6 @@
WINPR_API void winpr_HexDump(BYTE* data, int length);
WINPR_API int wprintfx(const char *fmt, ...);
#endif /* WINPR_UTILS_PRINT_H */

View File

@ -0,0 +1,45 @@
# WinPR: Windows Portable Runtime
# libwinpr-input cmake build script
#
# Copyright 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.
set(MODULE_NAME "winpr-input")
set(MODULE_PREFIX "WINPR_INPUT")
set(${MODULE_PREFIX}_SRCS
virtualkey.c
scancode.c
keycode.c)
add_complex_library(MODULE ${MODULE_NAME} TYPE "OBJECT"
MONOLITHIC ${MONOLITHIC_BUILD}
SOURCES ${${MODULE_PREFIX}_SRCS})
set_target_properties(${MODULE_NAME} PROPERTIES VERSION ${WINPR_VERSION_FULL} SOVERSION ${WINPR_VERSION} PREFIX "lib")
set_complex_link_libraries(VARIABLE ${MODULE_PREFIX}_LIBS
MONOLITHIC ${MONOLITHIC_BUILD} INTERNAL
MODULE winpr
MODULES winpr-crt)
if(MONOLITHIC_BUILD)
else()
target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS})
install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif()
set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "WinPR")

View File

@ -0,0 +1,9 @@
set(MINWIN_LAYER "1")
set(MINWIN_GROUP "core")
set(MINWIN_MAJOR_VERSION "1")
set(MINWIN_MINOR_VERSION "0")
set(MINWIN_SHORT_NAME "input")
set(MINWIN_LONG_NAME "Input Functions")
set(MODULE_LIBRARY_NAME "input")

View File

@ -0,0 +1,586 @@
/**
* WinPR: Windows Portable Runtime
* Keyboard Input
*
* Copyright 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.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <winpr/crt.h>
#include <winpr/input.h>
/**
* X11 Keycodes
*/
/**
* Mac OS X
*/
DWORD KEYCODE_TO_VKCODE_APPLE[256] =
{
0, /* 0 */
0, /* 1 */
0, /* 2 */
0, /* 3 */
0, /* 4 */
0, /* 5 */
0, /* 6 */
0, /* 7 */
VK_KEY_A, /* APPLE_VK_ANSI_A (0x00) */
VK_KEY_S, /* APPLE_VK_ANSI_S (0x01) */
VK_KEY_D, /* APPLE_VK_ANSI_D (0x02) */
VK_KEY_F, /* APPLE_VK_ANSI_F (0x03) */
VK_KEY_H, /* APPLE_VK_ANSI_H (0x04) */
VK_KEY_G, /* APPLE_VK_ANSI_G (0x05) */
VK_KEY_Z, /* APPLE_VK_ANSI_Z (0x06) */
VK_KEY_X, /* APPLE_VK_ANSI_X (0x07) */
VK_KEY_C, /* APPLE_VK_ANSI_C (0x08) */
VK_KEY_V, /* APPLE_VK_ANSI_V (0x09) */
VK_OEM_102, /* APPLE_VK_ISO_Section (0x0A) */
VK_KEY_B, /* APPLE_VK_ANSI_B (0x0B) */
VK_KEY_Q, /* APPLE_VK_ANSI_Q (0x0C) */
VK_KEY_W, /* APPLE_VK_ANSI_W (0x0D) */
VK_KEY_E, /* APPLE_VK_ANSI_E (0x0E) */
VK_KEY_R, /* APPLE_VK_ANSI_R (0x0F) */
VK_KEY_Y, /* APPLE_VK_ANSI_Y (0x10) */
VK_KEY_T, /* APPLE_VK_ANSI_T (0x11) */
VK_KEY_1, /* APPLE_VK_ANSI_1 (0x12) */
VK_KEY_2, /* APPLE_VK_ANSI_2 (0x13) */
VK_KEY_3, /* APPLE_VK_ANSI_3 (0x14) */
VK_KEY_4, /* APPLE_VK_ANSI_4 (0x15) */
VK_KEY_6, /* APPLE_VK_ANSI_6 (0x16) */
VK_KEY_5, /* APPLE_VK_ANSI_5 (0x17) */
VK_OEM_PLUS, /* APPLE_VK_ANSI_Equal (0x18) */
VK_KEY_9, /* APPLE_VK_ANSI_9 (0x19) */
VK_KEY_7, /* APPLE_VK_ANSI_7 (0x1A) */
VK_OEM_MINUS, /* APPLE_VK_ANSI_Minus (0x1B) */
VK_KEY_8, /* APPLE_VK_ANSI_8 (0x1C) */
VK_KEY_0, /* APPLE_VK_ANSI_0 (0x1D) */
VK_OEM_6, /* APPLE_VK_ANSI_RightBracket (0x1E) */
VK_KEY_O, /* APPLE_VK_ANSI_O (0x1F) */
VK_KEY_U, /* APPLE_VK_ANSI_U (0x20) */
VK_OEM_4, /* APPLE_VK_ANSI_LeftBracket (0x21) */
VK_KEY_I, /* APPLE_VK_ANSI_I (0x22) */
VK_KEY_P, /* APPLE_VK_ANSI_P (0x23) */
VK_RETURN, /* APPLE_VK_Return (0x24) */
VK_KEY_L, /* APPLE_VK_ANSI_L (0x25) */
VK_KEY_J, /* APPLE_VK_ANSI_J (0x26) */
VK_OEM_7, /* APPLE_VK_ANSI_Quote (0x27) */
VK_KEY_K, /* APPLE_VK_ANSI_K (0x28) */
VK_OEM_1, /* APPLE_VK_ANSI_Semicolon (0x29) */
VK_OEM_5, /* APPLE_VK_ANSI_Backslash (0x2A) */
VK_OEM_COMMA, /* APPLE_VK_ANSI_Comma (0x2B) */
VK_OEM_2, /* APPLE_VK_ANSI_Slash (0x2C) */
VK_KEY_N, /* APPLE_VK_ANSI_N (0x2D) */
VK_KEY_M, /* APPLE_VK_ANSI_M (0x2E) */
VK_OEM_PERIOD, /* APPLE_VK_ANSI_Period (0x2F) */
VK_TAB, /* APPLE_VK_Tab (0x30) */
VK_SPACE, /* APPLE_VK_Space (0x31) */
VK_OEM_3, /* APPLE_VK_ANSI_Grave (0x32) */
VK_BACK, /* APPLE_VK_Delete (0x33) */
0, /* APPLE_VK_0x34 (0x34) */
VK_ESCAPE, /* APPLE_VK_Escape (0x35) */
0, /* APPLE_VK_0x36 (0x36) */
VK_LWIN, /* APPLE_VK_Command (0x37) */
VK_LSHIFT, /* APPLE_VK_Shift (0x38) */
VK_CAPITAL, /* APPLE_VK_CapsLock (0x39) */
VK_LMENU, /* APPLE_VK_Option (0x3A) */
VK_LCONTROL, /* APPLE_VK_Control (0x3B) */
VK_RSHIFT, /* APPLE_VK_RightShift (0x3C) */
VK_RMENU, /* APPLE_VK_RightOption (0x3D) */
0, /* APPLE_VK_RightControl (0x3E) */
VK_RWIN, /* APPLE_VK_Function (0x3F) */
0, /* APPLE_VK_F17 (0x40) */
VK_DECIMAL, /* APPLE_VK_ANSI_KeypadDecimal (0x41) */
0, /* APPLE_VK_0x42 (0x42) */
VK_MULTIPLY, /* APPLE_VK_ANSI_KeypadMultiply (0x43) */
0, /* APPLE_VK_0x44 (0x44) */
VK_ADD, /* APPLE_VK_ANSI_KeypadPlus (0x45) */
0, /* APPLE_VK_0x46 (0x46) */
VK_NUMLOCK, /* APPLE_VK_ANSI_KeypadClear (0x47) */
0, /* APPLE_VK_VolumeUp (0x48) */
0, /* APPLE_VK_VolumeDown (0x49) */
0, /* APPLE_VK_Mute (0x4A) */
VK_DIVIDE, /* APPLE_VK_ANSI_KeypadDivide (0x4B) */
VK_RETURN, /* APPLE_VK_ANSI_KeypadEnter (0x4C) */
0, /* APPLE_VK_0x4D (0x4D) */
VK_SUBTRACT, /* APPLE_VK_ANSI_KeypadMinus (0x4E) */
0, /* APPLE_VK_F18 (0x4F) */
0, /* APPLE_VK_F19 (0x50) */
0, /* APPLE_VK_ANSI_KeypadEquals (0x51) */
VK_NUMPAD0, /* APPLE_VK_ANSI_Keypad0 (0x52) */
VK_NUMPAD1, /* APPLE_VK_ANSI_Keypad1 (0x53) */
VK_NUMPAD2, /* APPLE_VK_ANSI_Keypad2 (0x54) */
VK_NUMPAD3, /* APPLE_VK_ANSI_Keypad3 (0x55) */
VK_NUMPAD4, /* APPLE_VK_ANSI_Keypad4 (0x56) */
VK_NUMPAD5, /* APPLE_VK_ANSI_Keypad5 (0x57) */
VK_NUMPAD6, /* APPLE_VK_ANSI_Keypad6 (0x58) */
VK_NUMPAD7, /* APPLE_VK_ANSI_Keypad7 (0x59) */
0, /* APPLE_VK_F20 (0x5A) */
VK_NUMPAD8, /* APPLE_VK_ANSI_Keypad8 (0x5B) */
VK_NUMPAD9, /* APPLE_VK_ANSI_Keypad9 (0x5C) */
0, /* APPLE_VK_JIS_Yen (0x5D) */
0, /* APPLE_VK_JIS_Underscore (0x5E) */
0, /* APPLE_VK_JIS_KeypadComma (0x5F) */
VK_F5, /* APPLE_VK_F5 (0x60) */
VK_F6, /* APPLE_VK_F6 (0x61) */
VK_F7, /* APPLE_VK_F7 (0x62) */
VK_F3, /* APPLE_VK_F3 (0x63) */
VK_F8, /* APPLE_VK_F8 (0x64) */
VK_F9, /* APPLE_VK_F9 (0x65) */
0, /* APPLE_VK_JIS_Eisu (0x66) */
VK_F11, /* APPLE_VK_F11 (0x67) */
0, /* APPLE_VK_JIS_Kana (0x68) */
VK_SNAPSHOT, /* APPLE_VK_F13 (0x69) */
0, /* APPLE_VK_F16 (0x6A) */
VK_SCROLL, /* APPLE_VK_F14 (0x6B) */
0, /* APPLE_VK_0x6C (0x6C) */
VK_F10, /* APPLE_VK_F10 (0x6D) */
0, /* APPLE_VK_0x6E (0x6E) */
VK_F12, /* APPLE_VK_F12 (0x6F) */
0, /* APPLE_VK_0x70 (0x70) */
VK_PAUSE, /* APPLE_VK_F15 (0x71) */
VK_INSERT, /* APPLE_VK_Help (0x72) */
VK_HOME, /* APPLE_VK_Home (0x73) */
VK_PRIOR, /* APPLE_VK_PageUp (0x74) */
VK_DELETE, /* APPLE_VK_ForwardDelete (0x75) */
VK_F4, /* APPLE_VK_F4 (0x76) */
VK_END, /* APPLE_VK_End (0x77) */
VK_F2, /* APPLE_VK_F2 (0x78) */
VK_NEXT, /* APPLE_VK_PageDown (0x79) */
VK_F1, /* APPLE_VK_F1 (0x7A) */
VK_LEFT, /* APPLE_VK_LeftArrow (0x7B) */
VK_RIGHT, /* APPLE_VK_RightArrow (0x7C) */
VK_DOWN, /* APPLE_VK_DownArrow (0x7D) */
VK_UP, /* APPLE_VK_UpArrow (0x7E) */
0, /* 135 */
0, /* 136 */
0, /* 137 */
0, /* 138 */
0, /* 139 */
0, /* 140 */
0, /* 141 */
0, /* 142 */
0, /* 143 */
0, /* 144 */
0, /* 145 */
0, /* 146 */
0, /* 147 */
0, /* 148 */
0, /* 149 */
0, /* 150 */
0, /* 151 */
0, /* 152 */
0, /* 153 */
0, /* 154 */
0, /* 155 */
0, /* 156 */
0, /* 157 */
0, /* 158 */
0, /* 159 */
0, /* 160 */
0, /* 161 */
0, /* 162 */
0, /* 163 */
0, /* 164 */
0, /* 165 */
0, /* 166 */
0, /* 167 */
0, /* 168 */
0, /* 169 */
0, /* 170 */
0, /* 171 */
0, /* 172 */
0, /* 173 */
0, /* 174 */
0, /* 175 */
0, /* 176 */
0, /* 177 */
0, /* 178 */
0, /* 179 */
0, /* 180 */
0, /* 181 */
0, /* 182 */
0, /* 183 */
0, /* 184 */
0, /* 185 */
0, /* 186 */
0, /* 187 */
0, /* 188 */
0, /* 189 */
0, /* 190 */
0, /* 191 */
0, /* 192 */
0, /* 193 */
0, /* 194 */
0, /* 195 */
0, /* 196 */
0, /* 197 */
0, /* 198 */
0, /* 199 */
0, /* 200 */
0, /* 201 */
0, /* 202 */
0, /* 203 */
0, /* 204 */
0, /* 205 */
0, /* 206 */
0, /* 207 */
0, /* 208 */
0, /* 209 */
0, /* 210 */
0, /* 211 */
0, /* 212 */
0, /* 213 */
0, /* 214 */
0, /* 215 */
0, /* 216 */
0, /* 217 */
0, /* 218 */
0, /* 219 */
0, /* 220 */
0, /* 221 */
0, /* 222 */
0, /* 223 */
0, /* 224 */
0, /* 225 */
0, /* 226 */
0, /* 227 */
0, /* 228 */
0, /* 229 */
0, /* 230 */
0, /* 231 */
0, /* 232 */
0, /* 233 */
0, /* 234 */
0, /* 235 */
0, /* 236 */
0, /* 237 */
0, /* 238 */
0, /* 239 */
0, /* 240 */
0, /* 241 */
0, /* 242 */
0, /* 243 */
0, /* 244 */
0, /* 245 */
0, /* 246 */
0, /* 247 */
0, /* 248 */
0, /* 249 */
0, /* 250 */
0, /* 251 */
0, /* 252 */
0, /* 253 */
0, /* 254 */
0 /* 255 */
};
/**
* evdev (Linux)
*
* Refer to X Keyboard Configuration Database:
* http://www.freedesktop.org/wiki/Software/XKeyboardConfig
*/
/* TODO: Finish Japanese Keyboard */
DWORD KEYCODE_TO_VKCODE_EVDEV[256] =
{
0, /* 0 */
0, /* 1 */
0, /* 2 */
0, /* 3 */
0, /* 4 */
0, /* 5 */
0, /* 6 */
0, /* 7 */
0, /* 8 */
VK_ESCAPE, /* <ESC> 9 */
VK_KEY_1, /* <AE01> 10 */
VK_KEY_2, /* <AE02> 11 */
VK_KEY_3, /* <AE03> 12 */
VK_KEY_4, /* <AE04> 13 */
VK_KEY_5, /* <AE05> 14 */
VK_KEY_6, /* <AE06> 15 */
VK_KEY_7, /* <AE07> 16 */
VK_KEY_8, /* <AE08> 17 */
VK_KEY_9, /* <AE09> 18 */
VK_KEY_0, /* <AE10> 19 */
VK_OEM_MINUS, /* <AE11> 20 */
VK_OEM_PLUS, /* <AE12> 21 */
VK_BACK, /* <BKSP> 22 */
VK_TAB, /* <TAB> 23 */
VK_KEY_Q, /* <AD01> 24 */
VK_KEY_W, /* <AD02> 25 */
VK_KEY_E, /* <AD03> 26 */
VK_KEY_R, /* <AD04> 27 */
VK_KEY_T, /* <AD05> 28 */
VK_KEY_Y, /* <AD06> 29 */
VK_KEY_U, /* <AD07> 30 */
VK_KEY_I, /* <AD08> 31 */
VK_KEY_O, /* <AD09> 32 */
VK_KEY_P, /* <AD10> 33 */
VK_OEM_4, /* <AD11> 34 */
VK_OEM_6, /* <AD12> 35 */
VK_RETURN, /* <RTRN> 36 */
VK_LCONTROL, /* <LCTL> 37 */
VK_KEY_A, /* <AC01> 38 */
VK_KEY_S, /* <AC02> 39 */
VK_KEY_D, /* <AC03> 40 */
VK_KEY_F, /* <AC04> 41 */
VK_KEY_G, /* <AC05> 42 */
VK_KEY_H, /* <AC06> 43 */
VK_KEY_J, /* <AC07> 44 */
VK_KEY_K, /* <AC08> 45 */
VK_KEY_L, /* <AC09> 46 */
VK_OEM_1, /* <AC10> 47 */
VK_OEM_7, /* <AC11> 48 */
VK_OEM_3, /* <TLDE> 49 */
VK_LSHIFT, /* <LFSH> 50 */
VK_OEM_5, /* <BKSL> <AC12> 51 */
VK_KEY_Z, /* <AB01> 52 */
VK_KEY_X, /* <AB02> 53 */
VK_KEY_C, /* <AB03> 54 */
VK_KEY_V, /* <AB04> 55 */
VK_KEY_B, /* <AB05> 56 */
VK_KEY_N, /* <AB06> 57 */
VK_KEY_M, /* <AB07> 58 */
VK_OEM_COMMA, /* <AB08> 59 */
VK_OEM_PERIOD, /* <AB09> 60 */
VK_OEM_2, /* <AB10> 61 */
VK_RSHIFT, /* <RTSH> 62 */
VK_MULTIPLY, /* <KPMU> 63 */
VK_LMENU, /* <LALT> 64 */
VK_SPACE, /* <SPCE> 65 */
VK_CAPITAL, /* <CAPS> 66 */
VK_F1, /* <FK01> 67 */
VK_F2, /* <FK02> 68 */
VK_F3, /* <FK03> 69 */
VK_F4, /* <FK04> 70 */
VK_F5, /* <FK05> 71 */
VK_F6, /* <FK06> 72 */
VK_F7, /* <FK07> 73 */
VK_F8, /* <FK08> 74 */
VK_F9, /* <FK09> 75 */
VK_F10, /* <FK10> 76 */
VK_NUMLOCK, /* <NMLK> 77 */
VK_SCROLL, /* <SCLK> 78 */
VK_NUMPAD7, /* <KP7> 79 */
VK_NUMPAD8, /* <KP8> 80 */
VK_NUMPAD9, /* <KP9> 81 */
VK_SUBTRACT, /* <KPSU> 82 */
VK_NUMPAD4, /* <KP4> 83 */
VK_NUMPAD5, /* <KP5> 84 */
VK_NUMPAD6, /* <KP6> 85 */
VK_ADD, /* <KPAD> 86 */
VK_NUMPAD1, /* <KP1> 87 */
VK_NUMPAD2, /* <KP2> 88 */
VK_NUMPAD3, /* <KP3> 89 */
VK_NUMPAD0, /* <KP0> 90 */
VK_DECIMAL, /* <KPDL> 91 */
0, /* <LVL3> 92 */
0, /* 93 */
VK_OEM_102, /* <LSGT> 94 */
VK_F11, /* <FK11> 95 */
VK_F12, /* <FK12> 96 */
VK_ABNT_C1, /* <AB11> 97 */
0, /* <KATA> 98 */
0, /* <HIRA> 99 */
0, /* <HENK> 100 */
VK_DBE_HIRAGANA, /* <HKTG> 101 */
0, /* <MUHE> 102 */
0, /* <JPCM> 103 */
VK_RETURN | KBDEXT, /* <KPEN> 104 */
VK_RCONTROL | KBDEXT, /* <RCTL> 105 */
VK_DIVIDE | KBDEXT, /* <KPDV> 106 */
VK_SNAPSHOT | KBDEXT, /* <PRSC> 107 */
VK_RMENU | KBDEXT, /* <RALT> <ALGR> 108 */
0, /* <LNFD> KEY_LINEFEED 109 */
VK_HOME | KBDEXT, /* <HOME> 110 */
VK_UP | KBDEXT, /* <UP> 111 */
VK_PRIOR | KBDEXT, /* <PGUP> 112 */
VK_LEFT | KBDEXT, /* <LEFT> 113 */
VK_RIGHT | KBDEXT, /* <RGHT> 114 */
VK_END | KBDEXT, /* <END> 115 */
VK_DOWN | KBDEXT, /* <DOWN> 116 */
VK_NEXT | KBDEXT, /* <PGDN> 117 */
VK_INSERT | KBDEXT, /* <INS> 118 */
VK_DELETE | KBDEXT, /* <DELE> 119 */
0, /* <I120> KEY_MACRO 120 */
0, /* <MUTE> 121 */
0, /* <VOL-> 122 */
0, /* <VOL+> 123 */
0, /* <POWR> 124 */
0, /* <KPEQ> 125 */
0, /* <I126> KEY_KPPLUSMINUS 126 */
VK_PAUSE | KBDEXT, /* <PAUS> 127 */
0, /* <I128> KEY_SCALE 128 */
VK_ABNT_C2, /* <I129> <KPPT> KEY_KPCOMMA 129 */
0, /* <HNGL> 130 */
0, /* <HJCV> 131 */
0, /* <AE13> 132 */
VK_LWIN | KBDEXT, /* <LWIN> <LMTA> 133 */
VK_RWIN | KBDEXT, /* <RWIN> <RMTA> 134 */
VK_APPS | KBDEXT, /* <COMP> <MENU> 135 */
0, /* <STOP> 136 */
0, /* <AGAI> 137 */
0, /* <PROP> 138 */
0, /* <UNDO> 139 */
0, /* <FRNT> 140 */
0, /* <COPY> 141 */
0, /* <OPEN> 142 */
0, /* <PAST> 143 */
0, /* <FIND> 144 */
0, /* <CUT> 145 */
0, /* <HELP> 146 */
0, /* <I147> KEY_MENU 147 */
0, /* <I148> KEY_CALC 148 */
0, /* <I149> KEY_SETUP 149 */
0, /* <I150> KEY_SLEEP 150 */
0, /* <I151> KEY_WAKEUP 151 */
0, /* <I152> KEY_FILE 152 */
0, /* <I153> KEY_SEND 153 */
0, /* <I154> KEY_DELETEFILE 154 */
0, /* <I155> KEY_XFER 155 */
0, /* <I156> KEY_PROG1 156 */
0, /* <I157> KEY_PROG2 157 */
0, /* <I158> KEY_WWW 158 */
0, /* <I159> KEY_MSDOS 159 */
0, /* <I160> KEY_COFFEE 160 */
0, /* <I161> KEY_DIRECTION 161 */
0, /* <I162> KEY_CYCLEWINDOWS 162 */
0, /* <I163> KEY_MAIL 163 */
0, /* <I164> KEY_BOOKMARKS 164 */
0, /* <I165> KEY_COMPUTER 165 */
0, /* <I166> KEY_BACK 166 */
0, /* <I167> KEY_FORWARD 167 */
0, /* <I168> KEY_CLOSECD 168 */
0, /* <I169> KEY_EJECTCD 169 */
0, /* <I170> KEY_EJECTCLOSECD 170 */
0, /* <I171> KEY_NEXTSONG 171 */
0, /* <I172> KEY_PLAYPAUSE 172 */
0, /* <I173> KEY_PREVIOUSSONG 173 */
0, /* <I174> KEY_STOPCD 174 */
0, /* <I175> KEY_RECORD 175 */
0, /* <I176> KEY_REWIND 176 */
0, /* <I177> KEY_PHONE 177 */
0, /* <I178> KEY_ISO 178 */
0, /* <I179> KEY_CONFIG 179 */
0, /* <I180> KEY_HOMEPAGE 180 */
0, /* <I181> KEY_REFRESH 181 */
0, /* <I182> KEY_EXIT 182 */
0, /* <I183> KEY_MOVE 183 */
0, /* <I184> KEY_EDIT 184 */
0, /* <I185> KEY_SCROLLUP 185 */
0, /* <I186> KEY_SCROLLDOWN 186 */
0, /* <I187> KEY_KPLEFTPAREN 187 */
0, /* <I188> KEY_KPRIGHTPAREN 188 */
0, /* <I189> KEY_NEW 189 */
0, /* <I190> KEY_REDO 190 */
0, /* <FK13> 191 */
0, /* <FK14> 192 */
0, /* <FK15> 193 */
0, /* <FK16> 194 */
0, /* <FK17> 195 */
0, /* <FK18> 196 */
0, /* <FK19> 197 */
0, /* <FK20> 198 */
0, /* <FK21> 199 */
0, /* <FK22> 200 */
0, /* <FK23> 201 */
0, /* <FK24> 202 */
0, /* <MDSW> 203 */
0, /* <ALT> 204 */
0, /* <META> 205 */
0, /* <SUPR> 206 */
0, /* <HYPR> 207 */
0, /* <I208> KEY_PLAYCD 208 */
0, /* <I209> KEY_PAUSECD 209 */
0, /* <I210> KEY_PROG3 210 */
0, /* <I211> KEY_PROG4 211 */
0, /* <I212> KEY_DASHBOARD 212 */
0, /* <I213> KEY_SUSPEND 213 */
0, /* <I214> KEY_CLOSE 214 */
0, /* <I215> KEY_PLAY 215 */
0, /* <I216> KEY_FASTFORWARD 216 */
0, /* <I217> KEY_BASSBOOST 217 */
0, /* <I218> KEY_PRINT 218 */
0, /* <I219> KEY_HP 219 */
0, /* <I220> KEY_CAMERA 220 */
0, /* <I221> KEY_SOUND 221 */
0, /* <I222> KEY_QUESTION 222 */
0, /* <I223> KEY_EMAIL 223 */
0, /* <I224> KEY_CHAT 224 */
0, /* <I225> KEY_SEARCH 225 */
0, /* <I226> KEY_CONNECT 226 */
0, /* <I227> KEY_FINANCE 227 */
0, /* <I228> KEY_SPORT 228 */
0, /* <I229> KEY_SHOP 229 */
0, /* <I230> KEY_ALTERASE 230 */
0, /* <I231> KEY_CANCEL 231 */
0, /* <I232> KEY_BRIGHTNESSDOWN 232 */
0, /* <I233> KEY_BRIGHTNESSUP 233 */
0, /* <I234> KEY_MEDIA 234 */
0, /* <I235> KEY_SWITCHVIDEOMODE 235 */
0, /* <I236> KEY_KBDILLUMTOGGLE 236 */
0, /* <I237> KEY_KBDILLUMDOWN 237 */
0, /* <I238> KEY_KBDILLUMUP 238 */
0, /* <I239> KEY_SEND 239 */
0, /* <I240> KEY_REPLY 240 */
0, /* <I241> KEY_FORWARDMAIL 241 */
0, /* <I242> KEY_SAVE 242 */
0, /* <I243> KEY_DOCUMENTS 243 */
0, /* <I244> KEY_BATTERY 244 */
0, /* <I245> KEY_BLUETOOTH 245 */
0, /* <I246> KEY_WLAN 246 */
0, /* <I247> KEY_UWB 247 */
0, /* <I248> KEY_UNKNOWN 248 */
0, /* <I249> KEY_VIDEO_NEXT 249 */
0, /* <I250> KEY_VIDEO_PREV 250 */
0, /* <I251> KEY_BRIGHTNESS_CYCLE 251 */
0, /* <I252> KEY_BRIGHTNESS_ZERO 252 */
0, /* <I253> KEY_DISPLAY_OFF 253 */
0, /* 254 */
0 /* 255 */
};
DWORD GetVirtualKeyCodeFromKeycode(DWORD keycode, DWORD dwFlags)
{
DWORD vkcode;
vkcode = VK_NONE;
if (dwFlags & KEYCODE_TYPE_APPLE)
{
if (keycode < 0xFF)
vkcode = KEYCODE_TO_VKCODE_APPLE[keycode & 0xFF];
}
else if (dwFlags & KEYCODE_TYPE_EVDEV)
{
if (keycode < 0xFF)
vkcode = KEYCODE_TO_VKCODE_EVDEV[keycode & 0xFF];
}
if (!vkcode)
vkcode = VK_NONE;
return vkcode;
}

View File

@ -0,0 +1,656 @@
/**
* WinPR: Windows Portable Runtime
* Keyboard Input
*
* Copyright 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.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <winpr/crt.h>
#include <winpr/input.h>
/**
* Virtual Scan Codes
*/
/**
* Keyboard Type 4
*/
DWORD KBD4T[128] =
{
KBD4_T00,
KBD4_T01,
KBD4_T02,
KBD4_T03,
KBD4_T04,
KBD4_T05,
KBD4_T06,
KBD4_T07,
KBD4_T08,
KBD4_T09,
KBD4_T0A,
KBD4_T0B,
KBD4_T0C,
KBD4_T0D,
KBD4_T0E,
KBD4_T0F,
KBD4_T10,
KBD4_T11,
KBD4_T12,
KBD4_T13,
KBD4_T14,
KBD4_T15,
KBD4_T16,
KBD4_T17,
KBD4_T18,
KBD4_T19,
KBD4_T1A,
KBD4_T1B,
KBD4_T1C,
KBD4_T1D,
KBD4_T1E,
KBD4_T1F,
KBD4_T20,
KBD4_T21,
KBD4_T22,
KBD4_T23,
KBD4_T24,
KBD4_T25,
KBD4_T26,
KBD4_T27,
KBD4_T28,
KBD4_T29,
KBD4_T2A,
KBD4_T2B,
KBD4_T2C,
KBD4_T2D,
KBD4_T2E,
KBD4_T2F,
KBD4_T30,
KBD4_T31,
KBD4_T32,
KBD4_T33,
KBD4_T34,
KBD4_T35,
KBD4_T36,
KBD4_T37,
KBD4_T38,
KBD4_T39,
KBD4_T3A,
KBD4_T3B,
KBD4_T3C,
KBD4_T3D,
KBD4_T3E,
KBD4_T3F,
KBD4_T40,
KBD4_T41,
KBD4_T42,
KBD4_T43,
KBD4_T44,
KBD4_T45,
KBD4_T46,
KBD4_T47,
KBD4_T48,
KBD4_T49,
KBD4_T4A,
KBD4_T4B,
KBD4_T4C,
KBD4_T4D,
KBD4_T4E,
KBD4_T4F,
KBD4_T50,
KBD4_T51,
KBD4_T52,
KBD4_T53,
KBD4_T54,
KBD4_T55,
KBD4_T56,
KBD4_T57,
KBD4_T58,
KBD4_T59,
KBD4_T5A,
KBD4_T5B,
KBD4_T5C,
KBD4_T5D,
KBD4_T5E,
KBD4_T5F,
KBD4_T60,
KBD4_T61,
KBD4_T62,
KBD4_T63,
KBD4_T64,
KBD4_T65,
KBD4_T66,
KBD4_T67,
KBD4_T68,
KBD4_T69,
KBD4_T6A,
KBD4_T6B,
KBD4_T6C,
KBD4_T6D,
KBD4_T6E,
KBD4_T6F,
KBD4_T70,
KBD4_T71,
KBD4_T72,
KBD4_T73,
KBD4_T74,
KBD4_T75,
KBD4_T76,
KBD4_T77,
KBD4_T78,
KBD4_T79,
KBD4_T7A,
KBD4_T7B,
KBD4_T7C,
KBD4_T7D,
KBD4_T7E,
KBD4_T7F
};
DWORD KBD4X[128] =
{
VK_NONE,
VK_NONE,
VK_NONE,
VK_NONE,
VK_NONE,
VK_NONE,
VK_NONE,
VK_NONE,
VK_NONE,
VK_NONE,
VK_NONE,
VK_NONE,
VK_NONE,
VK_NONE,
VK_NONE,
VK_NONE,
KBD4_X10,
VK_NONE,
VK_NONE,
VK_NONE,
VK_NONE,
VK_NONE,
VK_NONE,
VK_NONE,
VK_NONE,
KBD4_X19,
VK_NONE,
VK_NONE,
KBD4_X1C,
KBD4_X1D,
VK_NONE,
VK_NONE,
KBD4_X20,
KBD4_X21,
KBD4_X22,
VK_NONE,
KBD4_X24,
VK_NONE,
VK_NONE,
VK_NONE,
VK_NONE,
VK_NONE,
VK_NONE,
VK_NONE,
VK_NONE,
VK_NONE,
KBD4_X2E,
VK_NONE,
KBD4_X30,
VK_NONE,
KBD4_X32,
VK_NONE,
VK_NONE,
KBD4_X35,
VK_NONE,
KBD4_X37,
KBD4_X38,
VK_NONE,
VK_NONE,
VK_NONE,
VK_NONE,
VK_NONE,
VK_NONE,
VK_NONE,
VK_NONE,
VK_NONE,
VK_NONE,
VK_NONE,
VK_NONE,
VK_NONE,
KBD4_X46,
KBD4_X47,
KBD4_X48,
KBD4_X49,
VK_NONE,
KBD4_X4B,
VK_NONE,
KBD4_X4D,
VK_NONE,
KBD4_X4F,
KBD4_X50,
KBD4_X51,
KBD4_X52,
KBD4_X53,
VK_NONE,
VK_NONE,
VK_NONE,
VK_NONE,
VK_NONE,
VK_NONE,
VK_NONE,
KBD4_X5B,
KBD4_X5C,
KBD4_X5D,
KBD4_X5E,
KBD4_X5F,
VK_NONE,
VK_NONE,
VK_NONE,
VK_NONE,
VK_NONE,
KBD4_X65,
KBD4_X66,
KBD4_X67,
KBD4_X68,
KBD4_X69,
KBD4_X6A,
KBD4_X6B,
KBD4_X6C,
KBD4_X6D,
VK_NONE,
VK_NONE,
VK_NONE,
VK_NONE,
VK_NONE,
VK_NONE,
VK_NONE,
VK_NONE,
VK_NONE,
VK_NONE,
VK_NONE,
VK_NONE,
VK_NONE,
VK_NONE,
VK_NONE,
VK_NONE,
VK_NONE,
VK_NONE,
};
/**
* Keyboard Type 7
*/
DWORD KBD7T[128] =
{
KBD7_T00,
KBD7_T01,
KBD7_T02,
KBD7_T03,
KBD7_T04,
KBD7_T05,
KBD7_T06,
KBD7_T07,
KBD7_T08,
KBD7_T09,
KBD7_T0A,
KBD7_T0B,
KBD7_T0C,
KBD7_T0D,
KBD7_T0E,
KBD7_T0F,
KBD7_T10,
KBD7_T11,
KBD7_T12,
KBD7_T13,
KBD7_T14,
KBD7_T15,
KBD7_T16,
KBD7_T17,
KBD7_T18,
KBD7_T19,
KBD7_T1A,
KBD7_T1B,
KBD7_T1C,
KBD7_T1D,
KBD7_T1E,
KBD7_T1F,
KBD7_T20,
KBD7_T21,
KBD7_T22,
KBD7_T23,
KBD7_T24,
KBD7_T25,
KBD7_T26,
KBD7_T27,
KBD7_T28,
KBD7_T29,
KBD7_T2A,
KBD7_T2B,
KBD7_T2C,
KBD7_T2D,
KBD7_T2E,
KBD7_T2F,
KBD7_T30,
KBD7_T31,
KBD7_T32,
KBD7_T33,
KBD7_T34,
KBD7_T35,
KBD7_T36,
KBD7_T37,
KBD7_T38,
KBD7_T39,
KBD7_T3A,
KBD7_T3B,
KBD7_T3C,
KBD7_T3D,
KBD7_T3E,
KBD7_T3F,
KBD7_T40,
KBD7_T41,
KBD7_T42,
KBD7_T43,
KBD7_T44,
KBD7_T45,
KBD7_T46,
KBD7_T47,
KBD7_T48,
KBD7_T49,
KBD7_T4A,
KBD7_T4B,
KBD7_T4C,
KBD7_T4D,
KBD7_T4E,
KBD7_T4F,
KBD7_T50,
KBD7_T51,
KBD7_T52,
KBD7_T53,
KBD7_T54,
KBD7_T55,
KBD7_T56,
KBD7_T57,
KBD7_T58,
KBD7_T59,
KBD7_T5A,
KBD7_T5B,
KBD7_T5C,
KBD7_T5D,
KBD7_T5E,
KBD7_T5F,
KBD7_T60,
KBD7_T61,
KBD7_T62,
KBD7_T63,
KBD7_T64,
KBD7_T65,
KBD7_T66,
KBD7_T67,
KBD7_T68,
KBD7_T69,
KBD7_T6A,
KBD7_T6B,
KBD7_T6C,
KBD7_T6D,
KBD7_T6E,
KBD7_T6F,
KBD7_T70,
KBD7_T71,
KBD7_T72,
KBD7_T73,
KBD7_T74,
KBD7_T75,
KBD7_T76,
KBD7_T77,
KBD7_T78,
KBD7_T79,
KBD7_T7A,
KBD7_T7B,
KBD7_T7C,
KBD7_T7D,
KBD7_T7E,
KBD7_T7F
};
DWORD KBD7X[128] =
{
VK_NONE,
VK_NONE,
VK_NONE,
VK_NONE,
VK_NONE,
VK_NONE,
VK_NONE,
VK_NONE,
VK_NONE,
VK_NONE,
VK_NONE,
VK_NONE,
VK_NONE,
VK_NONE,
VK_NONE,
VK_NONE,
KBD7_X10,
VK_NONE,
VK_NONE,
VK_NONE,
VK_NONE,
VK_NONE,
VK_NONE,
VK_NONE,
VK_NONE,
KBD7_X19,
VK_NONE,
VK_NONE,
KBD7_X1C,
KBD7_X1D,
VK_NONE,
VK_NONE,
KBD7_X20,
KBD7_X21,
KBD7_X22,
VK_NONE,
KBD7_X24,
VK_NONE,
VK_NONE,
VK_NONE,
VK_NONE,
VK_NONE,
VK_NONE,
VK_NONE,
VK_NONE,
VK_NONE,
KBD7_X2E,
VK_NONE,
KBD7_X30,
VK_NONE,
KBD7_X32,
KBD7_X33,
VK_NONE,
KBD7_X35,
VK_NONE,
KBD7_X37,
KBD7_X38,
VK_NONE,
VK_NONE,
VK_NONE,
VK_NONE,
VK_NONE,
VK_NONE,
VK_NONE,
VK_NONE,
VK_NONE,
KBD7_X42,
KBD7_X43,
KBD7_X44,
VK_NONE,
KBD7_X46,
KBD7_X47,
KBD7_X48,
KBD7_X49,
VK_NONE,
KBD7_X4B,
VK_NONE,
KBD7_X4D,
VK_NONE,
KBD7_X4F,
KBD7_X50,
KBD7_X51,
KBD7_X52,
KBD7_X53,
VK_NONE,
VK_NONE,
VK_NONE,
VK_NONE,
VK_NONE,
VK_NONE,
VK_NONE,
KBD7_X5B,
KBD7_X5C,
KBD7_X5D,
KBD7_X5E,
KBD7_X5F,
VK_NONE,
VK_NONE,
VK_NONE,
VK_NONE,
VK_NONE,
KBD7_X65,
KBD7_X66,
KBD7_X67,
KBD7_X68,
KBD7_X69,
KBD7_X6A,
KBD7_X6B,
KBD7_X6C,
KBD7_X6D,
VK_NONE,
VK_NONE,
VK_NONE,
VK_NONE,
VK_NONE,
VK_NONE,
VK_NONE,
VK_NONE,
VK_NONE,
VK_NONE,
VK_NONE,
VK_NONE,
VK_NONE,
VK_NONE,
VK_NONE,
VK_NONE,
VK_NONE,
VK_NONE
};
DWORD GetVirtualKeyCodeFromVirtualScanCode(DWORD scancode, DWORD dwKeyboardType)
{
DWORD vkcode;
vkcode = VK_NONE;
if ((dwKeyboardType != 4) && (dwKeyboardType != 7))
dwKeyboardType = 4;
if (dwKeyboardType == 4)
{
if (vkcode < 128)
vkcode = (scancode & KBDEXT) ? KBD4X[scancode] : KBD4T[scancode];
}
else if (dwKeyboardType == 7)
{
if (vkcode < 128)
vkcode = (scancode & KBDEXT) ? KBD7X[scancode] : KBD7T[scancode];
}
if (!vkcode)
vkcode = VK_NONE;
return vkcode;
}
DWORD GetVirtualScanCodeFromVirtualKeyCode(DWORD vkcode, DWORD dwKeyboardType)
{
int i;
DWORD scancode;
scancode = 0;
if ((dwKeyboardType != 4) && (dwKeyboardType != 7))
dwKeyboardType = 4;
if (dwKeyboardType == 4)
{
if (vkcode & KBDEXT)
{
for (i = 0; i < 128; i++)
{
if (KBD4X[i] == (vkcode & 0xFF))
{
scancode = (i | KBDEXT);
break;
}
}
}
else
{
for (i = 0; i < 128; i++)
{
if (KBD4T[i] == (vkcode & 0xFF))
{
scancode = i;
break;
}
}
}
}
else if (dwKeyboardType == 7)
{
if (vkcode & KBDEXT)
{
for (i = 0; i < 128; i++)
{
if (KBD7X[i] == (vkcode & 0xFF))
{
scancode = (i | KBDEXT);
break;
}
}
}
else
{
for (i = 0; i < 128; i++)
{
if (KBD7T[i] == (vkcode & 0xFF))
{
scancode = i;
break;
}
}
}
}
return scancode;
}

View File

@ -1,8 +1,8 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* Keyboard Layouts
* WinPR: Windows Portable Runtime
* Keyboard Input
*
* Copyright 2009-2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
* Copyright 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.
@ -21,50 +21,50 @@
#include "config.h"
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <winpr/crt.h>
#include <freerdp/locale/vkcodes.h>
#include <winpr/input.h>
/**
* Virtual Key Codes
*/
struct _VIRTUAL_KEY_CODE
{
UINT32 code; /* Windows Virtual Key Code */
DWORD 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, "" },
{ 0, NULL },
{ 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, "" },
{ 0, NULL },
{ VK_BACK, "VK_BACK" },
{ VK_TAB, "VK_TAB" },
{ 0, "" },
{ 0, "" },
{ 0, NULL },
{ 0, NULL },
{ VK_CLEAR, "VK_CLEAR" },
{ VK_RETURN, "VK_RETURN" },
{ 0, "" },
{ 0, "" },
{ 0, NULL },
{ 0, NULL },
{ 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, "" },
{ 0, NULL },
{ VK_JUNJA, "VK_JUNJA" },
{ VK_FINAL, "VK_FINAL" },
{ VK_KANJI, "VK_KANJI" }, /* also VK_HANJA */
{ 0, "" },
{ 0, NULL },
{ VK_ESCAPE, "VK_ESCAPE" },
{ VK_CONVERT, "VK_CONVERT" },
{ VK_NONCONVERT, "VK_NONCONVERT" },
@ -96,13 +96,13 @@ static const VIRTUAL_KEY_CODE VIRTUAL_KEY_CODE_TABLE[256] =
{ 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, "" },
{ 0, NULL },
{ 0, NULL },
{ 0, NULL },
{ 0, NULL },
{ 0, NULL },
{ 0, NULL },
{ 0, NULL },
{ VK_KEY_A, "VK_KEY_A" },
{ VK_KEY_B, "VK_KEY_B" },
{ VK_KEY_C, "VK_KEY_C" },
@ -132,7 +132,7 @@ static const VIRTUAL_KEY_CODE VIRTUAL_KEY_CODE_TABLE[256] =
{ VK_LWIN, "VK_LWIN" },
{ VK_RWIN, "VK_RWIN" },
{ VK_APPS, "VK_APPS" },
{ 0, "" },
{ 0, NULL },
{ VK_SLEEP, "VK_SLEEP" },
{ VK_NUMPAD0, "VK_NUMPAD0" },
{ VK_NUMPAD1, "VK_NUMPAD1" },
@ -174,30 +174,30 @@ static const VIRTUAL_KEY_CODE VIRTUAL_KEY_CODE_TABLE[256] =
{ VK_F22, "VK_F22" },
{ VK_F23, "VK_F23" },
{ VK_F24, "VK_F24" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, NULL },
{ 0, NULL },
{ 0, NULL },
{ 0, NULL },
{ 0, NULL },
{ 0, NULL },
{ 0, NULL },
{ 0, NULL },
{ VK_NUMLOCK, "VK_NUMLOCK" },
{ VK_SCROLL, "VK_SCROLL" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, NULL },
{ 0, NULL },
{ 0, NULL },
{ 0, NULL },
{ 0, NULL },
{ 0, NULL },
{ 0, NULL },
{ 0, NULL },
{ 0, NULL },
{ 0, NULL },
{ 0, NULL },
{ 0, NULL },
{ 0, NULL },
{ 0, NULL },
{ VK_LSHIFT, "VK_LSHIFT" },
{ VK_RSHIFT, "VK_RSHIFT" },
{ VK_LCONTROL, "VK_LCONTROL" },
@ -222,8 +222,8 @@ static const VIRTUAL_KEY_CODE VIRTUAL_KEY_CODE_TABLE[256] =
{ VK_MEDIA_SELECT, "VK_MEDIA_SELECT" },
{ VK_LAUNCH_APP1, "VK_LAUNCH_APP1" },
{ VK_LAUNCH_APP2, "VK_LAUNCH_APP2" },
{ 0, "" },
{ 0, "" },
{ 0, NULL },
{ 0, NULL },
{ VK_OEM_1, "VK_OEM_1" },
{ VK_OEM_PLUS, "VK_OEM_PLUS" },
{ VK_OEM_COMMA, "VK_OEM_COMMA" },
@ -233,57 +233,57 @@ static const VIRTUAL_KEY_CODE VIRTUAL_KEY_CODE_TABLE[256] =
{ 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, "" },
{ 0, NULL },
{ 0, NULL },
{ 0, NULL },
{ 0, NULL },
{ 0, NULL },
{ 0, NULL },
{ 0, NULL },
{ 0, NULL },
{ 0, NULL },
{ 0, NULL },
{ 0, NULL },
{ 0, NULL },
{ 0, NULL },
{ 0, NULL },
{ 0, NULL },
{ 0, NULL },
{ 0, NULL },
{ 0, NULL },
{ 0, NULL },
{ 0, NULL },
{ 0, NULL },
{ 0, NULL },
{ 0, NULL },
{ 0, NULL },
{ 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, "" },
{ 0, NULL },
{ 0, NULL },
{ VK_OEM_102, "VK_OEM_102" },
{ 0, "" },
{ 0, "" },
{ 0, NULL },
{ 0, NULL },
{ VK_PROCESSKEY, "VK_PROCESSKEY" },
{ 0, "" },
{ 0, NULL },
{ VK_PACKET, "VK_PACKET" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, "" },
{ 0, NULL },
{ 0, NULL },
{ 0, NULL },
{ 0, NULL },
{ 0, NULL },
{ 0, NULL },
{ 0, NULL },
{ 0, NULL },
{ 0, NULL },
{ 0, NULL },
{ 0, NULL },
{ 0, NULL },
{ 0, NULL },
{ 0, NULL },
{ VK_ATTN, "VK_ATTN" },
{ VK_CRSEL, "VK_CRSEL" },
{ VK_EXSEL, "VK_EXSEL" },
@ -293,26 +293,176 @@ static const VIRTUAL_KEY_CODE VIRTUAL_KEY_CODE_TABLE[256] =
{ VK_NONAME, "VK_NONAME" },
{ VK_PA1, "VK_PA1" },
{ VK_OEM_CLEAR, "VK_OEM_CLEAR" },
{ 0, "" }
{ 0, NULL }
};
const char* freerdp_keyboard_get_virtual_key_code_name(UINT32 vkcode)
struct _XKB_KEYNAME
{
return VIRTUAL_KEY_CODE_TABLE[vkcode].name;
const char* name;
DWORD vkcode;
};
typedef struct _XKB_KEYNAME XKB_KEYNAME;
XKB_KEYNAME XKB_KEYNAME_TABLE[] =
{
{ "BKSP", VK_BACK },
{ "TAB", VK_TAB },
{ "RTRN", VK_RETURN },
{ "LFSH", VK_LSHIFT },
{ "LALT", VK_LMENU },
{ "CAPS", VK_CAPITAL },
{ "ESC", VK_ESCAPE },
{ "SPCE", VK_SPACE },
{ "AE10", VK_KEY_0 },
{ "AE01", VK_KEY_1 },
{ "AE02", VK_KEY_2 },
{ "AE03", VK_KEY_3 },
{ "AE04", VK_KEY_4 },
{ "AE05", VK_KEY_5 },
{ "AE06", VK_KEY_6 },
{ "AE07", VK_KEY_7 },
{ "AE08", VK_KEY_8 },
{ "AE09", VK_KEY_9 },
{ "AC01", VK_KEY_A },
{ "AB05", VK_KEY_B },
{ "AB03", VK_KEY_C },
{ "AC03", VK_KEY_D },
{ "AD03", VK_KEY_E },
{ "AC04", VK_KEY_F },
{ "AC05", VK_KEY_G },
{ "AC06", VK_KEY_H },
{ "AD08", VK_KEY_I },
{ "AC07", VK_KEY_J },
{ "AC08", VK_KEY_K },
{ "AC09", VK_KEY_L },
{ "AB07", VK_KEY_M },
{ "AB06", VK_KEY_N },
{ "AD09", VK_KEY_O },
{ "AD10", VK_KEY_P },
{ "AD01", VK_KEY_Q },
{ "AD04", VK_KEY_R },
{ "AC02", VK_KEY_S },
{ "AD05", VK_KEY_T },
{ "AD07", VK_KEY_U },
{ "AB04", VK_KEY_V },
{ "AD02", VK_KEY_W },
{ "AB02", VK_KEY_X },
{ "AD06", VK_KEY_Y },
{ "AB01", VK_KEY_Z },
{ "KP0", VK_NUMPAD0 },
{ "KP1", VK_NUMPAD1 },
{ "KP2", VK_NUMPAD2 },
{ "KP3", VK_NUMPAD3 },
{ "KP4", VK_NUMPAD4 },
{ "KP5", VK_NUMPAD5 },
{ "KP6", VK_NUMPAD6 },
{ "KP7", VK_NUMPAD7 },
{ "KP8", VK_NUMPAD8 },
{ "KP9", VK_NUMPAD9 },
{ "KPMU", VK_MULTIPLY },
{ "KPAD", VK_ADD },
{ "KPSU", VK_SUBTRACT },
{ "KPDL", VK_DECIMAL },
{ "AB10", VK_OEM_2 },
{ "FK01", VK_F1 },
{ "FK02", VK_F2 },
{ "FK03", VK_F3 },
{ "FK04", VK_F4 },
{ "FK05", VK_F5 },
{ "FK06", VK_F6 },
{ "FK07", VK_F7 },
{ "FK08", VK_F8 },
{ "FK09", VK_F9 },
{ "FK10", VK_F10 },
{ "FK11", VK_F11 },
{ "FK12", VK_F12 },
{ "NMLK", VK_NUMLOCK },
{ "SCLK", VK_SCROLL },
{ "RTSH", VK_RSHIFT },
{ "LCTL", VK_LCONTROL },
{ "AC10", VK_OEM_1 },
{ "AE12", VK_OEM_PLUS },
{ "AB08", VK_OEM_COMMA },
{ "AE11", VK_OEM_MINUS },
{ "AB09", VK_OEM_PERIOD },
{ "TLDE", VK_OEM_3 },
{ "AB11", VK_ABNT_C1 },
{ "I129", VK_ABNT_C2 },
{ "AD11", VK_OEM_4 },
{ "BKSL", VK_OEM_5 },
{ "AD12", VK_OEM_6 },
{ "AC11", VK_OEM_7 },
{ "LSGT", VK_OEM_102 },
{ "KPEN", VK_RETURN | KBDEXT },
{ "PAUS", VK_PAUSE | KBDEXT },
{ "PGUP", VK_PRIOR | KBDEXT },
{ "PGDN", VK_NEXT | KBDEXT },
{ "END", VK_END | KBDEXT },
{ "HOME", VK_HOME | KBDEXT },
{ "LEFT", VK_LEFT | KBDEXT },
{ "UP", VK_UP | KBDEXT },
{ "RGHT", VK_RIGHT | KBDEXT },
{ "DOWN", VK_DOWN | KBDEXT },
{ "PRSC", VK_SNAPSHOT | KBDEXT },
{ "INS", VK_INSERT | KBDEXT },
{ "DELE", VK_DELETE | KBDEXT },
{ "LWIN", VK_LWIN | KBDEXT },
{ "RWIN", VK_RWIN | KBDEXT },
{ "COMP", VK_APPS | KBDEXT },
{ "KPDV", VK_DIVIDE | KBDEXT },
{ "RCTL", VK_RCONTROL | KBDEXT },
{ "RALT", VK_RMENU | KBDEXT },
/* Japanese */
{ "HENK", VK_CONVERT },
{ "MUHE", VK_NONCONVERT },
{ "HKTG", VK_DBE_KATAKANA },
// { "AE13", VK_BACKSLASH_JP }, // JP
// { "LVL3", 0x54}
};
char* GetVirtualKeyName(DWORD vkcode)
{
char* vkname;
vkname = (char*) VIRTUAL_KEY_CODE_TABLE[vkcode].name;
if (!vkname)
vkname = "VK_NONE";
return vkname;
}
UINT32 freerdp_keyboard_get_virtual_key_code_from_name(const char* vkcode_name)
DWORD GetVirtualKeyCodeFromName(const char* vkname)
{
int i = 0;
int i;
for (i = 0; i < ARRAYSIZE(VIRTUAL_KEY_CODE_TABLE); i++)
{
if (VIRTUAL_KEY_CODE_TABLE[i].name)
{
if (strcmp(vkcode_name, VIRTUAL_KEY_CODE_TABLE[i].name) == 0)
{
if (strcmp(vkname, VIRTUAL_KEY_CODE_TABLE[i].name) == 0)
return VIRTUAL_KEY_CODE_TABLE[i].code;
}
}
}
return 0;
return VK_NONE;
}
DWORD GetVirtualKeyCodeFromXkbKeyName(const char* xkbname)
{
int i;
for (i = 0; i < ARRAYSIZE(XKB_KEYNAME_TABLE); i++)
{
if (XKB_KEYNAME_TABLE[i].name)
{
if (strcmp(xkbname, XKB_KEYNAME_TABLE[i].name) == 0)
return XKB_KEYNAME_TABLE[i].vkcode;
}
}
return VK_NONE;
}

View File

@ -21,6 +21,10 @@
#include "config.h"
#endif
#include <stdio.h>
#include <string.h>
#include <stdarg.h>
#include <winpr/crt.h>
#include <winpr/print.h>
@ -53,3 +57,386 @@ void winpr_HexDump(BYTE* data, int length)
p += line;
}
}
/*----------------------------------------------------------------------------
Stripped-down printf()
Chris Giese <geezer@execpc.com> http://my.execpc.com/~geezer
Release date: Feb 3, 2008
This code is public domain (no copyright).
You can do whatever you want with it.
%[flag][width][.prec][mod][conv]
flag: - left justify, pad right w/ blanks DONE
0 pad left w/ 0 for numerics DONE
+ always print sign, + or - no
' ' (blank) no
# (???) no
width: (field width) DONE
prec: (precision) no
conv: d,i decimal int DONE
u decimal unsigned DONE
o octal DONE
x,X hex DONE
f,e,g,E,G float no
c char DONE
s string DONE
p ptr DONE
mod: N near ptr DONE
F far ptr no
h short (16-bit) int DONE
l long (32-bit) int DONE
L long long (64-bit) int no
----------------------------------------------------------------------------*/
/* flags used in processing format string */
#define PR_LJ 0x01 /* left justify */
#define PR_CA 0x02 /* use A-F instead of a-f for hex */
#define PR_SG 0x04 /* signed numeric conversion (%d vs. %u) */
#define PR_32 0x08 /* long (32-bit) numeric conversion */
#define PR_16 0x10 /* short (16-bit) numeric conversion */
#define PR_WS 0x20 /* PR_SG set and num was < 0 */
#define PR_LZ 0x40 /* pad left with '0' instead of ' ' */
#define PR_FP 0x80 /* pointers are far */
/* largest number handled is 2^32-1, lowest radix handled is 8.
2^32-1 in base 8 has 11 digits (add 5 for trailing NUL and for slop) */
#define PR_BUFLEN 16
typedef int (*fnptr_t)(unsigned c, void **helper);
int do_printf(const char *fmt, va_list args, fnptr_t fn, void *ptr)
{
long num;
unsigned char state, radix;
unsigned char *where, buf[PR_BUFLEN];
unsigned flags, actual_wd, count, given_wd;
state = flags = count = given_wd = 0;
/* begin scanning format specifier list */
for (; *fmt; fmt++)
{
switch (state)
{
/* STATE 0: AWAITING % */
case 0:
if (*fmt != '%') /* not %... */
{
fn(*fmt, &ptr); /* ...just echo it */
count++;
break;
}
/* found %, get next char and advance state to check if next char is a flag */
state++;
fmt++;
/* FALL THROUGH */
/* STATE 1: AWAITING FLAGS (%-0) */
case 1:
if (*fmt == '%') /* %% */
{
fn(*fmt, &ptr);
count++;
state = flags = given_wd = 0;
break;
}
if (*fmt == '-')
{
if (flags & PR_LJ) /* %-- is illegal */
state = flags = given_wd = 0;
else
flags |= PR_LJ;
break;
}
/* not a flag char: advance state to check if it's field width */
state++;
/* check now for '%0...' */
if (*fmt == '0')
{
flags |= PR_LZ;
fmt++;
}
/* FALL THROUGH */
/* STATE 2: AWAITING (NUMERIC) FIELD WIDTH */
case 2:
if (*fmt >= '0' && *fmt <= '9')
{
given_wd = 10 * given_wd + (*fmt - '0');
break;
}
/* not field width: advance state to check if it's a modifier */
state++;
/* FALL THROUGH */
/* STATE 3: AWAITING MODIFIER CHARS (FNlh) */
case 3:
if (*fmt == 'F')
{
flags |= PR_FP;
break;
}
if (*fmt == 'N')
{
break;
}
if (*fmt == 'l')
{
flags |= PR_32;
break;
}
if (*fmt == 'h')
{
flags |= PR_16;
break;
}
/* not modifier: advance state to check if it's a conversion char */
state++;
/* FALL THROUGH */
/* STATE 4: AWAITING CONVERSION CHARS (Xxpndiuocs) */
case 4:
where = buf + PR_BUFLEN - 1;
*where = '\0';
switch (*fmt)
{
case 'X':
flags |= PR_CA;
/* FALL THROUGH */
/* xxx - far pointers (%Fp, %Fn) not yet supported */
case 'x':
case 'p':
case 'n':
radix = 16;
goto DO_NUM;
case 'd':
case 'i':
flags |= PR_SG;
/* FALL THROUGH */
case 'u':
radix = 10;
goto DO_NUM;
case 'o':
radix = 8;
DO_NUM: if (flags & PR_32)
{
/* load the value to be printed. l=long=32 bits: */
num = va_arg(args, unsigned long);
}
else if (flags & PR_16)
{
/* h=short=16 bits (signed or unsigned) */
if (flags & PR_SG)
num = (short) va_arg(args, int);
else
num = (unsigned short) va_arg(args, int);
}
else
{
/* no h nor l: sizeof(int) bits (signed or unsigned) */
if (flags & PR_SG)
num = va_arg(args, int);
else
num = va_arg(args, unsigned int);
}
if (flags & PR_SG)
{
/* take care of sign */
if (num < 0)
{
flags |= PR_WS;
num = -num;
}
}
/*
* convert binary to octal/decimal/hex ASCII
* OK, I found my mistake. The math here is _always_ unsigned
*/
do
{
unsigned long temp;
temp = (unsigned long) num % radix;
where--;
if (temp < 10)
*where = temp + '0';
else if (flags & PR_CA)
*where = temp - 10 + 'A';
else
*where = temp - 10 + 'a';
num = (unsigned long) num / radix;
}
while (num != 0);
goto EMIT;
case 'c':
/* disallow pad-left-with-zeroes for %c */
flags &= ~PR_LZ;
where--;
*where = (unsigned char) va_arg(args, int);
actual_wd = 1;
goto EMIT2;
case 's':
/* disallow pad-left-with-zeroes for %s */
flags &= ~PR_LZ;
where = va_arg(args, unsigned char*);
EMIT:
actual_wd = strlen((char*) where);
if (flags & PR_WS)
actual_wd++;
/* if we pad left with ZEROES, do the sign now */
if ((flags & (PR_WS | PR_LZ)) == (PR_WS | PR_LZ))
{
fn('-', &ptr);
count++;
}
/* pad on left with spaces or zeroes (for right justify) */
EMIT2: if ((flags & PR_LJ) == 0)
{
while (given_wd > actual_wd)
{
fn((flags & PR_LZ) ? '0' : ' ', &ptr);
count++;
given_wd--;
}
}
/* if we pad left with SPACES, do the sign now */
if ((flags & (PR_WS | PR_LZ)) == PR_WS)
{
fn('-', &ptr);
count++;
}
/* emit string/char/converted number */
while (*where != '\0')
{
fn(*where++, &ptr);
count++;
}
/* pad on right with spaces (for left justify) */
if (given_wd < actual_wd)
given_wd = 0;
else
given_wd -= actual_wd;
for (; given_wd; given_wd--)
{
fn(' ', &ptr);
count++;
}
break;
default:
break;
}
default:
state = flags = given_wd = 0;
break;
}
}
return count;
}
static int vsprintf_help(unsigned c, void **ptr)
{
char *dst;
dst = *ptr;
*dst++ = (char) c;
*ptr = dst;
return 0;
}
int vsprintf(char *buf, const char *fmt, va_list args)
{
int status;
status = do_printf(fmt, args, vsprintf_help, (void*) buf);
buf[status] = '\0';
return status;
}
static int discard(unsigned c_UNUSED, void **ptr_UNUSED)
{
return 0;
}
int sprintf(char *buf, const char *fmt, ...)
{
va_list args;
int status;
va_start(args, fmt);
if (!buf)
status = do_printf(fmt, args, discard, NULL);
else
status = vsprintf(buf, fmt, args);
va_end(args);
return status;
}
int vprintf_help(unsigned c, void **ptr_UNUSED)
{
putchar(c);
return 0;
}
int vprintf(const char *fmt, va_list args)
{
return do_printf(fmt, args, vprintf_help, NULL);
}
int wprintfx(const char *fmt, ...)
{
va_list args;
int status;
va_start(args, fmt);
status = vprintf(fmt, args);
va_end(args);
return status;
}

View File

@ -6,6 +6,7 @@ set(${MODULE_PREFIX}_DRIVER ${MODULE_NAME}.c)
set(${MODULE_PREFIX}_TESTS
TestQueue.c
TestPrint.c
TestArrayList.c
TestCmdLine.c
TestMessageQueue.c

View File

@ -0,0 +1,108 @@
#include <winpr/crt.h>
#include <winpr/tchar.h>
#include <winpr/print.h>
/**
* C Programming/C Reference/stdio.h/printf:
* http://en.wikibooks.org/wiki/C_Programming/C_Reference/stdio.h/printf
*
* C Programming/Procedures and functions/printf:
* http://en.wikibooks.org/wiki/C_Programming/Procedures_and_functions/printf
*
* C Tutorial printf, Format Specifiers, Format Conversions and Formatted Output:
* http://www.codingunit.com/printf-format-specifiers-format-conversions-and-formatted-output
*/
#if 0
#define _printf printf
#else
#define _printf wprintfx
#endif
int TestPrint(int argc, char* argv[])
{
int a, b;
float c, d;
/**
* 7
* 7
* 007
* 5.10
*/
a = 15;
b = a / 2;
_printf("%d\n",b);
_printf("%3d\n",b);
_printf("%03d\n",b);
c = 15.3; d = c / 3;
_printf("%3.2f\n",d);
/**
* 0 -17.778
* 20 -6.667
* 40 04.444
* 60 15.556
* 80 26.667
* 100 37.778
* 120 48.889
* 140 60.000
* 160 71.111
* 180 82.222
* 200 93.333
* 220 104.444
* 240 115.556
* 260 126.667
* 280 137.778
* 300 148.889
*/
for (a = 0; a <= 300; a = a + 20)
_printf("%3d %06.3f\n", a, (5.0 / 9.0) * (a - 32));
/**
* The color: blue
* First number: 12345
* Second number: 0025
* Third number: 1234
* Float number: 3.14
* Hexadecimal: ff
* Octal: 377
* Unsigned value: 150
* Just print the percentage sign %
*/
_printf("The color: %s\n", "blue");
_printf("First number: %d\n", 12345);
_printf("Second number: %04d\n", 25);
_printf("Third number: %i\n", 1234);
_printf("Float number: %3.2f\n", 3.14159);
_printf("Hexadecimal: %x/%X\n", 255, 255);
_printf("Octal: %o\n", 255);
_printf("Unsigned value: %u\n", 150);
_printf("Just print the percentage sign %%\n", 10);
/**
* :Hello, world!:
* : Hello, world!:
* :Hello, wor:
* :Hello, world!:
* :Hello, world! :
* :Hello, world!:
* : Hello, wor:
* :Hello, wor :
*/
_printf(":%s:\n", "Hello, world!");
_printf(":%15s:\n", "Hello, world!");
_printf(":%.10s:\n", "Hello, world!");
_printf(":%-10s:\n", "Hello, world!");
_printf(":%-15s:\n", "Hello, world!");
_printf(":%.15s:\n", "Hello, world!");
_printf(":%15.10s:\n", "Hello, world!");
_printf(":%-15.10s:\n", "Hello, world!");
return 0;
}