Implement scancode indexing

The mapping from scancodes to the indexes used in xrdp_keymap
is not well designed and contains an implicit dependency on
keycode values.

This mapping is alse slightly different from the index used for
the 'keys' map in the xrdp_wm structure.

This commit introduces support for mapping scancodes directly
to 'scancode indexes' suitable for indexing into both structures.

Some renaming is also done; [MS-RDPBCGR] uses the terms scancode
and keyCode interchangeably. An effort is made to use key_code for a
raw value from a TS_KEYBOARD_EVENT, and scancode for a value which is
produced by the scancode module.
This commit is contained in:
matt335672
2024-06-14 15:57:13 +01:00
parent d82a172b55
commit c91ef80ca9
11 changed files with 298 additions and 144 deletions
+3 -9
View File
@@ -266,6 +266,7 @@ lib_mod_event(struct mod *mod, int msg, tbus param1, tbus param2,
int len;
int key;
int rv;
int scancode;
LOG_DEVEL(LOG_LEVEL_TRACE, "in lib_mod_event");
make_stream(s);
@@ -311,15 +312,8 @@ lib_mod_event(struct mod *mod, int msg, tbus param1, tbus param2,
/* xup doesn't need the Unicode character mapping in param1. Send
* the X11 scancode instead, so xorgxrdp doesn't have to do this
* work again */
if ((param4 & KBD_FLAG_EXT) != 0)
{
// Extended key - set bit 9 of the scancode for the lookup
param1 = scancode_to_keycode(param3 | 0x100);
}
else
{
param1 = scancode_to_keycode(param3);
}
scancode = SCANCODE_FROM_KBD_EVENT(param3, param4);
param1 = scancode_to_x11_keycode(scancode);
}
init_stream(s, 8192);