mirror of https://github.com/FreeRDP/FreeRDP
Added proxy input state sync (#7282)
The proxy server component might receive input related events before the proxy client has established the connection to the target machine. With this change, the current keyboard state is cached and sent to the target when it is ready. All input events received before the target is ready are discarded.
This commit is contained in:
parent
1904020d7f
commit
4d23bc9372
|
@ -102,6 +102,9 @@ struct p_client_context
|
|||
wStream* remote_pem;
|
||||
UINT16 remote_port;
|
||||
UINT32 remote_flags;
|
||||
|
||||
BOOL input_state_sync_pending;
|
||||
UINT32 input_state;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -29,6 +29,19 @@
|
|||
|
||||
#include "proxy_modules.h"
|
||||
|
||||
static BOOL pf_server_check_and_sync_input_state(pClientContext* pc)
|
||||
{
|
||||
if (freerdp_get_state(&pc->context) < CONNECTION_STATE_ACTIVE)
|
||||
return FALSE;
|
||||
if (pc->input_state_sync_pending)
|
||||
{
|
||||
BOOL rc = freerdp_input_send_synchronize_event(pc->context.input, pc->input_state);
|
||||
if (rc)
|
||||
pc->input_state_sync_pending = FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL pf_server_synchronize_event(rdpInput* input, UINT32 flags)
|
||||
{
|
||||
pServerContext* ps;
|
||||
|
@ -41,7 +54,12 @@ static BOOL pf_server_synchronize_event(rdpInput* input, UINT32 flags)
|
|||
|
||||
pc = ps->pdata->pc;
|
||||
WINPR_ASSERT(pc);
|
||||
return freerdp_input_send_synchronize_event(pc->context.input, flags);
|
||||
|
||||
pc->input_state = flags;
|
||||
pc->input_state_sync_pending = TRUE;
|
||||
|
||||
pf_server_check_and_sync_input_state(pc);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL pf_server_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code)
|
||||
|
@ -62,6 +80,9 @@ static BOOL pf_server_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code)
|
|||
config = ps->pdata->config;
|
||||
WINPR_ASSERT(config);
|
||||
|
||||
if (!pf_server_check_and_sync_input_state(pc))
|
||||
return TRUE;
|
||||
|
||||
if (!config->Keyboard)
|
||||
return TRUE;
|
||||
|
||||
|
@ -91,6 +112,9 @@ static BOOL pf_server_unicode_keyboard_event(rdpInput* input, UINT16 flags, UINT
|
|||
config = ps->pdata->config;
|
||||
WINPR_ASSERT(config);
|
||||
|
||||
if (!pf_server_check_and_sync_input_state(pc))
|
||||
return TRUE;
|
||||
|
||||
if (!config->Keyboard)
|
||||
return TRUE;
|
||||
|
||||
|
@ -115,6 +139,9 @@ static BOOL pf_server_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT1
|
|||
config = ps->pdata->config;
|
||||
WINPR_ASSERT(config);
|
||||
|
||||
if (!pf_server_check_and_sync_input_state(pc))
|
||||
return TRUE;
|
||||
|
||||
if (!config->Mouse)
|
||||
return TRUE;
|
||||
|
||||
|
@ -145,6 +172,9 @@ static BOOL pf_server_extended_mouse_event(rdpInput* input, UINT16 flags, UINT16
|
|||
config = ps->pdata->config;
|
||||
WINPR_ASSERT(config);
|
||||
|
||||
if (!pf_server_check_and_sync_input_state(pc))
|
||||
return TRUE;
|
||||
|
||||
if (!config->Mouse)
|
||||
return TRUE;
|
||||
|
||||
|
|
Loading…
Reference in New Issue