From 85115cbf1670c4fb464e296a549c5ce1832b7318 Mon Sep 17 00:00:00 2001 From: FunkyFr3sh Date: Wed, 14 Oct 2020 10:58:59 +0200 Subject: [PATCH] filter WM_NCACTIVATE with noactivateapp=true --- src/config.c | 2 +- src/wndproc.c | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/config.c b/src/config.c index df5faba..3e6d285 100644 --- a/src/config.c +++ b/src/config.c @@ -281,7 +281,7 @@ static void cfg_create_ini() "; Use the following settings in case there are any issues with the game\n" "\n" "\n" - "; Hide WM_ACTIVATEAPP messages to prevent problems on alt+tab\n" + "; Hide WM_ACTIVATEAPP and WM_NCACTIVATE messages to prevent problems on alt+tab\n" "noactivateapp=false\n" "\n" "; Max game ticks per second, possible values: -1 = disabled, 0 = emulate 60hz vblank, 1-1000 = custom game speed\n" diff --git a/src/wndproc.c b/src/wndproc.c index e31214d..3cbc95c 100644 --- a/src/wndproc.c +++ b/src/wndproc.c @@ -21,7 +21,6 @@ LRESULT CALLBACK fake_WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam switch(uMsg) { - //case WM_NCACTIVATE: case WM_GETMINMAXINFO: case WM_MOVING: case WM_NCLBUTTONDOWN: @@ -30,6 +29,15 @@ LRESULT CALLBACK fake_WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam { return DefWindowProc(hWnd, uMsg, wParam, lParam); } + case WM_NCACTIVATE: + { + if (g_ddraw->noactivateapp) + { + return DefWindowProc(hWnd, uMsg, wParam, lParam); + } + + break; + } case WM_NCHITTEST: { LRESULT result = DefWindowProc(hWnd, uMsg, wParam, lParam);