locale: encapsulate RDP_SCANCODE_TO_X11_KEYCODE in keyboard.c

This commit is contained in:
Mads Kiilerich 2012-03-24 01:57:10 +01:00
parent 25732265b2
commit 430d42aeac
3 changed files with 9 additions and 14 deletions

View File

@ -68,6 +68,8 @@ uint32 freerdp_detect_keyboard(uint32 keyboardLayoutID)
uint32 freerdp_keyboard_init(uint32 keyboardLayoutId)
{
uint32 keycode;
#ifdef WITH_X11
#ifdef WITH_XKBFILE
@ -79,6 +81,13 @@ uint32 freerdp_keyboard_init(uint32 keyboardLayoutId)
#endif
#endif
memset(RDP_SCANCODE_TO_X11_KEYCODE, 0, sizeof(RDP_SCANCODE_TO_X11_KEYCODE));
for (keycode=0; keycode < ARRAY_SIZE(RDP_SCANCODE_TO_X11_KEYCODE); keycode++)
RDP_SCANCODE_TO_X11_KEYCODE
[X11_KEYCODE_TO_RDP_SCANCODE[keycode].code]
[X11_KEYCODE_TO_RDP_SCANCODE[keycode].extended ? 1: 0] = keycode;
return keyboardLayoutId;
}

View File

@ -30,7 +30,6 @@
#include "keyboard_keymap.h"
#include "xkb_layout_ids.h"
extern uint32 RDP_SCANCODE_TO_X11_KEYCODE[256][2];
extern RDP_SCANCODE X11_KEYCODE_TO_RDP_SCANCODE[256];
extern const RDP_SCANCODE VIRTUAL_KEY_CODE_TO_DEFAULT_RDP_SCANCODE_TABLE[256];
@ -212,7 +211,6 @@ uint32 freerdp_keyboard_init_x11(uint32 keyboardLayoutId)
memset(keycode_to_vkcode, 0, sizeof(keycode_to_vkcode));
memset(X11_KEYCODE_TO_RDP_SCANCODE, 0, sizeof(X11_KEYCODE_TO_RDP_SCANCODE));
memset(RDP_SCANCODE_TO_X11_KEYCODE, 0, sizeof(RDP_SCANCODE_TO_X11_KEYCODE));
if (keyboardLayoutId == 0)
{
@ -251,11 +249,6 @@ uint32 freerdp_keyboard_init_x11(uint32 keyboardLayoutId)
X11_KEYCODE_TO_RDP_SCANCODE[keycode].code = scancode;
X11_KEYCODE_TO_RDP_SCANCODE[keycode].extended = extended;
if (extended)
RDP_SCANCODE_TO_X11_KEYCODE[scancode][1] = keycode;
else
RDP_SCANCODE_TO_X11_KEYCODE[scancode][0] = keycode;
}
return keyboardLayoutId;

View File

@ -26,7 +26,6 @@
#include "xkb_layout_ids.h"
#include "liblocale.h"
extern uint32 RDP_SCANCODE_TO_X11_KEYCODE[256][2];
extern RDP_SCANCODE X11_KEYCODE_TO_RDP_SCANCODE[256];
extern const RDP_SCANCODE VIRTUAL_KEY_CODE_TO_DEFAULT_RDP_SCANCODE_TABLE[256];
@ -320,7 +319,6 @@ uint32 freerdp_keyboard_init_xkbfile(uint32 keyboardLayoutId)
{
void* display;
memset(X11_KEYCODE_TO_RDP_SCANCODE, 0, sizeof(X11_KEYCODE_TO_RDP_SCANCODE));
memset(RDP_SCANCODE_TO_X11_KEYCODE, 0, sizeof(RDP_SCANCODE_TO_X11_KEYCODE));
display = freerdp_keyboard_xkb_init();
@ -472,11 +470,6 @@ int freerdp_keyboard_load_map_from_xkbfile(void* display)
X11_KEYCODE_TO_RDP_SCANCODE[i].code = scancode;
X11_KEYCODE_TO_RDP_SCANCODE[i].extended = extended;
if (extended)
RDP_SCANCODE_TO_X11_KEYCODE[scancode][1] = i;
else
RDP_SCANCODE_TO_X11_KEYCODE[scancode][0] = i;
}
else
{