1
0
mirror of https://github.com/FunkyFr3sh/cnc-ddraw.git synced 2025-03-24 17:49:52 +01:00

sync with war2 branch

This commit is contained in:
FunkyFr3sh 2019-08-07 13:26:40 +02:00
parent 636d133046
commit f4375f60c4

View File

@ -1189,6 +1189,28 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
break; break;
//workaround for a bug where sometimes a background window steals the focus
case WM_WINDOWPOSCHANGING:
{
if (ddraw->locked)
{
WINDOWPOS *pos = (WINDOWPOS *)lParam;
if (pos->flags == SWP_NOMOVE + SWP_NOSIZE)
{
mouse_unlock();
if (GetForegroundWindow() == ddraw->hWnd)
mouse_lock();
}
}
break;
}
case WM_MOUSELEAVE:
mouse_unlock();
return 0;
case WM_ACTIVATE: case WM_ACTIVATE:
if (wParam == WA_ACTIVE || wParam == WA_CLICKACTIVE) if (wParam == WA_ACTIVE || wParam == WA_CLICKACTIVE)
{ {
@ -1230,28 +1252,6 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
} }
return 0; return 0;
//workaround for a bug where sometimes a background window steals the focus
case WM_WINDOWPOSCHANGING:
{
if (ddraw->locked)
{
WINDOWPOS *pos = (WINDOWPOS *)lParam;
if (pos->flags == SWP_NOMOVE + SWP_NOSIZE)
{
mouse_unlock();
if (GetForegroundWindow() == ddraw->hWnd)
mouse_lock();
}
}
break;
}
case WM_MOUSELEAVE:
mouse_unlock();
return 0;
case WM_ACTIVATEAPP: case WM_ACTIVATEAPP:
/* C&C and RA stop drawing when they receive this with FALSE wParam, disable in windowed mode */ /* C&C and RA stop drawing when they receive this with FALSE wParam, disable in windowed mode */
if (ddraw->windowed || ddraw->noactivateapp) if (ddraw->windowed || ddraw->noactivateapp)