From 429389af07f8918eadb4df8e263d380b8b3af376 Mon Sep 17 00:00:00 2001 From: FunkyFr3sh Date: Tue, 30 Oct 2018 14:35:13 +0100 Subject: [PATCH] lock mouse in windowed mode if resolution changed during runtime --- src/main.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main.c b/src/main.c index dd6bd17..fc0d9b3 100644 --- a/src/main.c +++ b/src/main.c @@ -354,6 +354,9 @@ HRESULT __stdcall ddraw_SetDisplayMode(IDirectDrawImpl *This, DWORD width, DWORD SendMessage(This->hWnd, WM_SETICON, ICON_SMALL, (LPARAM)hsicon); } + //lock mouse in windowed mode if resolution changed during runtime + BOOL lockMouse = (This->width || This->height) && (This->width != width || This->height != height); + This->render.width = WindowRect.right; This->render.height = WindowRect.bottom; @@ -526,6 +529,9 @@ HRESULT __stdcall ddraw_SetDisplayMode(IDirectDrawImpl *This, DWORD width, DWORD if (This->renderer == render_d3d9_main) InitDirect3D9(); + + if (lockMouse) + mouse_lock(); } else {