Merge pull request #519 from kiilerix/master

build fixes
This commit is contained in:
Marc-André Moreau 2012-03-30 08:34:13 -07:00
commit f2ec024d51
13 changed files with 637 additions and 669 deletions

View File

@ -190,10 +190,8 @@ void df_send_mouse_wheel_event(rdpInput* input, sint16 axisrel, uint16 x, uint16
void df_send_keyboard_event(rdpInput* input, boolean down, uint8 keycode, uint8 function)
{
uint16 flags;
uint8 vkcode;
uint8 scancode;
boolean extended;
RDP_SCANCODE rdp_scancode;
if (keycode)
vkcode = keymap[keycode];
@ -201,13 +199,10 @@ void df_send_keyboard_event(rdpInput* input, boolean down, uint8 keycode, uint8
vkcode = functionmap[function];
else
return;
scancode = freerdp_keyboard_get_rdp_scancode_from_virtual_key_code(vkcode, &extended);
flags = (extended) ? KBD_FLAGS_EXTENDED : 0;
flags |= (down) ? KBD_FLAGS_DOWN : KBD_FLAGS_RELEASE;
rdp_scancode = freerdp_keyboard_get_rdp_scancode_from_virtual_key_code(vkcode);
input->KeyboardEvent(input, flags, scancode);
freerdp_input_send_keyboard_event_2(input, down, rdp_scancode);
}
boolean df_event_process(freerdp* instance, DFBEvent* event)

View File

@ -33,11 +33,9 @@ extern HCURSOR g_default_cursor;
LRESULT CALLBACK wf_ll_kbd_proc(int nCode, WPARAM wParam, LPARAM lParam)
{
DWORD flags;
wfInfo* wfi;
uint8 scanCode;
RDP_SCANCODE rdp_scancode;
rdpInput* input;
uint16 kbdFlags;
PKBDLLHOOKSTRUCT p;
DEBUG_KBD("Low-level keyboard hook, hWnd %X nCode %X wParam %X", g_focus_hWnd, nCode, wParam);
@ -52,13 +50,11 @@ LRESULT CALLBACK wf_ll_kbd_proc(int nCode, WPARAM wParam, LPARAM lParam)
case WM_SYSKEYUP:
wfi = (wfInfo*) GetWindowLongPtr(g_focus_hWnd, GWLP_USERDATA);
p = (PKBDLLHOOKSTRUCT) lParam;
scanCode = (uint8) p->scanCode;
input = wfi->instance->input;
flags = p->flags;
kbdFlags = 0;
rdp_scancode = mk_rdp_scancode((uint8) p->scanCode, p->flags & LLKHF_EXTENDED);
DEBUG_KBD("keydown %d scanCode %04X flags %02X vkCode %02X",
(wParam == WM_KEYDOWN), scanCode, flags, p->vkCode);
(wParam == WM_KEYDOWN), (uint8) p->scanCode, p->flags, p->vkCode);
if (wfi->fs_toggle &&
((p->vkCode == VK_RETURN) || (p->vkCode == VK_CANCEL)) &&
@ -70,44 +66,38 @@ LRESULT CALLBACK wf_ll_kbd_proc(int nCode, WPARAM wParam, LPARAM lParam)
return 1;
}
if (scanCode == 0x45) /* NumLock-ish */
if (rdp_scancode == RDP_SCANCODE_NUMLOCK_EXTENDED)
{
if (flags & LLKHF_EXTENDED)
/* Windows sends NumLock as extended - rdp doesn't */
DEBUG_KBD("hack: NumLock (x45) should not be extended");
rdp_scancode = RDP_SCANCODE_NUMLOCK;
}
else if (rdp_scancode == RDP_SCANCODE_NUMLOCK)
{
/* Windows sends Pause as if it was a RDP NumLock (handled above).
* It must however be sent as a one-shot Ctrl+NumLock */
if (wParam == WM_KEYDOWN)
{
/* Windows sends NumLock as extended - rdp doesn't */
DEBUG_KBD("hack: NumLock (x45) should not be extended");
flags &= ~LLKHF_EXTENDED;
DEBUG_KBD("Pause, sent as Ctrl+NumLock");
freerdp_input_send_keyboard_event_2(input, true, RDP_SCANCODE_LCONTROL);
freerdp_input_send_keyboard_event_2(input, true, RDP_SCANCODE_NUMLOCK);
freerdp_input_send_keyboard_event_2(input, false, RDP_SCANCODE_LCONTROL);
freerdp_input_send_keyboard_event_2(input, false, RDP_SCANCODE_NUMLOCK);
}
else
{
/* Windows sends Pause as if it was a RDP NumLock (handled above).
* It must however be sent as a one-shot Ctrl+NumLock */
if (wParam == WM_KEYDOWN)
{
DEBUG_KBD("Pause, sent as Ctrl+NumLock");
input->KeyboardEvent(input, KBD_FLAGS_DOWN, 0x1D); /* Ctrl down */
input->KeyboardEvent(input, KBD_FLAGS_DOWN, 0x45); /* NumLock down */
input->KeyboardEvent(input, KBD_FLAGS_RELEASE, 0x1D); /* Ctrl up */
input->KeyboardEvent(input, KBD_FLAGS_RELEASE, 0x45); /* NumLock up */
}
else
{
DEBUG_KBD("Pause up");
}
return 1;
DEBUG_KBD("Pause up");
}
}
if ((scanCode == 0x36) && (flags & LLKHF_EXTENDED))
return 1;
}
else if (rdp_scancode == RDP_SCANCODE_RSHIFT_EXTENDED)
{
DEBUG_KBD("hack: right shift (x36) should not be extended");
flags &= ~LLKHF_EXTENDED;
DEBUG_KBD("right shift (x36) should not be extended");
rdp_scancode = RDP_SCANCODE_RSHIFT;
}
kbdFlags |= (flags & LLKHF_UP) ? KBD_FLAGS_RELEASE : KBD_FLAGS_DOWN;
kbdFlags |= (flags & LLKHF_EXTENDED) ? KBD_FLAGS_EXTENDED : 0;
input->KeyboardEvent(input, kbdFlags, scanCode);
freerdp_input_send_keyboard_event_2(input, !(flags & LLKHF_UP), rdp_scancode);
if (p->vkCode == VK_CAPITAL)
DEBUG_KBD("caps lock is processed on client side too to toggle caps lock indicator");

View File

@ -58,38 +58,33 @@ boolean xf_kbd_key_pressed(xfInfo* xfi, KeySym keysym)
void xf_kbd_send_key(xfInfo* xfi, boolean down, uint8 keycode)
{
uint16 flags;
uint8 scancode;
boolean extended;
RDP_SCANCODE rdp_scancode;
rdpInput* input;
input = xfi->instance->input;
scancode = freerdp_keyboard_get_rdp_scancode_from_x11_keycode(keycode, &extended);
rdp_scancode = freerdp_keyboard_get_rdp_scancode_from_x11_keycode(keycode);
if (scancode == 0)
if (rdp_scancode == RDP_SCANCODE_UNKNOWN)
{
/* unknown key */
printf("Unknown key with X keycode 0x%02x\n", keycode);
}
else if ((scancode == 0x46) && extended &&
else if (rdp_scancode == RDP_SCANCODE_PAUSE &&
!xf_kbd_key_pressed(xfi, XK_Control_L) && !xf_kbd_key_pressed(xfi, XK_Control_R))
{
/* Pause without Ctrl has to be sent as Ctrl + NumLock. */
if (down)
{
input->KeyboardEvent(input, KBD_FLAGS_DOWN, 0x1D); /* Ctrl down */
input->KeyboardEvent(input, KBD_FLAGS_DOWN, 0x45); /* NumLock down */
input->KeyboardEvent(input, KBD_FLAGS_RELEASE, 0x1D); /* Ctrl up */
input->KeyboardEvent(input, KBD_FLAGS_RELEASE, 0x45); /* NumLock up */
freerdp_input_send_keyboard_event_2(input, true, RDP_SCANCODE_LCONTROL);
freerdp_input_send_keyboard_event_2(input, true, RDP_SCANCODE_NUMLOCK);
freerdp_input_send_keyboard_event_2(input, false, RDP_SCANCODE_LCONTROL);
freerdp_input_send_keyboard_event_2(input, false, RDP_SCANCODE_NUMLOCK);
}
}
else
{
flags = (extended) ? KBD_FLAGS_EXTENDED : 0;
flags |= (down) ? KBD_FLAGS_DOWN : KBD_FLAGS_RELEASE;
freerdp_input_send_keyboard_event_2(input, down, rdp_scancode);
input->KeyboardEvent(input, flags, scancode);
if ((scancode == 0x3A) && (down == false)) /* caps lock was released */
if ((rdp_scancode == RDP_SCANCODE_CAPSLOCK) && (down == false))
{
uint32 syncFlags;
syncFlags = xf_kbd_get_toggle_keys_state(xfi);

View File

@ -24,6 +24,7 @@ typedef struct rdp_input rdpInput;
#include <freerdp/api.h>
#include <freerdp/freerdp.h>
#include <freerdp/keyboard_scancode.h>
/* keyboard Flags */
#define KBD_FLAGS_EXTENDED 0x0100
@ -79,4 +80,10 @@ FREERDP_API void freerdp_input_send_unicode_keyboard_event(rdpInput* input, uint
FREERDP_API void freerdp_input_send_mouse_event(rdpInput* input, uint16 flags, uint16 x, uint16 y);
FREERDP_API void freerdp_input_send_extended_mouse_event(rdpInput* input, uint16 flags, uint16 x, uint16 y);
#define freerdp_input_send_keyboard_event_2(input, down, rdp_scancode) \
freerdp_input_send_keyboard_event(input, \
(rdp_scancode_extended(rdp_scancode) ? KBD_FLAGS_EXTENDED : 0) | \
((down) ? KBD_FLAGS_DOWN : KBD_FLAGS_RELEASE), \
rdp_scancode_code(rdp_scancode))
#endif /* __INPUT_API_H */

View File

@ -0,0 +1,186 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* RDP protocol "scancodes"
*
* 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_LOCALE_KEYBOARD_RDP_SCANCODE_H
#define __FREERDP_LOCALE_KEYBOARD_RDP_SCANCODE_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."
* The 8-bit value is later called "keyCode"
* 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) ((uint8)(_rdp_scancode & 0xff))
#define rdp_scancode_extended(_rdp_scancode) (((_rdp_scancode) & 0x100) ? true : false)
#define mk_rdp_scancode(_code, _extended) (((_code) & 0xff) | ((_extended) ? 0x100 : 0))
/* Defines for known RDP_SCANCODE protocol values.
* Mostly the same as the PKBDLLHOOKSTRUCT scanCode, "A hardware scan code for the key", @msdn{ms644967}.
* Based @msdn{ms894073} US, @msdn{ms894072} UK, @msdn{ms892472} */
#define RDP_SCANCODE_UNKNOWN mk_rdp_scancode(0x00, false)
#define RDP_SCANCODE_ESCAPE mk_rdp_scancode(0x01, false) /* VK_ESCAPE */
#define RDP_SCANCODE_KEY_1 mk_rdp_scancode(0x02, false) /* VK_KEY_1 */
#define RDP_SCANCODE_KEY_2 mk_rdp_scancode(0x03, false) /* VK_KEY_2 */
#define RDP_SCANCODE_KEY_3 mk_rdp_scancode(0x04, false) /* VK_KEY_3 */
#define RDP_SCANCODE_KEY_4 mk_rdp_scancode(0x05, false) /* VK_KEY_4 */
#define RDP_SCANCODE_KEY_5 mk_rdp_scancode(0x06, false) /* VK_KEY_5 */
#define RDP_SCANCODE_KEY_6 mk_rdp_scancode(0x07, false) /* VK_KEY_6 */
#define RDP_SCANCODE_KEY_7 mk_rdp_scancode(0x08, false) /* VK_KEY_7 */
#define RDP_SCANCODE_KEY_8 mk_rdp_scancode(0x09, false) /* VK_KEY_8 */
#define RDP_SCANCODE_KEY_9 mk_rdp_scancode(0x0A, false) /* VK_KEY_9 */
#define RDP_SCANCODE_KEY_0 mk_rdp_scancode(0x0B, false) /* VK_KEY_0 */
#define RDP_SCANCODE_OEM_MINUS mk_rdp_scancode(0x0C, false) /* VK_OEM_MINUS */
#define RDP_SCANCODE_OEM_PLUS mk_rdp_scancode(0x0D, false) /* VK_OEM_PLUS */
#define RDP_SCANCODE_BACKSPACE mk_rdp_scancode(0x0E, false) /* VK_BACK Backspace */
#define RDP_SCANCODE_TAB mk_rdp_scancode(0x0F, false) /* VK_TAB */
#define RDP_SCANCODE_KEY_Q mk_rdp_scancode(0x10, false) /* VK_KEY_Q */
#define RDP_SCANCODE_KEY_W mk_rdp_scancode(0x11, false) /* VK_KEY_W */
#define RDP_SCANCODE_KEY_E mk_rdp_scancode(0x12, false) /* VK_KEY_E */
#define RDP_SCANCODE_KEY_R mk_rdp_scancode(0x13, false) /* VK_KEY_R */
#define RDP_SCANCODE_KEY_T mk_rdp_scancode(0x14, false) /* VK_KEY_T */
#define RDP_SCANCODE_KEY_Y mk_rdp_scancode(0x15, false) /* VK_KEY_Y */
#define RDP_SCANCODE_KEY_U mk_rdp_scancode(0x16, false) /* VK_KEY_U */
#define RDP_SCANCODE_KEY_I mk_rdp_scancode(0x17, false) /* VK_KEY_I */
#define RDP_SCANCODE_KEY_O mk_rdp_scancode(0x18, false) /* VK_KEY_O */
#define RDP_SCANCODE_KEY_P mk_rdp_scancode(0x19, false) /* VK_KEY_P */
#define RDP_SCANCODE_OEM_4 mk_rdp_scancode(0x1A, false) /* VK_OEM_4 '[' on US */
#define RDP_SCANCODE_OEM_6 mk_rdp_scancode(0x1B, false) /* VK_OEM_6 ']' on US */
#define RDP_SCANCODE_RETURN mk_rdp_scancode(0x1C, false) /* VK_RETURN Normal Enter */
#define RDP_SCANCODE_LCONTROL mk_rdp_scancode(0x1D, false) /* VK_LCONTROL */
#define RDP_SCANCODE_KEY_A mk_rdp_scancode(0x1E, false) /* VK_KEY_A */
#define RDP_SCANCODE_KEY_S mk_rdp_scancode(0x1F, false) /* VK_KEY_S */
#define RDP_SCANCODE_KEY_D mk_rdp_scancode(0x20, false) /* VK_KEY_D */
#define RDP_SCANCODE_KEY_F mk_rdp_scancode(0x21, false) /* VK_KEY_F */
#define RDP_SCANCODE_KEY_G mk_rdp_scancode(0x22, false) /* VK_KEY_G */
#define RDP_SCANCODE_KEY_H mk_rdp_scancode(0x23, false) /* VK_KEY_H */
#define RDP_SCANCODE_KEY_J mk_rdp_scancode(0x24, false) /* VK_KEY_J */
#define RDP_SCANCODE_KEY_K mk_rdp_scancode(0x25, false) /* VK_KEY_K */
#define RDP_SCANCODE_KEY_L mk_rdp_scancode(0x26, false) /* VK_KEY_L */
#define RDP_SCANCODE_OEM_1 mk_rdp_scancode(0x27, false) /* VK_OEM_1 ';' on US */
#define RDP_SCANCODE_OEM_7 mk_rdp_scancode(0x28, false) /* VK_OEM_7 "'" on US */
#define RDP_SCANCODE_OEM_3 mk_rdp_scancode(0x29, false) /* VK_OEM_3 Top left, '`' on US, JP DBE_SBCSCHAR */
#define RDP_SCANCODE_LSHIFT mk_rdp_scancode(0x2A, false) /* VK_LSHIFT */
#define RDP_SCANCODE_OEM_5 mk_rdp_scancode(0x2B, false) /* VK_OEM_5 Next to Enter, '\' on US */
#define RDP_SCANCODE_KEY_Z mk_rdp_scancode(0x2C, false) /* VK_KEY_Z */
#define RDP_SCANCODE_KEY_X mk_rdp_scancode(0x2D, false) /* VK_KEY_X */
#define RDP_SCANCODE_KEY_C mk_rdp_scancode(0x2E, false) /* VK_KEY_C */
#define RDP_SCANCODE_KEY_V mk_rdp_scancode(0x2F, false) /* VK_KEY_V */
#define RDP_SCANCODE_KEY_B mk_rdp_scancode(0x30, false) /* VK_KEY_B */
#define RDP_SCANCODE_KEY_N mk_rdp_scancode(0x31, false) /* VK_KEY_N */
#define RDP_SCANCODE_KEY_M mk_rdp_scancode(0x32, false) /* VK_KEY_M */
#define RDP_SCANCODE_OEM_COMMA mk_rdp_scancode(0x33, false) /* VK_OEM_COMMA */
#define RDP_SCANCODE_OEM_PERIOD mk_rdp_scancode(0x34, false) /* VK_OEM_PERIOD */
#define RDP_SCANCODE_OEM_2 mk_rdp_scancode(0x35, false) /* VK_OEM_2 '/' on US */
#define RDP_SCANCODE_RSHIFT mk_rdp_scancode(0x36, false) /* VK_RSHIFT */
#define RDP_SCANCODE_MULTIPLY mk_rdp_scancode(0x37, false) /* VK_MULTIPLY Numerical */
#define RDP_SCANCODE_LMENU mk_rdp_scancode(0x38, false) /* VK_LMENU Left 'Alt' key */
#define RDP_SCANCODE_SPACE mk_rdp_scancode(0x39, false) /* VK_SPACE */
#define RDP_SCANCODE_CAPSLOCK mk_rdp_scancode(0x3A, false) /* VK_CAPITAL 'Caps Lock', JP DBE_ALPHANUMERIC */
#define RDP_SCANCODE_F1 mk_rdp_scancode(0x3B, false) /* VK_F1 */
#define RDP_SCANCODE_F2 mk_rdp_scancode(0x3C, false) /* VK_F2 */
#define RDP_SCANCODE_F3 mk_rdp_scancode(0x3D, false) /* VK_F3 */
#define RDP_SCANCODE_F4 mk_rdp_scancode(0x3E, false) /* VK_F4 */
#define RDP_SCANCODE_F5 mk_rdp_scancode(0x3F, false) /* VK_F5 */
#define RDP_SCANCODE_F6 mk_rdp_scancode(0x40, false) /* VK_F6 */
#define RDP_SCANCODE_F7 mk_rdp_scancode(0x41, false) /* VK_F7 */
#define RDP_SCANCODE_F8 mk_rdp_scancode(0x42, false) /* VK_F8 */
#define RDP_SCANCODE_F9 mk_rdp_scancode(0x43, false) /* VK_F9 */
#define RDP_SCANCODE_F10 mk_rdp_scancode(0x44, false) /* VK_F10 */
#define RDP_SCANCODE_NUMLOCK mk_rdp_scancode(0x45, false) /* VK_NUMLOCK */ /* Note: when this seems to appear in PKBDLLHOOKSTRUCT it means Pause which must be sent as Ctrl + NumLock */
#define RDP_SCANCODE_SCROLLLOCK mk_rdp_scancode(0x46, false) /* VK_SCROLL 'Scroll Lock', JP OEM_SCROLL */
#define RDP_SCANCODE_NUMPAD7 mk_rdp_scancode(0x47, false) /* VK_NUMPAD7 */
#define RDP_SCANCODE_NUMPAD8 mk_rdp_scancode(0x48, false) /* VK_NUMPAD8 */
#define RDP_SCANCODE_NUMPAD9 mk_rdp_scancode(0x49, false) /* VK_NUMPAD9 */
#define RDP_SCANCODE_SUBTRACT mk_rdp_scancode(0x4A, false) /* VK_SUBTRACT */
#define RDP_SCANCODE_NUMPAD4 mk_rdp_scancode(0x4B, false) /* VK_NUMPAD4 */
#define RDP_SCANCODE_NUMPAD5 mk_rdp_scancode(0x4C, false) /* VK_NUMPAD5 */
#define RDP_SCANCODE_NUMPAD6 mk_rdp_scancode(0x4D, false) /* VK_NUMPAD6 */
#define RDP_SCANCODE_ADD mk_rdp_scancode(0x4E, false) /* VK_ADD */
#define RDP_SCANCODE_NUMPAD1 mk_rdp_scancode(0x4F, false) /* VK_NUMPAD1 */
#define RDP_SCANCODE_NUMPAD2 mk_rdp_scancode(0x50, false) /* VK_NUMPAD2 */
#define RDP_SCANCODE_NUMPAD3 mk_rdp_scancode(0x51, false) /* VK_NUMPAD3 */
#define RDP_SCANCODE_NUMPAD0 mk_rdp_scancode(0x52, false) /* VK_NUMPAD0 */
#define RDP_SCANCODE_DECIMAL mk_rdp_scancode(0x53, false) /* VK_DECIMAL Numerical, '.' on US */
#define RDP_SCANCODE_SYSREQ mk_rdp_scancode(0x54, false) /* Sys Req */
#define RDP_SCANCODE_OEM_102 mk_rdp_scancode(0x56, false) /* VK_OEM_102 Lower left '\' on US */
#define RDP_SCANCODE_F11 mk_rdp_scancode(0x57, false) /* VK_F11 */
#define RDP_SCANCODE_F12 mk_rdp_scancode(0x58, false) /* VK_F12 */
#define RDP_SCANCODE_SLEEP mk_rdp_scancode(0x5F, false) /* VK_SLEEP OEM_8 on FR (undocumented?) */
#define RDP_SCANCODE_ZOOM mk_rdp_scancode(0x62, false) /* VK_ZOOM (undocumented?) */
#define RDP_SCANCODE_HELP mk_rdp_scancode(0x63, false) /* VK_HELP (undocumented?) */
#define RDP_SCANCODE_F13 mk_rdp_scancode(0x64, false) /* VK_F13 */ /* JP agree, should 0x7d according to ms894073 */
#define RDP_SCANCODE_F14 mk_rdp_scancode(0x65, false) /* VK_F14 */
#define RDP_SCANCODE_F15 mk_rdp_scancode(0x66, false) /* VK_F15 */
#define RDP_SCANCODE_F16 mk_rdp_scancode(0x67, false) /* VK_F16 */
#define RDP_SCANCODE_F17 mk_rdp_scancode(0x68, false) /* VK_F17 */
#define RDP_SCANCODE_F18 mk_rdp_scancode(0x69, false) /* VK_F18 */
#define RDP_SCANCODE_F19 mk_rdp_scancode(0x6A, false) /* VK_F19 */
#define RDP_SCANCODE_F20 mk_rdp_scancode(0x6B, false) /* VK_F20 */
#define RDP_SCANCODE_F21 mk_rdp_scancode(0x6C, false) /* VK_F21 */
#define RDP_SCANCODE_F22 mk_rdp_scancode(0x6D, false) /* VK_F22 */
#define RDP_SCANCODE_F23 mk_rdp_scancode(0x6E, false) /* VK_F23 */ /* JP agree */
#define RDP_SCANCODE_F24 mk_rdp_scancode(0x6F, false) /* VK_F24 */ /* 0x87 according to ms894073 */
#define RDP_SCANCODE_HIRAGANA mk_rdp_scancode(0x70, false) /* JP DBE_HIRAGANA */
#define RDP_SCANCODE_HANJA_KANJI mk_rdp_scancode(0x71, false) /* VK_HANJA / VK_KANJI (undocumented?) */
#define RDP_SCANCODE_KANA_HANGUL mk_rdp_scancode(0x72, false) /* VK_KANA / VK_HANGUL (undocumented?) */
#define RDP_SCANCODE_ABNT_C1 mk_rdp_scancode(0x73, false) /* VK_ABNT_C1 JP OEM_102 */
#define RDP_SCANCODE_F24_JP mk_rdp_scancode(0x76, false) /* JP F24 */
#define RDP_SCANCODE_CONVERT_JP mk_rdp_scancode(0x79, false) /* JP CONVERT */
#define RDP_SCANCODE_NONCONVERT_JP mk_rdp_scancode(0x7B, false) /* JP NONCONVERT */
#define RDP_SCANCODE_TAB_JP mk_rdp_scancode(0x7C, false) /* JP TAB */
#define RDP_SCANCODE_BACKSLASH_JP mk_rdp_scancode(0x7D, false) /* JP OEM_5 ('\') */
#define RDP_SCANCODE_ABNT_C2 mk_rdp_scancode(0x7E, false) /* VK_ABNT_C2, JP */
#define RDP_SCANCODE_ABNT_C2 mk_rdp_scancode(0x7E, false) /* JP OEM_PA2 */
#define RDP_SCANCODE_RETURN_KP mk_rdp_scancode(0x1C, true) /* not RDP_SCANCODE_RETURN Numerical Enter */
#define RDP_SCANCODE_RCONTROL mk_rdp_scancode(0x1D, true) /* VK_RCONTROL */
#define RDP_SCANCODE_DIVIDE mk_rdp_scancode(0x35, true) /* VK_DIVIDE Numerical */
#define RDP_SCANCODE_PRINTSCREEN mk_rdp_scancode(0x37, true) /* VK_EXECUTE/VK_PRINT/VK_SNAPSHOT Print Screen */
#define RDP_SCANCODE_RMENU mk_rdp_scancode(0x38, true) /* VK_RMENU Right 'Alt' / 'Alt Gr' */
#define RDP_SCANCODE_PAUSE mk_rdp_scancode(0x46, true) /* VK_PAUSE Pause / Break (Slightly special handling) */
#define RDP_SCANCODE_HOME mk_rdp_scancode(0x47, true) /* VK_HOME */
#define RDP_SCANCODE_UP mk_rdp_scancode(0x48, true) /* VK_UP */
#define RDP_SCANCODE_PRIOR mk_rdp_scancode(0x49, true) /* VK_PRIOR 'Page Up' */
#define RDP_SCANCODE_LEFT mk_rdp_scancode(0x4B, true) /* VK_LEFT */
#define RDP_SCANCODE_RIGHT mk_rdp_scancode(0x4D, true) /* VK_RIGHT */
#define RDP_SCANCODE_END mk_rdp_scancode(0x4F, true) /* VK_END */
#define RDP_SCANCODE_DOWN mk_rdp_scancode(0x50, true) /* VK_DOWN */
#define RDP_SCANCODE_NEXT mk_rdp_scancode(0x51, true) /* VK_NEXT 'Page Down' */
#define RDP_SCANCODE_INSERT mk_rdp_scancode(0x52, true) /* VK_INSERT */
#define RDP_SCANCODE_DELETE mk_rdp_scancode(0x53, true) /* VK_DELETE */
#define RDP_SCANCODE_NULL mk_rdp_scancode(0x54, true) /* <00> */
#define RDP_SCANCODE_HELP2 mk_rdp_scancode(0x56, true) /* Help - documented, different from VK_HELP */
#define RDP_SCANCODE_LWIN mk_rdp_scancode(0x5B, true) /* VK_LWIN */
#define RDP_SCANCODE_RWIN mk_rdp_scancode(0x5C, true) /* VK_RWIN */
#define RDP_SCANCODE_APPS mk_rdp_scancode(0x5D, true) /* VK_APPS Application */
#define RDP_SCANCODE_POWER_JP mk_rdp_scancode(0x5E, true) /* JP POWER */
#define RDP_SCANCODE_SLEEP_JP mk_rdp_scancode(0x5F, true) /* JP SLEEP */
/* _not_ valid scancode, but this is what a windows PKBDLLHOOKSTRUCT for NumLock contains */
#define RDP_SCANCODE_NUMLOCK_EXTENDED mk_rdp_scancode(0x45, true) /* should be RDP_SCANCODE_NUMLOCK */
#define RDP_SCANCODE_RSHIFT_EXTENDED mk_rdp_scancode(0x36, true) /* should be RDP_SCANCODE_RSHIFT */
#endif /* __FREERDP_LOCALE_KEYBOARD_RDP_SCANCODE_H */

View File

@ -23,6 +23,7 @@
#include <freerdp/api.h>
#include <freerdp/types.h>
#include <freerdp/locale/virtual_key_codes.h>
#include <freerdp/keyboard_scancode.h>
#define RDP_KEYBOARD_LAYOUT_TYPE_STANDARD 1
#define RDP_KEYBOARD_LAYOUT_TYPE_VARIANT 2
@ -35,14 +36,6 @@ struct _RDP_KEYBOARD_LAYOUT
};
typedef struct _RDP_KEYBOARD_LAYOUT RDP_KEYBOARD_LAYOUT;
struct _RDP_SCANCODE
{
uint32 code; /* Windows "scan code" */
boolean extended; /* extended key flag */
};
typedef struct _RDP_SCANCODE RDP_SCANCODE;
/* Keyboard layout IDs */
#define KBD_ARABIC_101 0x00000401
@ -199,8 +192,8 @@ typedef struct _RDP_SCANCODE RDP_SCANCODE;
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 uint32 freerdp_keyboard_get_rdp_scancode_from_x11_keycode(uint32 keycode, boolean* extended);
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, boolean extended);
FREERDP_API uint32 freerdp_keyboard_get_rdp_scancode_from_virtual_key_code(uint32 vkcode, boolean* extended);
FREERDP_API RDP_SCANCODE freerdp_keyboard_get_rdp_scancode_from_virtual_key_code(uint32 vkcode);
#endif /* __FREERDP_LOCALE_KEYBOARD_H */

View File

@ -80,21 +80,19 @@ uint32 freerdp_keyboard_init(uint32 keyboardLayoutId)
memset(RDP_SCANCODE_TO_X11_KEYCODE, 0, sizeof(RDP_SCANCODE_TO_X11_KEYCODE));
for (keycode=0; keycode < ARRAY_SIZE(RDP_SCANCODE_TO_X11_KEYCODE); keycode++)
RDP_SCANCODE_TO_X11_KEYCODE
[X11_KEYCODE_TO_RDP_SCANCODE[keycode].code]
[X11_KEYCODE_TO_RDP_SCANCODE[keycode].extended ? 1: 0] = keycode;
[rdp_scancode_code(X11_KEYCODE_TO_RDP_SCANCODE[keycode])]
[rdp_scancode_extended(X11_KEYCODE_TO_RDP_SCANCODE[keycode]) ? 1 : 0] = keycode;
return keyboardLayoutId;
}
uint32 freerdp_keyboard_get_rdp_scancode_from_x11_keycode(uint32 keycode, boolean* extended)
RDP_SCANCODE freerdp_keyboard_get_rdp_scancode_from_x11_keycode(uint32 keycode)
{
DEBUG_KBD("x11 keycode: %02X -> rdp code: %02X%s", keycode,
X11_KEYCODE_TO_RDP_SCANCODE[keycode].code,
X11_KEYCODE_TO_RDP_SCANCODE[keycode].extended ? " extended" : "");
rdp_scancode_code(X11_KEYCODE_TO_RDP_SCANCODE[keycode]),
rdp_scancode_extended(X11_KEYCODE_TO_RDP_SCANCODE[keycode]) ? " extended" : "");
*extended = X11_KEYCODE_TO_RDP_SCANCODE[keycode].extended;
return X11_KEYCODE_TO_RDP_SCANCODE[keycode].code;
return X11_KEYCODE_TO_RDP_SCANCODE[keycode];
}
uint32 freerdp_keyboard_get_x11_keycode_from_rdp_scancode(uint32 scancode, boolean extended)
@ -105,8 +103,7 @@ uint32 freerdp_keyboard_get_x11_keycode_from_rdp_scancode(uint32 scancode, boole
return RDP_SCANCODE_TO_X11_KEYCODE[scancode][0];
}
uint32 freerdp_keyboard_get_rdp_scancode_from_virtual_key_code(uint32 vkcode, boolean* extended)
RDP_SCANCODE freerdp_keyboard_get_rdp_scancode_from_virtual_key_code(uint32 vkcode)
{
*extended = VIRTUAL_KEY_CODE_TO_DEFAULT_RDP_SCANCODE_TABLE[vkcode].extended;
return VIRTUAL_KEY_CODE_TO_DEFAULT_RDP_SCANCODE_TABLE[vkcode].code;
return VIRTUAL_KEY_CODE_TO_DEFAULT_RDP_SCANCODE_TABLE[vkcode];
}

View File

@ -39,7 +39,6 @@ int freerdp_keyboard_load_map(uint32 keycode_to_vkcode[256], char* name)
char* beg;
char* end;
uint32 vkcode;
uint32 scancode;
int kbd_found = 0;
char* keymap_path;
uint32 keycode = 0;
@ -49,7 +48,6 @@ int freerdp_keyboard_load_map(uint32 keycode_to_vkcode[256], char* name)
char keymap_filename[256] = "";
char keycode_string[32] = "";
char vkcode_name[128] = "";
boolean extended = false;
beg = name;
@ -130,8 +128,6 @@ int freerdp_keyboard_load_map(uint32 keycode_to_vkcode[256], char* name)
/* Load this key mapping in the keyboard mapping */
vkcode = freerdp_keyboard_get_virtual_key_code_from_name(vkcode_name);
scancode = VIRTUAL_KEY_CODE_TO_DEFAULT_RDP_SCANCODE_TABLE[vkcode].code;
extended = VIRTUAL_KEY_CODE_TO_DEFAULT_RDP_SCANCODE_TABLE[vkcode].extended;
keycode_to_vkcode[keycode] = vkcode;
}
else if ((pch = strstr(buffer, ": extends")) != NULL)

