Allow storage of keysyms in the 0x0100xxxx space. Map AltGr to Ctrl+Alt.
This commit is contained in:
parent
4cb9b67a6f
commit
7fa531cc2e
@ -114,12 +114,12 @@ struct guac_rdp_keymap {
|
|||||||
/**
|
/**
|
||||||
* Static mapping from keysyms to scancodes.
|
* Static mapping from keysyms to scancodes.
|
||||||
*/
|
*/
|
||||||
typedef guac_rdp_keysym_desc guac_rdp_static_keymap[256][256];
|
typedef guac_rdp_keysym_desc guac_rdp_static_keymap[0x200][0x100];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mapping from keysym to current state
|
* Mapping from keysym to current state
|
||||||
*/
|
*/
|
||||||
typedef int guac_rdp_keysym_state_map[256][256];
|
typedef int guac_rdp_keysym_state_map[0x200][0x100];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* US English keymap.
|
* US English keymap.
|
||||||
@ -147,10 +147,22 @@ extern const guac_rdp_keymap guac_rdp_keymap_failsafe;
|
|||||||
extern const guac_rdp_keymap guac_rdp_keymap_base;
|
extern const guac_rdp_keymap guac_rdp_keymap_base;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Simple macro for referencing the mapped value of a scancode for a given
|
* Simple macro for determing whether a keysym can be stored (or retrieved)
|
||||||
* keysym.
|
* from any keymap.
|
||||||
*/
|
*/
|
||||||
#define GUAC_RDP_KEYSYM_LOOKUP(keysym_mapping, keysym) ((keysym_mapping)[((keysym) & 0xFF00) >> 8][(keysym) & 0xFF])
|
#define GUAC_RDP_KEYSYM_STORABLE(keysym) ((keysym) <= 0xFFFF || ((keysym) & 0xFFFF0000) == 0x01000000)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Simple macro for referencing the mapped value of a scancode for a given
|
||||||
|
* keysym. The idea here is that a keysym of the form 0xABCD will map to
|
||||||
|
* mapping[0xAB][0xCD] while a keysym of the form 0x100ABCD will map to
|
||||||
|
* mapping[0x1AB][0xCD].
|
||||||
|
*/
|
||||||
|
#define GUAC_RDP_KEYSYM_LOOKUP(keysym_mapping, keysym) ( \
|
||||||
|
(keysym_mapping) \
|
||||||
|
[(((keysym) & 0xFF00) >> 8) | ((keysym) >> 16)] \
|
||||||
|
[(keysym) & 0xFF] \
|
||||||
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Keysym string containing only the left "shift" key.
|
* Keysym string containing only the left "shift" key.
|
||||||
|
@ -301,7 +301,7 @@ int __guac_rdp_send_keysym(guac_client* client, int keysym, int pressed) {
|
|||||||
freerdp* rdp_inst = guac_client_data->rdp_inst;
|
freerdp* rdp_inst = guac_client_data->rdp_inst;
|
||||||
|
|
||||||
/* If keysym can be in lookup table */
|
/* If keysym can be in lookup table */
|
||||||
if (keysym <= 0xFFFF) {
|
if (GUAC_RDP_KEYSYM_STORABLE(keysym)) {
|
||||||
|
|
||||||
/* Look up scancode mapping */
|
/* Look up scancode mapping */
|
||||||
const guac_rdp_keysym_desc* keysym_desc =
|
const guac_rdp_keysym_desc* keysym_desc =
|
||||||
@ -402,6 +402,7 @@ int rdp_guac_client_key_handler(guac_client* client, int keysym, int pressed) {
|
|||||||
rdp_guac_client_data* guac_client_data = (rdp_guac_client_data*) client->data;
|
rdp_guac_client_data* guac_client_data = (rdp_guac_client_data*) client->data;
|
||||||
|
|
||||||
/* Update keysym state */
|
/* Update keysym state */
|
||||||
|
if (GUAC_RDP_KEYSYM_STORABLE(keysym))
|
||||||
GUAC_RDP_KEYSYM_LOOKUP(guac_client_data->keysym_state, keysym) = pressed;
|
GUAC_RDP_KEYSYM_LOOKUP(guac_client_data->keysym_state, keysym) = pressed;
|
||||||
|
|
||||||
return __guac_rdp_send_keysym(client, keysym, pressed);
|
return __guac_rdp_send_keysym(client, keysym, pressed);
|
||||||
|
@ -186,7 +186,8 @@ static guac_rdp_keysym_desc __guac_rdp_keymap_mapping[] = {
|
|||||||
{ .keysym = 0xffe9, .scancode = 0x38 },
|
{ .keysym = 0xffe9, .scancode = 0x38 },
|
||||||
|
|
||||||
/* Alt_R */
|
/* Alt_R */
|
||||||
{ .keysym = 0xffea, .scancode = 0xB8 },
|
{ .keysym = 0xffea, .scancode = 0x38,
|
||||||
|
.set_keysyms = GUAC_KEYSYMS_CTRL },
|
||||||
|
|
||||||
/* Super_L */
|
/* Super_L */
|
||||||
{ .keysym = 0xffeb, .scancode = 0x5B,
|
{ .keysym = 0xffeb, .scancode = 0x5B,
|
||||||
|
Loading…
Reference in New Issue
Block a user