From b79be956239f0de82d6dddd7fd21ac77c6f23378 Mon Sep 17 00:00:00 2001 From: TomW Date: Thu, 8 Oct 2015 19:41:52 +0100 Subject: [PATCH] Force PCem to leave fullscreen mode when losing focus. DirectInput mouse initialisation no longer fails if mouse can not be immediately acquired. --- src/win-mouse.cc | 2 -- src/win.c | 3 +++ 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/win-mouse.cc b/src/win-mouse.cc index 2f7fad7..5ec5a6f 100644 --- a/src/win-mouse.cc +++ b/src/win-mouse.cc @@ -31,8 +31,6 @@ void mouse_init() fatal("mouse_init : SetCooperativeLevel failed\n"); if (FAILED(lpdi_mouse->SetDataFormat(&c_dfDIMouse))) fatal("mouse_init : SetDataFormat failed\n"); - if (FAILED(lpdi_mouse->Acquire())) - fatal("mouse_init : Acquire failed\n"); } void mouse_close() diff --git a/src/win.c b/src/win.c index f9fcf31..ecb06e5 100644 --- a/src/win.c +++ b/src/win.c @@ -843,6 +843,7 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM video_fullscreen = 1; vid_apis[1][vid_api].init(ghwnd); mouse_init(); + leave_fullscreen_flag = 0; endblit(); device_force_redraw(); break; @@ -1015,6 +1016,8 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM } // pclog("Lost focus!\n"); memset(rawinputkey, 0, sizeof(rawinputkey)); + if (video_fullscreen) + leave_fullscreen_flag = 1; break; case WM_LBUTTONUP: