1
0
mirror of https://github.com/FunkyFr3sh/cnc-ddraw.git synced 2025-03-15 06:04:49 +01:00

workaround for a bug where sometimes a background window steals the focus

This commit is contained in:
FunkyFr3sh 2018-06-10 23:25:30 +02:00
parent 1d83797a48
commit f5b661dc1b
2 changed files with 19 additions and 1 deletions

View File

@ -2,7 +2,7 @@
#define vxstr(a,b,c,d) str(a##.##b##.##c##.##d)
#define str(s) #s
#define VERSION 1,1,7,0
#define VERSION 1,1,7,1
1 VERSIONINFO
FILEVERSION VERSION

View File

@ -590,6 +590,24 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
}
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;