Removed Alt-code mapping, using convenient identity relationship between keysyms and Alt-codes instead.
This commit is contained in:
parent
52eddf515a
commit
af4d4681e1
@ -43,8 +43,7 @@ lib_LTLIBRARIES = libguac-client-rdp.la
|
|||||||
|
|
||||||
libguac_client_rdp_la_SOURCES = src/client.c src/rdp_bitmap.c src/rdp_glyph.c src/rdp_pointer.c src/rdp_gdi.c src/guac_handlers.c \
|
libguac_client_rdp_la_SOURCES = src/client.c src/rdp_bitmap.c src/rdp_glyph.c src/rdp_pointer.c src/rdp_gdi.c src/guac_handlers.c \
|
||||||
src/rdp_keymap.c \
|
src/rdp_keymap.c \
|
||||||
src/rdp_keymap_en_us.c \
|
src/rdp_keymap_en_us.c
|
||||||
src/rdp_keymap_alt.c
|
|
||||||
|
|
||||||
libguac_client_rdp_la_LDFLAGS = -version-info 0:0:0
|
libguac_client_rdp_la_LDFLAGS = -version-info 0:0:0
|
||||||
|
|
||||||
|
@ -68,21 +68,6 @@ typedef struct guac_rdp_scancode_map {
|
|||||||
|
|
||||||
} guac_rdp_scancode_map;
|
} guac_rdp_scancode_map;
|
||||||
|
|
||||||
/**
|
|
||||||
* Represents the Alt-code which types a given keysym. This is used as a
|
|
||||||
* fallback mapping, should a particular keymap not support a certain keysym.
|
|
||||||
*
|
|
||||||
* See: http://en.wikipedia.org/wiki/Alt_code
|
|
||||||
*/
|
|
||||||
typedef struct guac_rdp_altcode_map {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The 4-digit Alt-code which types this keysym.
|
|
||||||
*/
|
|
||||||
const char* altcode;
|
|
||||||
|
|
||||||
} guac_rdp_altcode_map;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mapping from keysym to current state
|
* Mapping from keysym to current state
|
||||||
*/
|
*/
|
||||||
@ -93,21 +78,11 @@ typedef int guac_rdp_keysym_state_map[256][256];
|
|||||||
*/
|
*/
|
||||||
typedef guac_rdp_scancode_map guac_rdp_keysym_scancode_map[256][256];
|
typedef guac_rdp_scancode_map guac_rdp_keysym_scancode_map[256][256];
|
||||||
|
|
||||||
/**
|
|
||||||
* Static mapping from keysyms to Alt-codes.
|
|
||||||
*/
|
|
||||||
typedef guac_rdp_altcode_map guac_rdp_keysym_altcode_map[256][256];
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Map of X11 keysyms to RDP scancodes (US English).
|
* Map of X11 keysyms to RDP scancodes (US English).
|
||||||
*/
|
*/
|
||||||
extern const guac_rdp_keysym_scancode_map guac_rdp_keysym_scancode_en_us;
|
extern const guac_rdp_keysym_scancode_map guac_rdp_keysym_scancode_en_us;
|
||||||
|
|
||||||
/**
|
|
||||||
* Map of X11 keysyms to Windows Alt-codes.
|
|
||||||
*/
|
|
||||||
extern const guac_rdp_keysym_altcode_map guac_rdp_keysym_altcode;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Simple macro for referencing the mapped value of an altcode or scancode for a given keysym.
|
* Simple macro for referencing the mapped value of an altcode or scancode for a given keysym.
|
||||||
*/
|
*/
|
||||||
|
@ -56,7 +56,7 @@
|
|||||||
|
|
||||||
void __guac_rdp_update_keysyms(guac_client* client, const int* keysym_string, int from, int to);
|
void __guac_rdp_update_keysyms(guac_client* client, const int* keysym_string, int from, int to);
|
||||||
int __guac_rdp_send_keysym(guac_client* client, int keysym, int pressed);
|
int __guac_rdp_send_keysym(guac_client* client, int keysym, int pressed);
|
||||||
void __guac_rdp_send_altcode(guac_client* client, const char* altcode);
|
void __guac_rdp_send_altcode(guac_client* client, int altcode);
|
||||||
|
|
||||||
int rdp_guac_client_free_handler(guac_client* client) {
|
int rdp_guac_client_free_handler(guac_client* client) {
|
||||||
|
|
||||||
@ -227,11 +227,12 @@ int rdp_guac_client_mouse_handler(guac_client* client, int x, int y, int mask) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void __guac_rdp_send_altcode(guac_client* client, const char* altcode) {
|
void __guac_rdp_send_altcode(guac_client* client, int altcode) {
|
||||||
|
|
||||||
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;
|
||||||
freerdp* rdp_inst = guac_client_data->rdp_inst;
|
freerdp* rdp_inst = guac_client_data->rdp_inst;
|
||||||
const guac_rdp_keysym_scancode_map* keysym_scancodes = guac_client_data->keysym_scancodes;
|
const guac_rdp_keysym_scancode_map* keysym_scancodes = guac_client_data->keysym_scancodes;
|
||||||
|
int i;
|
||||||
|
|
||||||
/* Lookup scancode for Alt */
|
/* Lookup scancode for Alt */
|
||||||
int alt = GUAC_RDP_KEYSYM_LOOKUP(*keysym_scancodes, 0xFFE9 /* Alt_L */).scancode;
|
int alt = GUAC_RDP_KEYSYM_LOOKUP(*keysym_scancodes, 0xFFE9 /* Alt_L */).scancode;
|
||||||
@ -242,18 +243,22 @@ void __guac_rdp_send_altcode(guac_client* client, const char* altcode) {
|
|||||||
/* Press Alt */
|
/* Press Alt */
|
||||||
rdp_inst->input->KeyboardEvent(rdp_inst->input, KBD_FLAGS_DOWN, alt);
|
rdp_inst->input->KeyboardEvent(rdp_inst->input, KBD_FLAGS_DOWN, alt);
|
||||||
|
|
||||||
/* For each character in Alt-code ... */
|
/* For each character in four-digit Alt-code ... */
|
||||||
while (*altcode != '\0') {
|
for (i=0; i<4; i++) {
|
||||||
|
|
||||||
/* Get scancode of keypad digit */
|
/* Get scancode of keypad digit */
|
||||||
int scancode = GUAC_RDP_KEYSYM_LOOKUP(*keysym_scancodes, 0xFFB0 + (*altcode) - '0').scancode;
|
int scancode = GUAC_RDP_KEYSYM_LOOKUP(
|
||||||
|
*keysym_scancodes,
|
||||||
|
0xFFB0 + (altcode / 1000)
|
||||||
|
).scancode;
|
||||||
|
|
||||||
/* Press and release digit */
|
/* Press and release digit */
|
||||||
rdp_inst->input->KeyboardEvent(rdp_inst->input, KBD_FLAGS_DOWN, scancode);
|
rdp_inst->input->KeyboardEvent(rdp_inst->input, KBD_FLAGS_DOWN, scancode);
|
||||||
rdp_inst->input->KeyboardEvent(rdp_inst->input, KBD_FLAGS_RELEASE, scancode);
|
rdp_inst->input->KeyboardEvent(rdp_inst->input, KBD_FLAGS_RELEASE, scancode);
|
||||||
|
|
||||||
/* Next character */
|
/* Shift digits left by one place */
|
||||||
altcode++;
|
altcode = (altcode * 10) % 10000;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Release Alt */
|
/* Release Alt */
|
||||||
@ -304,15 +309,14 @@ int __guac_rdp_send_keysym(guac_client* client, int keysym, int pressed) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If undefined, try to type using Alt-code */
|
/* If undefined but has Alt-code, use Alt-Code */
|
||||||
else {
|
else if (keysym <= 0xFF) {
|
||||||
|
|
||||||
const guac_rdp_altcode_map* altcode_map = &GUAC_RDP_KEYSYM_LOOKUP(guac_rdp_keysym_altcode, keysym);
|
/* NOTE: The Alt-codes are conveniently identical to keysyms. */
|
||||||
if (altcode_map->altcode != NULL) {
|
|
||||||
|
|
||||||
/* Only send Alt-code on press */
|
/* Only send Alt-code on press */
|
||||||
if (pressed)
|
if (pressed)
|
||||||
__guac_rdp_send_altcode(client, altcode_map->altcode);
|
__guac_rdp_send_altcode(client, keysym);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -322,8 +326,6 @@ int __guac_rdp_send_keysym(guac_client* client, int keysym, int pressed) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user