diff --git a/ddraw.rc b/ddraw.rc index 9cf448d..382faff 100644 --- a/ddraw.rc +++ b/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 diff --git a/src/main.c b/src/main.c index b7c7a1c..5d2d446 100644 --- a/src/main.c +++ b/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;