summaryrefslogtreecommitdiff
path: root/zen/scroll_window_under_cursor.cpp
diff options
context:
space:
mode:
authorDaniel Wilhelm <daniel@wili.li>2014-04-18 17:22:18 +0200
committerDaniel Wilhelm <daniel@wili.li>2014-04-18 17:22:18 +0200
commitbcc5cc28c6dc5178e8f4fd0cc521034ae5def388 (patch)
treebacc60d27b435d32172f97643576c5e4e953177d /zen/scroll_window_under_cursor.cpp
parent5.9 (diff)
downloadFreeFileSync-bcc5cc28c6dc5178e8f4fd0cc521034ae5def388.tar.gz
FreeFileSync-bcc5cc28c6dc5178e8f4fd0cc521034ae5def388.tar.bz2
FreeFileSync-bcc5cc28c6dc5178e8f4fd0cc521034ae5def388.zip
5.10
Diffstat (limited to 'zen/scroll_window_under_cursor.cpp')
-rw-r--r--zen/scroll_window_under_cursor.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/zen/scroll_window_under_cursor.cpp b/zen/scroll_window_under_cursor.cpp
index 6031cd88..f201bb04 100644
--- a/zen/scroll_window_under_cursor.cpp
+++ b/zen/scroll_window_under_cursor.cpp
@@ -4,10 +4,6 @@
// * Copyright (C) Zenju (zenju AT gmx DOT de) - All Rights Reserved *
// **************************************************************************
-#include <cassert>
-#include "win.h" //includes "windows.h"
-#include "Windowsx.h" //WM_MOUSEWHEEL
-
//redirect mouse wheel events directly to window under cursor rather than window having input focus
//implementing new Windows Vista UI guidelines: http://msdn.microsoft.com/en-us/library/bb545459.aspx#wheel
//this is confirmed to be required for at least Windows 2000 to Windows 8
@@ -15,6 +11,11 @@
//Usage: just include this file into a Windows project
+#include <cassert>
+#include "win.h" //includes "windows.h"
+#include "Windowsx.h" //WM_MOUSEWHEEL
+
+
namespace
{
#ifndef WM_MOUSEHWHEEL //MinGW is clueless...
@@ -25,7 +26,7 @@ LRESULT CALLBACK mouseInputHook(int nCode, WPARAM wParam, LPARAM lParam)
{
//"if nCode is less than zero, the hook procedure must pass the message to the CallNextHookEx function
//without further processing and should return the value returned by CallNextHookEx"
- if (nCode >= 0)
+ if (nCode == HC_ACTION) //the only valid value for this hook type
{
MSG& msgInfo = *reinterpret_cast<MSG*>(lParam);
@@ -37,8 +38,7 @@ LRESULT CALLBACK mouseInputHook(int nCode, WPARAM wParam, LPARAM lParam)
pt.y = GET_Y_LPARAM(msgInfo.lParam); //
//visible child window directly under cursor; attention: not necessarily from our process!
- //http://blogs.msdn.com/b/oldnewthing/archive/2010/12/30/10110077.aspx
- if (HWND hWin = ::WindowFromPoint(pt))
+ if (HWND hWin = ::WindowFromPoint(pt)) //http://blogs.msdn.com/b/oldnewthing/archive/2010/12/30/10110077.aspx
if (msgInfo.hwnd != hWin && ::GetCapture() == nullptr)
{
DWORD winProcessId = 0;
@@ -50,7 +50,6 @@ LRESULT CALLBACK mouseInputHook(int nCode, WPARAM wParam, LPARAM lParam)
}
}
}
-
return ::CallNextHookEx(nullptr, nCode, wParam, lParam);
}
bgstack15