View File

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

View File

@ -206,13 +206,8 @@ char* freerdp_detect_keymap_from_xkb()
uint32 freerdp_keyboard_init_x11(uint32 keyboardLayoutId, RDP_SCANCODE x11_keycode_to_rdp_scancode[256])
{
char* keymap;
uint32 vkcode;
uint32 keycode;
uint32 scancode;
boolean extended;
char* xkb_layout;
char* xkb_variant;
uint32 keycode_to_vkcode[256];
memset(keycode_to_vkcode, 0, sizeof(keycode_to_vkcode));
@ -258,11 +253,7 @@ uint32 freerdp_keyboard_init_x11(uint32 keyboardLayoutId, RDP_SCANCODE x11_keyco
if (!(vkcode > 0 && vkcode < 256))
continue;
scancode = VIRTUAL_KEY_CODE_TO_DEFAULT_RDP_SCANCODE_TABLE[vkcode].code;
extended = VIRTUAL_KEY_CODE_TO_DEFAULT_RDP_SCANCODE_TABLE[vkcode].extended;
x11_keycode_to_rdp_scancode[keycode].code = scancode;
x11_keycode_to_rdp_scancode[keycode].extended = extended;
x11_keycode_to_rdp_scancode[keycode] = VIRTUAL_KEY_CODE_TO_DEFAULT_RDP_SCANCODE_TABLE[vkcode];
}
return keyboardLayoutId;

View File

@ -26,276 +26,130 @@
#include "xkb_layout_ids.h"
#include "liblocale.h"
extern const RDP_SCANCODE VIRTUAL_KEY_CODE_TO_DEFAULT_RDP_SCANCODE_TABLE[256];
#include <X11/Xlib.h>
#include <X11/XKBlib.h>
#include <X11/extensions/XKBfile.h>
#include <X11/extensions/XKBrules.h>
VIRTUAL_KEY_CODE_TO_XKB_KEY_NAME VIRTUAL_KEY_CODE_TO_XKB_KEY_NAME_TABLE[256] =
struct _XKB_KEY_NAME_SCANCODE
{
{ 0, "", "" },
{ VK_LBUTTON, "", "" }, /* VK_LBUTTON */
{ VK_RBUTTON, "", "" }, /* VK_RBUTTON */
{ VK_CANCEL, "", "" }, /* VK_CANCEL */
{ VK_MBUTTON, "", "" }, /* VK_MBUTTON */
{ VK_XBUTTON1, "", "" }, /* VK_XBUTTON1 */
{ VK_XBUTTON2, "", "" }, /* VK_XBUTTON2 */
{ 0, "", "" },
{ VK_BACK, "BKSP", "" }, /* VK_BACK */
{ VK_TAB, "TAB", "" }, /* VK_TAB */
{ 0, "", "" },
{ 0, "", "" },
{ 0, "", "" }, /* VK_CLEAR */
{ VK_RETURN, "RTRN", "KPEN" }, /* VK_RETURN */
{ 0, "", "" },
{ 0, "", "" },
{ VK_SHIFT, "LFSH", "" }, /* VK_SHIFT */
{ VK_CONTROL, "", "" }, /* VK_CONTROL */
{ VK_MENU, "LALT", "" }, /* VK_MENU */
{ VK_PAUSE, "", "PAUS" }, /* VK_PAUSE */
{ VK_CAPITAL, "CAPS", "" }, /* VK_CAPITAL */
{ VK_KANA, "", "" }, /* VK_KANA / VK_HANGUL */
{ 0, "", "" },
{ VK_JUNJA, "", "" }, /* VK_JUNJA */
{ VK_FINAL, "", "" }, /* VK_FINAL */
{ VK_KANJI, "", "" }, /* VK_HANJA / VK_KANJI */
{ 0, "", "" },
{ VK_ESCAPE, "ESC", "" }, /* VK_ESCAPE */
{ VK_CONVERT, "", "" }, /* VK_CONVERT */
{ VK_NONCONVERT, "", "" }, /* VK_NONCONVERT */
{ VK_ACCEPT, "", "" }, /* VK_ACCEPT */
{ VK_MODECHANGE, "", "" }, /* VK_MODECHANGE */
{ VK_SPACE, "SPCE", "" }, /* VK_SPACE */
{ VK_PRIOR, "", "PGUP" }, /* VK_PRIOR */
{ VK_NEXT, "", "PGDN" }, /* VK_NEXT */
{ VK_END, "", "END" }, /* VK_END */
{ VK_HOME, "", "HOME" }, /* VK_HOME */
{ VK_LEFT, "", "LEFT" }, /* VK_LEFT */
{ VK_UP, "", "UP" }, /* VK_UP */
{ VK_RIGHT, "", "RGHT" }, /* VK_RIGHT */
{ VK_DOWN, "", "DOWN" }, /* VK_DOWN */
{ VK_SELECT, "", "" }, /* VK_SELECT */
{ VK_PRINT, "", "PRSC" }, /* VK_PRINT */
{ VK_EXECUTE, "", "" }, /* VK_EXECUTE */
{ VK_SNAPSHOT, "", "" }, /* VK_SNAPSHOT */
{ VK_INSERT, "", "INS" }, /* VK_INSERT */
{ VK_DELETE, "", "DELE" }, /* VK_DELETE */
{ VK_HELP, "", "" }, /* VK_HELP */
{ VK_KEY_0, "AE10", "" }, /* VK_KEY_0 */
{ VK_KEY_1, "AE01", "" }, /* VK_KEY_1 */
{ VK_KEY_2, "AE02", "" }, /* VK_KEY_2 */
{ VK_KEY_3, "AE03", "" }, /* VK_KEY_3 */
{ VK_KEY_4, "AE04", "" }, /* VK_KEY_4 */
{ VK_KEY_5, "AE05", "" }, /* VK_KEY_5 */
{ VK_KEY_6, "AE06", "" }, /* VK_KEY_6 */
{ VK_KEY_7, "AE07", "" }, /* VK_KEY_7 */
{ VK_KEY_8, "AE08", "" }, /* VK_KEY_8 */
{ VK_KEY_9, "AE09", "" }, /* VK_KEY_9 */
{ 0, "", "" },
{ 0, "", "" },
{ 0, "", "" },
{ 0, "", "" },
{ 0, "", "" },
{ 0, "", "" },
{ 0, "", "" },
{ VK_KEY_A, "AC01", "" }, /* VK_KEY_A */
{ VK_KEY_B, "AB05", "" }, /* VK_KEY_B */
{ VK_KEY_C, "AB03", "" }, /* VK_KEY_C */
{ VK_KEY_D, "AC03", "" }, /* VK_KEY_D */
{ VK_KEY_E, "AD03", "" }, /* VK_KEY_E */
{ VK_KEY_F, "AC04", "" }, /* VK_KEY_F */
{ VK_KEY_G, "AC05", "" }, /* VK_KEY_G */
{ VK_KEY_H, "AC06", "" }, /* VK_KEY_H */
{ VK_KEY_I, "AD08", "" }, /* VK_KEY_I */
{ VK_KEY_J, "AC07", "" }, /* VK_KEY_J */
{ VK_KEY_K, "AC08", "" }, /* VK_KEY_K */
{ VK_KEY_L, "AC09", "" }, /* VK_KEY_L */
{ VK_KEY_M, "AB07", "" }, /* VK_KEY_M */
{ VK_KEY_N, "AB06", "" }, /* VK_KEY_N */
{ VK_KEY_O, "AD09", "" }, /* VK_KEY_O */
{ VK_KEY_P, "AD10", "" }, /* VK_KEY_P */
{ VK_KEY_Q, "AD01", "" }, /* VK_KEY_Q */
{ VK_KEY_R, "AD04", "" }, /* VK_KEY_R */
{ VK_KEY_S, "AC02", "" }, /* VK_KEY_S */
{ VK_KEY_T, "AD05", "" }, /* VK_KEY_T */
{ VK_KEY_U, "AD07", "" }, /* VK_KEY_U */
{ VK_KEY_V, "AB04", "" }, /* VK_KEY_V */
{ VK_KEY_W, "AD02", "" }, /* VK_KEY_W */
{ VK_KEY_X, "AB02", "" }, /* VK_KEY_X */
{ VK_KEY_Y, "AD06", "" }, /* VK_KEY_Y */
{ VK_KEY_Z, "AB01", "" }, /* VK_KEY_Z */
{ VK_LWIN, "", "LWIN" }, /* VK_LWIN */
{ VK_RWIN, "", "RWIN" }, /* VK_RWIN */
{ VK_APPS, "", "COMP" }, /* VK_APPS */
{ 0, "", "" },
{ VK_SLEEP, "", "" }, /* VK_SLEEP */
{ VK_NUMPAD0, "KP0", "" }, /* VK_NUMPAD0 */
{ VK_NUMPAD1, "KP1", "" }, /* VK_NUMPAD1 */
{ VK_NUMPAD2, "KP2", "" }, /* VK_NUMPAD2 */
{ VK_NUMPAD3, "KP3", "" }, /* VK_NUMPAD3 */
{ VK_NUMPAD4, "KP4", "" }, /* VK_NUMPAD4 */
{ VK_NUMPAD5, "KP5", "" }, /* VK_NUMPAD5 */
{ VK_NUMPAD6, "KP6", "" }, /* VK_NUMPAD6 */
{ VK_NUMPAD7, "KP7", "" }, /* VK_NUMPAD7 */
{ VK_NUMPAD8, "KP8", "" }, /* VK_NUMPAD8 */
{ VK_NUMPAD9, "KP9", "" }, /* VK_NUMPAD9 */
{ VK_MULTIPLY, "KPMU", "" }, /* VK_MULTIPLY */
{ VK_ADD, "KPAD", "" }, /* VK_ADD */
{ VK_SEPARATOR, "", "" }, /* VK_SEPARATOR */
{ VK_SUBTRACT, "KPSU", "" }, /* VK_SUBTRACT */
{ VK_DECIMAL, "KPDL", "" }, /* VK_DECIMAL */
{ VK_DIVIDE, "AB10", "KPDV" }, /* VK_DIVIDE */
{ VK_F1, "FK01", "" }, /* VK_F1 */
{ VK_F2, "FK02", "" }, /* VK_F2 */
{ VK_F3, "FK03", "" }, /* VK_F3 */
{ VK_F4, "FK04", "" }, /* VK_F4 */
{ VK_F5, "FK05", "" }, /* VK_F5 */
{ VK_F6, "FK06", "" }, /* VK_F6 */
{ VK_F7, "FK07", "" }, /* VK_F7 */
{ VK_F8, "FK08", "" }, /* VK_F8 */
{ VK_F9, "FK09", "" }, /* VK_F9 */
{ VK_F10, "FK10", "" }, /* VK_F10 */
{ VK_F11, "FK11", "" }, /* VK_F11 */
{ VK_F12, "FK12", "" }, /* VK_F12 */
{ VK_F13, "", "" }, /* VK_F13 */
{ VK_F14, "", "" }, /* VK_F14 */
{ VK_F15, "", "" }, /* VK_F15 */
{ VK_F16, "", "" }, /* VK_F16 */
{ VK_F17, "", "" }, /* VK_F17 */
{ VK_F18, "", "" }, /* VK_F18 */
{ VK_F19, "", "" }, /* VK_F19 */
{ VK_F20, "", "" }, /* VK_F20 */
{ VK_F21, "", "" }, /* VK_F21 */
{ VK_F22, "", "" }, /* VK_F22 */
{ VK_F23, "", "" }, /* VK_F23 */
{ VK_F24, "", "" }, /* VK_F24 */
{ 0, "", "" },
{ 0, "", "" },
{ 0, "", "" },
{ 0, "", "" },
{ 0, "", "" },
{ 0, "", "" },
{ 0, "", "" },
{ 0, "", "" },
{ VK_NUMLOCK, "NMLK", "" }, /* VK_NUMLOCK */
{ VK_SCROLL, "SCLK", "" }, /* VK_SCROLL */
{ 0, "", "" },
{ 0, "", "" },
{ 0, "", "" },
{ 0, "", "" },
{ 0, "", "" },
{ 0, "", "" },
{ 0, "", "" },
{ 0, "", "" },
{ 0, "", "" },
{ 0, "", "" },
{ 0, "", "" },
{ 0, "", "" },
{ 0, "", "" },
{ 0, "", "" },
{ VK_LSHIFT, "", "" }, /* VK_LSHIFT */
{ VK_RSHIFT, "RTSH", "" }, /* VK_RSHIFT */
{ VK_LCONTROL, "LCTL", "" }, /* VK_LCONTROL */
{ VK_RCONTROL, "", "RCTL" }, /* VK_RCONTROL */
{ VK_LMENU, "", "" }, /* VK_LMENU */
{ VK_RMENU, "", "RALT" }, /* VK_RMENU */
{ VK_BROWSER_BACK, "", "" }, /* VK_BROWSER_BACK */
{ VK_BROWSER_FORWARD, "", "" }, /* VK_BROWSER_FORWARD */
{ VK_BROWSER_REFRESH, "", "" }, /* VK_BROWSER_REFRESH */
{ VK_BROWSER_STOP, "", "" }, /* VK_BROWSER_STOP */
{ VK_BROWSER_SEARCH, "", "" }, /* VK_BROWSER_SEARCH */
{ VK_BROWSER_FAVORITES, "", "" }, /* VK_BROWSER_FAVORITES */
{ VK_BROWSER_HOME, "", "" }, /* VK_BROWSER_HOME */
{ VK_VOLUME_MUTE, "", "" }, /* VK_VOLUME_MUTE */
{ VK_VOLUME_DOWN, "", "" }, /* VK_VOLUME_DOWN */
{ VK_VOLUME_UP, "", "" }, /* VK_VOLUME_UP */
{ VK_MEDIA_NEXT_TRACK, "", "" }, /* VK_MEDIA_NEXT_TRACK */
{ VK_MEDIA_PREV_TRACK, "", "" }, /* VK_MEDIA_PREV_TRACK */
{ VK_MEDIA_STOP, "", "" }, /* VK_MEDIA_STOP */
{ VK_MEDIA_PLAY_PAUSE, "", "" }, /* VK_MEDIA_PLAY_PAUSE */
{ VK_LAUNCH_MAIL, "", "" }, /* VK_LAUNCH_MAIL */
{ VK_MEDIA_SELECT, "", "" }, /* VK_MEDIA_SELECT */
{ VK_LAUNCH_APP1, "", "" }, /* VK_LAUNCH_APP1 */
{ VK_LAUNCH_APP2, "", "" }, /* VK_LAUNCH_APP2 */
{ 0, "", "" },
{ 0, "", "" },
{ VK_OEM_1, "AC10", "" }, /* VK_OEM_1 */
{ VK_OEM_PLUS, "AE12", "" }, /* VK_OEM_PLUS */
{ VK_OEM_COMMA, "AB08", "" }, /* VK_OEM_COMMA */
{ VK_OEM_MINUS, "AE11", "" }, /* VK_OEM_MINUS */
{ VK_OEM_PERIOD, "AB09", "" }, /* VK_OEM_PERIOD */
{ VK_OEM_2, "AB10", "" }, /* VK_OEM_2 */
{ VK_OEM_3, "TLDE", "" }, /* VK_OEM_3 */
{ VK_ABNT_C1, "AB11", "" }, /* VK_ABNT_C1 */
{ VK_ABNT_C2, "I129", "" }, /* VK_ABNT_C2 */
{ 0, "", "" },
{ 0, "", "" },
{ 0, "", "" },
{ 0, "", "" },
{ 0, "", "" },
{ 0, "", "" },
{ 0, "", "" },
{ 0, "", "" },
{ 0, "", "" },
{ 0, "", "" },
{ 0, "", "" },
{ 0, "", "" },
{ 0, "", "" },
{ 0, "", "" },
{ 0, "", "" },
{ 0, "", "" },
{ 0, "", "" },
{ 0, "", "" },
{ 0, "", "" },
{ 0, "", "" },
{ 0, "", "" },
{ 0, "", "" },
{ 0, "", "" },
{ 0, "", "" },
{ VK_OEM_4, "AD11", "" }, /* VK_OEM_4 */
{ VK_OEM_5, "BKSL", "" }, /* VK_OEM_5 */
{ VK_OEM_6, "AD12", "" }, /* VK_OEM_6 */
{ VK_OEM_7, "AC11", "" }, /* VK_OEM_7 */
{ VK_OEM_8, "", "" }, /* VK_OEM_8 */
{ 0, "", "" },
{ 0, "", "" },
{ VK_OEM_102, "LSGT", "" }, /* VK_OEM_102 */
{ 0, "", "" },
{ 0, "", "" },
{ VK_PROCESSKEY, "", "" }, /* VK_PROCESSKEY */
{ 0, "", "" },
{ VK_PACKET, "", "" }, /* VK_PACKET */
{ 0, "", "" },
{ 0, "", "" },
{ 0, "", "" },
{ 0, "", "" },
{ 0, "", "" },
{ 0, "", "" },
{ 0, "", "" },
{ 0, "", "" },
{ 0, "", "" },
{ 0, "", "" },
{ 0, "", "" },
{ 0, "", "" },
{ 0, "", "" },
{ 0, "", "" },
{ VK_ATTN, "", "" }, /* VK_ATTN */
{ VK_CRSEL, "", "" }, /* VK_CRSEL */
{ VK_EXSEL, "", "" }, /* VK_EXSEL */
{ VK_EREOF, "", "" }, /* VK_EREOF */
{ VK_PLAY, "", "" }, /* VK_PLAY */
{ VK_ZOOM, "", "" }, /* VK_ZOOM */
{ VK_NONAME, "", "" }, /* VK_NONAME */
{ VK_PA1, "", "" }, /* VK_PA1 */
{ VK_OEM_CLEAR, "", "" }, /* VK_OEM_CLEAR */
{ 0, "", "" }
const char* xkb_keyname; /* XKB keyname */
RDP_SCANCODE rdp_scancode;
};
typedef struct _XKB_KEY_NAME_SCANCODE XKB_KEY_NAME_SCANCODE;
/*
{ 0x54, 0, "" , "LVL3" },
*/
XKB_KEY_NAME_SCANCODE XKB_KEY_NAME_SCANCODE_TABLE[] =
{
{ "BKSP", RDP_SCANCODE_BACKSPACE},
{ "TAB", RDP_SCANCODE_TAB},
{ "RTRN", RDP_SCANCODE_RETURN}, // not KP
{ "LFSH", RDP_SCANCODE_LSHIFT},
{ "LALT", RDP_SCANCODE_LMENU},
{ "CAPS", RDP_SCANCODE_CAPSLOCK},
{ "ESC", RDP_SCANCODE_ESCAPE},
{ "SPCE", RDP_SCANCODE_SPACE},
{ "AE10", RDP_SCANCODE_KEY_0},
{ "AE01", RDP_SCANCODE_KEY_1},
{ "AE02", RDP_SCANCODE_KEY_2},
{ "AE03", RDP_SCANCODE_KEY_3},
{ "AE04", RDP_SCANCODE_KEY_4},
{ "AE05", RDP_SCANCODE_KEY_5},
{ "AE06", RDP_SCANCODE_KEY_6},
{ "AE07", RDP_SCANCODE_KEY_7},
{ "AE08", RDP_SCANCODE_KEY_8},
{ "AE09", RDP_SCANCODE_KEY_9},
{ "AC01", RDP_SCANCODE_KEY_A},
{ "AB05", RDP_SCANCODE_KEY_B},
{ "AB03", RDP_SCANCODE_KEY_C},
{ "AC03", RDP_SCANCODE_KEY_D},
{ "AD03", RDP_SCANCODE_KEY_E},
{ "AC04", RDP_SCANCODE_KEY_F},
{ "AC05", RDP_SCANCODE_KEY_G},
{ "AC06", RDP_SCANCODE_KEY_H},
{ "AD08", RDP_SCANCODE_KEY_I},
{ "AC07", RDP_SCANCODE_KEY_J},
{ "AC08", RDP_SCANCODE_KEY_K},
{ "AC09", RDP_SCANCODE_KEY_L},
{ "AB07", RDP_SCANCODE_KEY_M},
{ "AB06", RDP_SCANCODE_KEY_N},
{ "AD09", RDP_SCANCODE_KEY_O},
{ "AD10", RDP_SCANCODE_KEY_P},
{ "AD01", RDP_SCANCODE_KEY_Q},
{ "AD04", RDP_SCANCODE_KEY_R},
{ "AC02", RDP_SCANCODE_KEY_S},
{ "AD05", RDP_SCANCODE_KEY_T},
{ "AD07", RDP_SCANCODE_KEY_U},
{ "AB04", RDP_SCANCODE_KEY_V},
{ "AD02", RDP_SCANCODE_KEY_W},
{ "AB02", RDP_SCANCODE_KEY_X},
{ "AD06", RDP_SCANCODE_KEY_Y},
{ "AB01", RDP_SCANCODE_KEY_Z},
{ "KP0", RDP_SCANCODE_NUMPAD0},
{ "KP1", RDP_SCANCODE_NUMPAD1},
{ "KP2", RDP_SCANCODE_NUMPAD2},
{ "KP3", RDP_SCANCODE_NUMPAD3},
{ "KP4", RDP_SCANCODE_NUMPAD4},
{ "KP5", RDP_SCANCODE_NUMPAD5},
{ "KP6", RDP_SCANCODE_NUMPAD6},
{ "KP7", RDP_SCANCODE_NUMPAD7},
{ "KP8", RDP_SCANCODE_NUMPAD8},
{ "KP9", RDP_SCANCODE_NUMPAD9},
{ "KPMU", RDP_SCANCODE_MULTIPLY},
{ "KPAD", RDP_SCANCODE_ADD},
{ "KPSU", RDP_SCANCODE_SUBTRACT},
{ "KPDL", RDP_SCANCODE_DECIMAL},
{ "AB10", RDP_SCANCODE_OEM_2}, // not KP, not RDP_SCANCODE_DIVIDE
{ "FK01", RDP_SCANCODE_F1},
{ "FK02", RDP_SCANCODE_F2},
{ "FK03", RDP_SCANCODE_F3},
{ "FK04", RDP_SCANCODE_F4},
{ "FK05", RDP_SCANCODE_F5},
{ "FK06", RDP_SCANCODE_F6},
{ "FK07", RDP_SCANCODE_F7},
{ "FK08", RDP_SCANCODE_F8},
{ "FK09", RDP_SCANCODE_F9},
{ "FK10", RDP_SCANCODE_F10},
{ "FK11", RDP_SCANCODE_F11},
{ "FK12", RDP_SCANCODE_F12},
{ "NMLK", RDP_SCANCODE_NUMLOCK},
{ "SCLK", RDP_SCANCODE_SCROLLLOCK},
{ "RTSH", RDP_SCANCODE_RSHIFT},
{ "LCTL", RDP_SCANCODE_LCONTROL},
{ "AC10", RDP_SCANCODE_OEM_1},
{ "AE12", RDP_SCANCODE_OEM_PLUS},
{ "AB08", RDP_SCANCODE_OEM_COMMA},
{ "AE11", RDP_SCANCODE_OEM_MINUS},
{ "AB09", RDP_SCANCODE_OEM_PERIOD},
{ "TLDE", RDP_SCANCODE_OEM_3},
{ "AB11", RDP_SCANCODE_ABNT_C1},
{ "I129", RDP_SCANCODE_ABNT_C2},
{ "AD11", RDP_SCANCODE_OEM_4},
{ "BKSL", RDP_SCANCODE_OEM_5},
{ "AD12", RDP_SCANCODE_OEM_6},
{ "AC11", RDP_SCANCODE_OEM_7},
{ "LSGT", RDP_SCANCODE_OEM_102},
{ "KPEN", RDP_SCANCODE_RETURN_KP}, // KP!
{ "PAUS", RDP_SCANCODE_PAUSE},
{ "PGUP", RDP_SCANCODE_PRIOR},
{ "PGDN", RDP_SCANCODE_NEXT},
{ "END", RDP_SCANCODE_END},
{ "HOME", RDP_SCANCODE_HOME},
{ "LEFT", RDP_SCANCODE_LEFT},
{ "UP", RDP_SCANCODE_UP},
{ "RGHT", RDP_SCANCODE_RIGHT},
{ "DOWN", RDP_SCANCODE_DOWN},
{ "PRSC", RDP_SCANCODE_PRINTSCREEN},
{ "INS", RDP_SCANCODE_INSERT},
{ "DELE", RDP_SCANCODE_DELETE},
{ "LWIN", RDP_SCANCODE_LWIN},
{ "RWIN", RDP_SCANCODE_RWIN},
{ "COMP", RDP_SCANCODE_APPS},
{ "KPDV", RDP_SCANCODE_DIVIDE}, // KP!
{ "RCTL", RDP_SCANCODE_RCONTROL},
{ "RALT", RDP_SCANCODE_RMENU},
{ "AE13", RDP_SCANCODE_BACKSLASH_JP} // JP
/* { "LVL3", 0x54} */
};
void* freerdp_keyboard_xkb_init()
{
@ -406,11 +260,8 @@ 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 i, j;
uint32 vkcode;
boolean found;
XkbDescPtr xkb;
uint32 scancode;
boolean extended;
boolean status = false;
if (display && (xkb = XkbGetMap(display, 0, XkbUseCoreKbd)))
@ -422,56 +273,30 @@ 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;
extended = false;
memcpy(xkb_keyname, xkb->names->keys[i].name, 4);
for (j = 0; j < 256; j++)
if (strlen(xkb_keyname) < 1)
continue;
for (j = 0; j < ARRAY_SIZE(XKB_KEY_NAME_SCANCODE_TABLE); j++)
{
if (strlen(xkb_keyname) < 1)
continue;
if (VIRTUAL_KEY_CODE_TO_XKB_KEY_NAME_TABLE[j].xkb_keyname)
if (!strcmp(xkb_keyname, XKB_KEY_NAME_SCANCODE_TABLE[j].xkb_keyname))
{
if (!strcmp(xkb_keyname, VIRTUAL_KEY_CODE_TO_XKB_KEY_NAME_TABLE[j].xkb_keyname))
DEBUG_KBD("%4s: keycode: 0x%02X -> rdp scancode: 0x%04X",
xkb_keyname, i, XKB_KEY_NAME_SCANCODE_TABLE[j].rdp_scancode);
if (found)
{
vkcode = j;
extended = false;
found = true;
break;
DEBUG_KBD("Internal error! duplicate key %s!", xkb_keyname);
}
}
if (VIRTUAL_KEY_CODE_TO_XKB_KEY_NAME_TABLE[j].xkb_keyname_extended)
{
if (!strcmp(xkb_keyname, VIRTUAL_KEY_CODE_TO_XKB_KEY_NAME_TABLE[j].xkb_keyname_extended))
{
vkcode = j;
if (VIRTUAL_KEY_CODE_TO_XKB_KEY_NAME_TABLE[j].vkcode != vkcode)
{
printf("error at vkcode %d vs vkcode %d", vkcode,
VIRTUAL_KEY_CODE_TO_XKB_KEY_NAME_TABLE[j].vkcode);
}
extended = true;
found = true;
break;
}
x11_keycode_to_rdp_scancode[i] = XKB_KEY_NAME_SCANCODE_TABLE[j].rdp_scancode;
found = true;
}
}
if (found)
{
scancode = VIRTUAL_KEY_CODE_TO_DEFAULT_RDP_SCANCODE_TABLE[vkcode].code;
DEBUG_KBD("%4s: keycode: 0x%02X -> vkcode: 0x%02X %-13s -> rdp scancode: 0x%02X %s",
xkb_keyname, i, vkcode, freerdp_keyboard_get_virtual_key_code_name(vkcode),
scancode, extended ? " extended" : "");
x11_keycode_to_rdp_scancode[i].code = scancode;
x11_keycode_to_rdp_scancode[i].extended = extended;
}
else
if (!found)
{
DEBUG_KBD("%4s: keycode: 0x%02X -> no RDP scancode found", xkb_keyname, i);
}

View File

@ -23,14 +23,6 @@
#include <freerdp/types.h>
#include <freerdp/locale/keyboard.h>
struct _VIRTUAL_KEY_CODE_TO_XKB_KEY_NAME
{
uint32 vkcode; /* virtual key code */
const char* xkb_keyname; /* XKB keyname */
const char* xkb_keyname_extended; /* XKB keyname (extended) */
};
typedef struct _VIRTUAL_KEY_CODE_TO_XKB_KEY_NAME VIRTUAL_KEY_CODE_TO_XKB_KEY_NAME;
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]);

