From d285af2a96cac60ed03b0fcad3a532458c85a038 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Thu, 29 Sep 2016 14:48:33 -0700 Subject: [PATCH] Added Windows support for SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH --- src/video/windows/SDL_windowsevents.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/video/windows/SDL_windowsevents.c b/src/video/windows/SDL_windowsevents.c index 31ecc7152..32d5e14c1 100644 --- a/src/video/windows/SDL_windowsevents.c +++ b/src/video/windows/SDL_windowsevents.c @@ -198,6 +198,12 @@ WindowsScanCodeToSDLScanCode(LPARAM lParam, WPARAM wParam) return code; } +static SDL_bool +WIN_ShouldIgnoreFocusClick() +{ + const char *hint = "1";//SDL_GetHint(SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH); + return (!hint || (*hint == '0')) ? SDL_TRUE : SDL_FALSE; +} void WIN_CheckWParamMouseButton(SDL_bool bwParamMousePressed, SDL_bool bSDLMousePressed, SDL_WindowData *data, Uint8 button, SDL_MouseID mouseID) @@ -210,7 +216,9 @@ WIN_CheckWParamMouseButton(SDL_bool bwParamMousePressed, SDL_bool bSDLMousePress WIN_UpdateClipCursor(data->window); } } - return; + if (WIN_ShouldIgnoreFocusClick()) { + return; + } } if (bwParamMousePressed && !bSDLMousePressed) {