GUACAMOLE-352: Add utility function for checking whether a keysym exists within the current RDP keyboard layout.
This commit is contained in:
parent
e37fb1dad9
commit
5d56985479
@ -244,6 +244,21 @@ void guac_rdp_keyboard_free(guac_rdp_keyboard* keyboard) {
|
||||
free(keyboard);
|
||||
}
|
||||
|
||||
int guac_rdp_keyboard_is_defined(guac_rdp_keyboard* keyboard, int keysym) {
|
||||
|
||||
/* Verify keysym can actually be stored within keymap */
|
||||
if (!GUAC_RDP_KEYSYM_STORABLE(keysym))
|
||||
return 0;
|
||||
|
||||
/* Look up scancode mapping */
|
||||
const guac_rdp_keysym_desc* keysym_desc =
|
||||
&GUAC_RDP_KEYSYM_LOOKUP(keyboard->keymap, keysym);
|
||||
|
||||
/* Return whether the mapping actually exists */
|
||||
return keysym_desc->scancode != 0;
|
||||
|
||||
}
|
||||
|
||||
int guac_rdp_keyboard_send_event(guac_rdp_keyboard* keyboard,
|
||||
int keysym, int pressed) {
|
||||
|
||||
|
@ -95,6 +95,23 @@ guac_rdp_keyboard* guac_rdp_keyboard_alloc(guac_client* client,
|
||||
*/
|
||||
void guac_rdp_keyboard_free(guac_rdp_keyboard* keyboard);
|
||||
|
||||
/**
|
||||
* Returns whether the given keysym is defined for the keyboard layout
|
||||
* associated with the given keyboard.
|
||||
*
|
||||
* @param keyboard
|
||||
* The guac_rdp_keyboard instance to check.
|
||||
*
|
||||
* @param keysym
|
||||
* The keysym of the key being checked against the keyboard layout of the
|
||||
* given keyboard.
|
||||
*
|
||||
* @return
|
||||
* Non-zero if the key is explicitly defined within the keyboard layout of
|
||||
* the given keyboard, zero otherwise.
|
||||
*/
|
||||
int guac_rdp_keyboard_is_defined(guac_rdp_keyboard* keyboard, int keysym);
|
||||
|
||||
/**
|
||||
* Sends one or more RDP key events, effectively pressing or releasing the
|
||||
* given keysym on the remote side. The key events sent will depend on the
|
||||
|
Loading…
Reference in New Issue
Block a user