[server] fixed key press checks

Do not test KBD_FLAGS_DOWN, this only indicates key repeat. Check for
the absence of KBD_FLAGS_RELEASE
This commit is contained in:
Armin Novak 2022-12-12 10:42:03 +01:00 committed by David Fort
parent f5724c0c13
commit 7fd6278bc6
2 changed files with 9 additions and 9 deletions

View File

@ -801,7 +801,7 @@ static BOOL tf_peer_keyboard_event(rdpInput* input, UINT16 flags, UINT8 code)
WLog_DBG(TAG, "Client sent a keyboard event (flags:0x%04" PRIX16 " code:0x%04" PRIX8 ")", flags,
code);
if ((flags & KBD_FLAGS_DOWN) && (code == RDP_SCANCODE_KEY_G)) /* 'g' key */
if (((flags & KBD_FLAGS_RELEASE) == 0) && (code == RDP_SCANCODE_KEY_G)) /* 'g' key */
{
if (settings->DesktopWidth != 800)
{
@ -822,7 +822,7 @@ static BOOL tf_peer_keyboard_event(rdpInput* input, UINT16 flags, UINT8 code)
update->DesktopResize(update->context);
tcontext->activated = FALSE;
}
else if ((flags & KBD_FLAGS_DOWN) && code == RDP_SCANCODE_KEY_C) /* 'c' key */
else if (((flags & KBD_FLAGS_RELEASE) == 0) && code == RDP_SCANCODE_KEY_C) /* 'c' key */
{
if (tcontext->debug_channel)
{
@ -830,22 +830,22 @@ static BOOL tf_peer_keyboard_event(rdpInput* input, UINT16 flags, UINT8 code)
WTSVirtualChannelWrite(tcontext->debug_channel, (PCHAR) "test2", 5, &written);
}
}
else if ((flags & KBD_FLAGS_DOWN) && code == RDP_SCANCODE_KEY_X) /* 'x' key */
else if (((flags & KBD_FLAGS_RELEASE) == 0) && code == RDP_SCANCODE_KEY_X) /* 'x' key */
{
WINPR_ASSERT(client->Close);
client->Close(client);
}
else if ((flags & KBD_FLAGS_DOWN) && code == RDP_SCANCODE_KEY_R) /* 'r' key */
else if (((flags & KBD_FLAGS_RELEASE) == 0) && code == RDP_SCANCODE_KEY_R) /* 'r' key */
{
tcontext->audin_open = !tcontext->audin_open;
}
#if defined(CHANNEL_AINPUT_SERVER)
else if ((flags & KBD_FLAGS_DOWN) && code == RDP_SCANCODE_KEY_I) /* 'i' key */
else if (((flags & KBD_FLAGS_RELEASE) == 0) && code == RDP_SCANCODE_KEY_I) /* 'i' key */
{
tcontext->ainput_open = !tcontext->ainput_open;
}
#endif
else if ((flags & KBD_FLAGS_DOWN) && code == RDP_SCANCODE_KEY_S) /* 's' key */
else if (((flags & KBD_FLAGS_RELEASE) == 0) && code == RDP_SCANCODE_KEY_S) /* 's' key */
{
}

View File

@ -237,10 +237,10 @@ static BOOL x11_shadow_input_keyboard_event(rdpShadowSubsystem* subsystem, rdpSh
XLockDisplay(x11->display);
XTestGrabControl(x11->display, True);
if (flags & KBD_FLAGS_DOWN)
XTestFakeKeyEvent(x11->display, keycode, True, CurrentTime);
else if (flags & KBD_FLAGS_RELEASE)
if (flags & KBD_FLAGS_RELEASE)
XTestFakeKeyEvent(x11->display, keycode, False, CurrentTime);
else
XTestFakeKeyEvent(x11->display, keycode, True, CurrentTime);
XTestGrabControl(x11->display, False);
XFlush(x11->display);