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.
(cherry picked from commit 4d23bc9372
)
This commit is contained in:
Родитель
d859574f8c
Коммит
af69f8c25d
|
@ -94,6 +94,9 @@ struct p_client_context
|
|||
UINT64 frames_count;
|
||||
|
||||
wHashTable* vc_ids; /* channel_name -> channel_id map */
|
||||
|
||||
BOOL input_state_sync_pending;
|
||||
UINT32 input_state;
|
||||
};
|
||||
typedef struct p_client_context pClientContext;
|
||||
|
||||
|
|
|
@ -23,11 +23,28 @@
|
|||
#include "pf_context.h"
|
||||
#include "pf_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 = (pServerContext*)input->context;
|
||||
pClientContext* pc = ps->pdata->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)
|
||||
|
@ -37,6 +54,9 @@ static BOOL pf_server_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code)
|
|||
proxyConfig* config = ps->pdata->config;
|
||||
proxyKeyboardEventInfo event;
|
||||
|
||||
if (!pf_server_check_and_sync_input_state(pc))
|
||||
return TRUE;
|
||||
|
||||
if (!config->Keyboard)
|
||||
return TRUE;
|
||||
|
||||
|
@ -55,6 +75,9 @@ static BOOL pf_server_unicode_keyboard_event(rdpInput* input, UINT16 flags, UINT
|
|||
pClientContext* pc = ps->pdata->pc;
|
||||
proxyConfig* config = ps->pdata->config;
|
||||
|
||||
if (!pf_server_check_and_sync_input_state(pc))
|
||||
return TRUE;
|
||||
|
||||
if (!config->Keyboard)
|
||||
return TRUE;
|
||||
|
||||
|
@ -68,6 +91,9 @@ static BOOL pf_server_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT1
|
|||
proxyConfig* config = ps->pdata->config;
|
||||
proxyMouseEventInfo event;
|
||||
|
||||
if (!pf_server_check_and_sync_input_state(pc))
|
||||
return TRUE;
|
||||
|
||||
if (!config->Mouse)
|
||||
return TRUE;
|
||||
|
||||
|
@ -87,6 +113,9 @@ static BOOL pf_server_extended_mouse_event(rdpInput* input, UINT16 flags, UINT16
|
|||
pClientContext* pc = ps->pdata->pc;
|
||||
proxyConfig* config = ps->pdata->config;
|
||||
|
||||
if (!pf_server_check_and_sync_input_state(pc))
|
||||
return TRUE;
|
||||
|
||||
if (!config->Mouse)
|
||||
return TRUE;
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче