Use correct names for key events
Replace definitions in ms-rdpbcgr.h marked as TODO with the names defined in [MS-RDPBCGR] Some other simplifications around the fake Unicode event processing have also been made.
This commit is contained in:
+35
-32
@@ -151,6 +151,38 @@ xrdp_fastpath_send(struct xrdp_fastpath *self, struct stream *s)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
* Converts the fastpath keyboard event flags to slowpath event flags
|
||||
* @param Faspath flags
|
||||
* @return slowpath flags
|
||||
*
|
||||
* See [MMS-RDPBCGR] 2.2.8.1.1.3.1.1.1 and 2.2.8.1.2.2.1
|
||||
*/
|
||||
static int
|
||||
get_slowpath_keyboard_event_flags(int fp_flags)
|
||||
{
|
||||
int flags = 0;
|
||||
|
||||
if (fp_flags & FASTPATH_INPUT_KBDFLAGS_RELEASE)
|
||||
{
|
||||
// Assume the key was down prior to this event - the fastpath
|
||||
// message doesn't have a separate flag which maps to
|
||||
// KBDFLAGS_DOWN
|
||||
flags |= KBDFLAGS_DOWN | KBDFLAGS_RELEASE;
|
||||
}
|
||||
if (fp_flags & FASTPATH_INPUT_KBDFLAGS_EXTENDED)
|
||||
{
|
||||
flags |= KBDFLAGS_EXTENDED;
|
||||
}
|
||||
if (fp_flags & FASTPATH_INPUT_KBDFLAGS_EXTENDED1)
|
||||
{
|
||||
flags |= KBDFLAGS_EXTENDED1;
|
||||
}
|
||||
|
||||
return flags;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* FASTPATH_INPUT_EVENT_SCANCODE */
|
||||
static int
|
||||
@@ -159,7 +191,6 @@ xrdp_fastpath_process_EVENT_SCANCODE(struct xrdp_fastpath *self,
|
||||
{
|
||||
int flags;
|
||||
int code;
|
||||
flags = 0;
|
||||
|
||||
if (!s_check_rem_and_log(s, 1, "Parsing [MS-RDPBCGR] TS_FP_KEYBOARD_EVENT"))
|
||||
{
|
||||
@@ -170,24 +201,7 @@ xrdp_fastpath_process_EVENT_SCANCODE(struct xrdp_fastpath *self,
|
||||
"eventHeader.eventFlags 0x%2.2x, eventHeader.eventCode (ignored), "
|
||||
"keyCode %d", eventFlags, code);
|
||||
|
||||
if ((eventFlags & FASTPATH_INPUT_KBDFLAGS_RELEASE))
|
||||
{
|
||||
flags |= KBD_FLAG_UP;
|
||||
}
|
||||
else
|
||||
{
|
||||
flags |= KBD_FLAG_DOWN;
|
||||
}
|
||||
|
||||
if ((eventFlags & FASTPATH_INPUT_KBDFLAGS_EXTENDED))
|
||||
{
|
||||
flags |= KBD_FLAG_EXT;
|
||||
}
|
||||
|
||||
if ((eventFlags & FASTPATH_INPUT_KBDFLAGS_EXTENDED1))
|
||||
{
|
||||
flags |= KBD_FLAG_EXT1;
|
||||
}
|
||||
flags = get_slowpath_keyboard_event_flags(eventFlags);
|
||||
|
||||
xrdp_fastpath_session_callback(self, RDP_INPUT_SCANCODE,
|
||||
code, 0, flags, 0);
|
||||
@@ -296,7 +310,6 @@ xrdp_fastpath_process_EVENT_UNICODE(struct xrdp_fastpath *self,
|
||||
int flags;
|
||||
int code;
|
||||
|
||||
flags = 0;
|
||||
if (!s_check_rem_and_log(s, 2, "Parsing [MS-RDPBCGR] TS_FP_UNICODE_KEYBOARD_EVENT"))
|
||||
{
|
||||
return 1;
|
||||
@@ -307,18 +320,8 @@ xrdp_fastpath_process_EVENT_UNICODE(struct xrdp_fastpath *self,
|
||||
"unicodeCode %d",
|
||||
eventFlags, code);
|
||||
|
||||
if (eventFlags & FASTPATH_INPUT_KBDFLAGS_RELEASE)
|
||||
{
|
||||
flags |= KBD_FLAG_UP;
|
||||
}
|
||||
else
|
||||
{
|
||||
flags |= KBD_FLAG_DOWN;
|
||||
}
|
||||
if (eventFlags & FASTPATH_INPUT_KBDFLAGS_EXTENDED)
|
||||
{
|
||||
flags |= KBD_FLAG_EXT;
|
||||
}
|
||||
flags = get_slowpath_keyboard_event_flags(eventFlags);
|
||||
|
||||
xrdp_fastpath_session_callback(self, RDP_INPUT_UNICODE,
|
||||
code, 0, flags, 0);
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user