[server,shadow] handle gfx thread in shadow server

This commit is contained in:
Armin Novak 2023-07-31 14:21:18 +02:00 committed by akallabeth
parent 62da5c7e8e
commit f08ed58367
2 changed files with 22 additions and 5 deletions

View File

@ -2059,12 +2059,10 @@ static DWORD WINAPI shadow_client_thread(LPVOID arg)
rdpShadowClient* client = (rdpShadowClient*)arg;
BOOL rc = FALSE;
DWORD status = 0;
DWORD nCount = 0;
wMessage message = { 0 };
wMessage pointerPositionMsg = { 0 };
wMessage pointerAlphaMsg = { 0 };
wMessage audioVolumeMsg = { 0 };
HANDLE events[32] = { 0 };
HANDLE ChannelEvent = 0;
void* UpdateSubscriber = NULL;
HANDLE UpdateEvent = 0;
@ -2135,7 +2133,8 @@ static DWORD WINAPI shadow_client_thread(LPVOID arg)
WINPR_ASSERT(rc);
while (1)
{
nCount = 0;
HANDLE events[MAXIMUM_WAIT_OBJECTS] = { 0 };
DWORD nCount = 0;
events[nCount++] = UpdateEvent;
{
DWORD tmp = peer->GetEventHandles(peer, &events[nCount], 64 - nCount);
@ -2150,6 +2149,12 @@ static DWORD WINAPI shadow_client_thread(LPVOID arg)
}
events[nCount++] = ChannelEvent;
events[nCount++] = MessageQueue_Event(MsgQueue);
HANDLE gfxevent = rdpgfx_server_get_event_handle(client->rdpgfx);
if (gfxevent)
events[nCount++] = gfxevent;
status = WaitForMultipleObjects(nCount, events, FALSE, INFINITE);
if (status == WAIT_FAILED)
@ -2275,6 +2280,14 @@ static DWORD WINAPI shadow_client_thread(LPVOID arg)
}
}
if (gfxevent)
{
if (WaitForSingleObject(gfxevent, 0) == WAIT_OBJECT_0)
{
rdpgfx_server_handle_messages(client->rdpgfx);
}
}
if (WaitForSingleObject(MessageQueue_Event(MsgQueue), 0) == WAIT_OBJECT_0)
{
/* Drain messages. Pointer update could be accumulated. */

View File

@ -27,8 +27,9 @@
int shadow_client_rdpgfx_init(rdpShadowClient* client)
{
RdpgfxServerContext* rdpgfx;
rdpgfx = client->rdpgfx = rdpgfx_server_context_new(client->vcm);
WINPR_ASSERT(client);
RdpgfxServerContext* rdpgfx = client->rdpgfx = rdpgfx_server_context_new(client->vcm);
if (!rdpgfx)
{
return 0;
@ -38,6 +39,9 @@ int shadow_client_rdpgfx_init(rdpShadowClient* client)
rdpgfx->custom = client;
if (!IFCALLRESULT(CHANNEL_RC_OK, rdpgfx->Initialize, rdpgfx, FALSE))
return -1;
return 1;
}