mirror of
https://github.com/morgan9e/FreeRDP
synced 2026-04-15 08:54:38 +09:00
client/win: Fix invalid ShowWindow call from gfx thread
ShowWindow must be called from the thread that owns the window. Currently it might be called from the gfx channel thread which causes random app hangs/window not showing up issues.
This commit is contained in:
committed by
akallabeth
parent
66245e7a00
commit
1bec63c2f2
@@ -62,6 +62,8 @@
|
||||
|
||||
#define TAG CLIENT_TAG("windows")
|
||||
|
||||
#define WM_FREERDP_SHOWWINDOW (WM_USER + 100)
|
||||
|
||||
static BOOL wf_has_console(void)
|
||||
{
|
||||
#ifdef WITH_WIN_CONSOLE
|
||||
@@ -135,7 +137,7 @@ static BOOL wf_end_paint(rdpContext* context)
|
||||
}
|
||||
#endif
|
||||
|
||||
ShowWindow(wfc->hwnd, SW_SHOWNORMAL);
|
||||
PostMessage(wfc->hwnd, WM_FREERDP_SHOWWINDOW, 0, 0);
|
||||
WLog_INFO(TAG, "Window is shown!");
|
||||
fflush(stdout);
|
||||
}
|
||||
@@ -1072,11 +1074,22 @@ static DWORD WINAPI wf_client_thread(LPVOID lpParam)
|
||||
}
|
||||
}
|
||||
|
||||
if (msg.message == WM_SIZE)
|
||||
switch (msg.message)
|
||||
{
|
||||
width = LOWORD(msg.lParam);
|
||||
height = HIWORD(msg.lParam);
|
||||
SetWindowPos(wfc->hwnd, HWND_TOP, 0, 0, width, height, SWP_FRAMECHANGED);
|
||||
case WM_SIZE:
|
||||
{
|
||||
width = LOWORD(msg.lParam);
|
||||
height = HIWORD(msg.lParam);
|
||||
SetWindowPos(wfc->hwnd, HWND_TOP, 0, 0, width, height, SWP_FRAMECHANGED);
|
||||
break;
|
||||
}
|
||||
case WM_FREERDP_SHOWWINDOW:
|
||||
{
|
||||
ShowWindow(wfc->hwnd, SW_NORMAL);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if ((msg_ret == 0) || (msg_ret == -1))
|
||||
|
||||
Reference in New Issue
Block a user