summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHardening <rdp.effort@gmail.com>2014-04-11 10:24:22 +0200
committerHardening <rdp.effort@gmail.com>2014-06-02 15:17:08 +0200
commit6d1d1121a58b19db6e4a60939cbede1fed3d93e2 (patch)
tree72dbc5cee6439fbe00b0a83f7bd83bd0a3d82318
parentea2aa13ceb1a0a87be7af91cbbc3cacb58c75991 (diff)
Use FreeRDP buildin functions to get scancodes
This patch make use of the functions available in FreeRDP to retrieve the scancode to inject.
-rw-r--r--src/compositor-rdp.c24
1 files changed, 6 insertions, 18 deletions
diff --git a/src/compositor-rdp.c b/src/compositor-rdp.c
index 437954f6..b7491297 100644
--- a/src/compositor-rdp.c
+++ b/src/compositor-rdp.c
@@ -822,6 +822,8 @@ xf_peer_post_connect(freerdp_peer* client)
if (rdp_keyboards[i].rdpLayoutCode == settings->KeyboardLayout) {
xkbRuleNames.layout = rdp_keyboards[i].xkbLayout;
xkbRuleNames.variant = rdp_keyboards[i].xkbVariant;
+ weston_log("%s: matching layout=%s variant=%s\n", __FUNCTION__,
+ xkbRuleNames.layout, xkbRuleNames.variant);
break;
}
}
@@ -952,17 +954,6 @@ xf_input_synchronize_event(rdpInput *input, UINT32 flags)
pixman_region32_fini(&damage);
}
-extern DWORD KEYCODE_TO_VKCODE_EVDEV[];
-static uint32_t vk_to_keycode[256];
-static void
-init_vk_translator(void)
-{
- int i;
-
- memset(vk_to_keycode, 0, sizeof(vk_to_keycode));
- for(i = 0; i < 256; i++)
- vk_to_keycode[KEYCODE_TO_VKCODE_EVDEV[i] & 0xff] = i-8;
-}
static void
xf_input_keyboard_event(rdpInput *input, UINT16 flags, UINT16 code)
@@ -986,17 +977,15 @@ xf_input_keyboard_event(rdpInput *input, UINT16 flags, UINT16 code)
full_code |= KBD_FLAGS_EXTENDED;
vk_code = GetVirtualKeyCodeFromVirtualScanCode(full_code, 4);
- if (vk_code > 0xff) {
- weston_log("invalid vk_code %x", vk_code);
- return;
- }
- scan_code = vk_to_keycode[vk_code];
+ if(flags & KBD_FLAGS_EXTENDED)
+ vk_code |= KBDEXT;
+ scan_code = GetKeycodeFromVirtualKeyCode(vk_code, KEYCODE_TYPE_EVDEV);
/*weston_log("code=%x ext=%d vk_code=%x scan_code=%x\n", code, (flags & KBD_FLAGS_EXTENDED) ? 1 : 0,
vk_code, scan_code);*/
notify_key(&peerContext->item.seat, weston_compositor_get_time(),
- scan_code, keyState, STATE_UPDATE_AUTOMATIC);
+ scan_code - 8, keyState, STATE_UPDATE_AUTOMATIC);
}
}
@@ -1188,7 +1177,6 @@ backend_init(struct wl_display *display, int *argc, char *argv[],
freerdp_get_version(&major, &minor, &revision);
weston_log("using FreeRDP version %d.%d.%d\n", major, minor, revision);
- init_vk_translator();
const struct weston_option rdp_options[] = {
{ WESTON_OPTION_BOOLEAN, "env-socket", 0, &config.env_socket },