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:
parent
1d83797a48
commit
f5b661dc1b
2
ddraw.rc
2
ddraw.rc
@ -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
|
||||
|
18
src/main.c
18
src/main.c
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user