View File

@ -29,6 +29,7 @@ void xf_input_synchronize_event(rdpInput* input, uint32 flags)
void xf_input_keyboard_event(rdpInput* input, uint16 flags, uint16 code)
{
#ifdef WITH_XTEST
unsigned int keycode;
boolean extended = false;
xfPeerContext* xfp = (xfPeerContext*) input->context;
@ -41,7 +42,6 @@ void xf_input_keyboard_event(rdpInput* input, uint16 flags, uint16 code)
if (keycode != 0)
{
#ifdef WITH_XTEST
pthread_mutex_lock(&(xfp->mutex));
XTestGrabControl(xfi->display, True);
@ -54,8 +54,8 @@ void xf_input_keyboard_event(rdpInput* input, uint16 flags, uint16 code)
XTestGrabControl(xfi->display, False);
pthread_mutex_unlock(&(xfp->mutex));
#endif
}
#endif
}
void xf_input_unicode_keyboard_event(rdpInput* input, uint16 flags, uint16 code)
@ -65,13 +65,13 @@ void xf_input_unicode_keyboard_event(rdpInput* input, uint16 flags, uint16 code)
void xf_input_mouse_event(rdpInput* input, uint16 flags, uint16 x, uint16 y)
{
#ifdef WITH_XTEST
xfPeerContext* xfp = (xfPeerContext*) input->context;
int button = 0;
boolean down = false;
xfPeerContext* xfp = (xfPeerContext*) input->context;
xfInfo* xfi = xfp->info;
pthread_mutex_lock(&(xfp->mutex));
#ifdef WITH_XTEST
XTestGrabControl(xfi->display, True);
if (flags & PTR_FLAGS_WHEEL)
@ -106,22 +106,22 @@ void xf_input_mouse_event(rdpInput* input, uint16 flags, uint16 x, uint16 y)
}
XTestGrabControl(xfi->display, False);
#endif
pthread_mutex_unlock(&(xfp->mutex));
#endif
}
void xf_input_extended_mouse_event(rdpInput* input, uint16 flags, uint16 x, uint16 y)
{
#ifdef WITH_XTEST
xfPeerContext* xfp = (xfPeerContext*) input->context;
xfInfo* xfi = xfp->info;
pthread_mutex_lock(&(xfp->mutex));
#ifdef WITH_XTEST
XTestGrabControl(xfi->display, True);
XTestFakeMotionEvent(xfi->display, 0, x, y, CurrentTime);
XTestGrabControl(xfi->display, False);
#endif
pthread_mutex_unlock(&(xfp->mutex));
#endif
}
void xf_input_register_callbacks(rdpInput* input)