You've already forked openvpn-gui
mirror of
https://github.com/OpenVPN/openvpn-gui.git
synced 2025-11-26 14:08:00 +08:00
Avoid blocking calls during WM_OVPN_ECHOMSG processing
We send this message from the connection thread to the main thread using a blocking SendMesssage as the echo message to display is cleared soon after. This sometimes leads to timeouts (and thus long waits). Avoid timeout using Async ShowWindow() and delaying SetForegroundWindow() as these could otherwise wait if the current foreground Window is controlled by the calling thread. Signed-off-by: Selva Nair <selva.nair@gmail.com>
This commit is contained in:
7
echo.c
7
echo.c
@@ -292,6 +292,10 @@ echo_msg_display(connection_t *c, time_t timestamp, const char *title, int type)
|
||||
{
|
||||
WriteStatusLog(c, L"GUI> Failed to display echo message: ", c->echo_msg.title, false);
|
||||
}
|
||||
else if (echo_msg_window)
|
||||
{
|
||||
SetForegroundWindow(echo_msg_window);
|
||||
}
|
||||
}
|
||||
else /* notify */
|
||||
{
|
||||
@@ -610,8 +614,7 @@ MessageDialogFunc(HWND hwnd, UINT msg, UNUSED WPARAM wParam, LPARAM lParam)
|
||||
}
|
||||
|
||||
AddMessageBoxText(hwnd, c->echo_msg.text, c->echo_msg.title, from);
|
||||
SetForegroundWindow(hwnd);
|
||||
ShowWindow(hwnd, SW_SHOW);
|
||||
ShowWindowAsync(hwnd, SW_SHOW);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user