mirror of https://github.com/FreeRDP/FreeRDP
locale: encapsulate X11_KEYCODE_TO_RDP_SCANCODE in keyboard.c
This commit is contained in:
parent
430d42aeac
commit
f1fc6d0c25
|
@ -73,11 +73,11 @@ uint32 freerdp_keyboard_init(uint32 keyboardLayoutId)
|
|||
#ifdef WITH_X11
|
||||
|
||||
#ifdef WITH_XKBFILE
|
||||
keyboardLayoutId = freerdp_keyboard_init_xkbfile(keyboardLayoutId);
|
||||
keyboardLayoutId = freerdp_keyboard_init_xkbfile(keyboardLayoutId, X11_KEYCODE_TO_RDP_SCANCODE);
|
||||
if (keyboardLayoutId == 0)
|
||||
keyboardLayoutId = freerdp_keyboard_init_x11(keyboardLayoutId);
|
||||
keyboardLayoutId = freerdp_keyboard_init_x11(keyboardLayoutId, X11_KEYCODE_TO_RDP_SCANCODE);
|
||||
#else
|
||||
keyboardLayoutId = freerdp_keyboard_init_x11(keyboardLayoutId);
|
||||
keyboardLayoutId = freerdp_keyboard_init_x11(keyboardLayoutId, X11_KEYCODE_TO_RDP_SCANCODE);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
@ -30,7 +30,6 @@
|
|||
#include "keyboard_keymap.h"
|
||||
#include "xkb_layout_ids.h"
|
||||
|
||||
extern RDP_SCANCODE X11_KEYCODE_TO_RDP_SCANCODE[256];
|
||||
extern const RDP_SCANCODE VIRTUAL_KEY_CODE_TO_DEFAULT_RDP_SCANCODE_TABLE[256];
|
||||
|
||||
|
||||
|
@ -198,7 +197,7 @@ char* freerdp_detect_keymap_from_xkb()
|
|||
return keymap;
|
||||
}
|
||||
|
||||
uint32 freerdp_keyboard_init_x11(uint32 keyboardLayoutId)
|
||||
uint32 freerdp_keyboard_init_x11(uint32 keyboardLayoutId, RDP_SCANCODE x11_keycode_to_rdp_scancode[256])
|
||||
{
|
||||
char* keymap;
|
||||
uint32 vkcode;
|
||||
|
@ -210,7 +209,7 @@ uint32 freerdp_keyboard_init_x11(uint32 keyboardLayoutId)
|
|||
uint32 keycode_to_vkcode[256];
|
||||
|
||||
memset(keycode_to_vkcode, 0, sizeof(keycode_to_vkcode));
|
||||
memset(X11_KEYCODE_TO_RDP_SCANCODE, 0, sizeof(X11_KEYCODE_TO_RDP_SCANCODE));
|
||||
memset(x11_keycode_to_rdp_scancode, 0, sizeof(x11_keycode_to_rdp_scancode));
|
||||
|
||||
if (keyboardLayoutId == 0)
|
||||
{
|
||||
|
@ -247,8 +246,8 @@ uint32 freerdp_keyboard_init_x11(uint32 keyboardLayoutId)
|
|||
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].code = scancode;
|
||||
x11_keycode_to_rdp_scancode[keycode].extended = extended;
|
||||
}
|
||||
|
||||
return keyboardLayoutId;
|
||||
|
|
|
@ -20,6 +20,6 @@
|
|||
#ifndef __LOCALE_KEYBOARD_X11_H
|
||||
#define __LOCALE_KEYBOARD_X11_H
|
||||
|
||||
uint32 freerdp_keyboard_init_x11(uint32 keyboardLayoutId);
|
||||
uint32 freerdp_keyboard_init_x11(uint32 keyboardLayoutId, RDP_SCANCODE x11_keycode_to_rdp_scancode[256]);
|
||||
|
||||
#endif /* __LOCALE_KEYBOARD_X11_H */
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
#include "xkb_layout_ids.h"
|
||||
#include "liblocale.h"
|
||||
|
||||
extern RDP_SCANCODE X11_KEYCODE_TO_RDP_SCANCODE[256];
|
||||
extern const RDP_SCANCODE VIRTUAL_KEY_CODE_TO_DEFAULT_RDP_SCANCODE_TABLE[256];
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
|
@ -315,10 +314,10 @@ void* freerdp_keyboard_xkb_init()
|
|||
return (void*) display;
|
||||
}
|
||||
|
||||
uint32 freerdp_keyboard_init_xkbfile(uint32 keyboardLayoutId)
|
||||
uint32 freerdp_keyboard_init_xkbfile(uint32 keyboardLayoutId, RDP_SCANCODE x11_keycode_to_rdp_scancode[256])
|
||||
{
|
||||
void* display;
|
||||
memset(X11_KEYCODE_TO_RDP_SCANCODE, 0, sizeof(X11_KEYCODE_TO_RDP_SCANCODE));
|
||||
memset(x11_keycode_to_rdp_scancode, 0, sizeof(x11_keycode_to_rdp_scancode));
|
||||
|
||||
display = freerdp_keyboard_xkb_init();
|
||||
|
||||
|
@ -334,7 +333,7 @@ uint32 freerdp_keyboard_init_xkbfile(uint32 keyboardLayoutId)
|
|||
DEBUG_KBD("detect_keyboard_layout_from_xkb: %X", keyboardLayoutId);
|
||||
}
|
||||
|
||||
freerdp_keyboard_load_map_from_xkbfile(display);
|
||||
freerdp_keyboard_load_map_from_xkbfile(display, x11_keycode_to_rdp_scancode);
|
||||
|
||||
XCloseDisplay(display);
|
||||
|
||||
|
@ -404,7 +403,7 @@ uint32 detect_keyboard_layout_from_xkbfile(void* display)
|
|||
return keyboard_layout;
|
||||
}
|
||||
|
||||
int freerdp_keyboard_load_map_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;
|
||||
|
@ -468,8 +467,8 @@ int freerdp_keyboard_load_map_from_xkbfile(void* display)
|
|||
DEBUG_KBD("%4s: keycode: 0x%02X -> vkcode: 0x%02X -> rdp scancode: 0x%02X %s",
|
||||
xkb_keyname, i, vkcode, scancode, extended ? " extended" : "");
|
||||
|
||||
X11_KEYCODE_TO_RDP_SCANCODE[i].code = scancode;
|
||||
X11_KEYCODE_TO_RDP_SCANCODE[i].extended = extended;
|
||||
x11_keycode_to_rdp_scancode[i].code = scancode;
|
||||
x11_keycode_to_rdp_scancode[i].extended = extended;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -31,8 +31,8 @@ struct _VIRTUAL_KEY_CODE_TO_XKB_KEY_NAME
|
|||
};
|
||||
typedef struct _VIRTUAL_KEY_CODE_TO_XKB_KEY_NAME VIRTUAL_KEY_CODE_TO_XKB_KEY_NAME;
|
||||
|
||||
uint32 freerdp_keyboard_init_xkbfile(uint32 keyboardLayoutId);
|
||||
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);
|
||||
int freerdp_keyboard_load_map_from_xkbfile(void* display, RDP_SCANCODE x11_keycode_to_rdp_scancode[256]);
|
||||
|
||||
#endif /* __LOCALE_KEYBOARD_XKB_H */
|
||||
|
|
Loading…
Reference in New Issue