From f85580660299c90d87be1c65bfd308a1e8a1ad2a Mon Sep 17 00:00:00 2001 From: ed Date: Fri, 17 Mar 2017 11:49:04 +0000 Subject: [PATCH] Added 'JUCE_USE_WINDOWS_POINTER_API' flag to juce_gui_basics.h to enable/disable the advanced Windows pointer API (only available on Windows 8 and above). --- modules/juce_gui_basics/juce_gui_basics.h | 8 ++++++++ modules/juce_gui_basics/native/juce_win32_Windowing.cpp | 8 ++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/modules/juce_gui_basics/juce_gui_basics.h b/modules/juce_gui_basics/juce_gui_basics.h index 4e7795a18a..29a802e870 100644 --- a/modules/juce_gui_basics/juce_gui_basics.h +++ b/modules/juce_gui_basics/juce_gui_basics.h @@ -107,6 +107,14 @@ #define JUCE_USE_XCURSOR 1 #endif +/** Config: JUCE_USE_WINDOWS_POINTER_API + Enables the Windows pointer input API for advanced touch and pen input. This is only available on Windows 8 + and above so disable this if you are using earlier versions of Windows. +*/ +#ifndef JUCE_USE_WINDOWS_POINTER_API + #define JUCE_USE_WINDOWS_POINTER_API 0 +#endif + //============================================================================== namespace juce { diff --git a/modules/juce_gui_basics/native/juce_win32_Windowing.cpp b/modules/juce_gui_basics/native/juce_win32_Windowing.cpp index 20929e2979..6259e80858 100644 --- a/modules/juce_gui_basics/native/juce_win32_Windowing.cpp +++ b/modules/juce_gui_basics/native/juce_win32_Windowing.cpp @@ -2200,12 +2200,14 @@ private: static MouseInputSource::InputSourceType getPointerType (WPARAM wParam) { - #ifdef WM_POINTERWHEEL + #if JUCE_USE_WINDOWS_POINTER_API POINTER_INPUT_TYPE pointerType; if (GetPointerType (GET_POINTERID_WPARAM (wParam), &pointerType)) if (pointerType == 3) return MouseInputSource::InputSourceType::pen; + #else + ignoreUnused (wParam); #endif return MouseInputSource::InputSourceType::mouse; @@ -2348,7 +2350,7 @@ private: return true; } - #ifdef WM_POINTERUPDATE + #if JUCE_USE_WINDOWS_POINTER_API bool handlePointerInput (WPARAM wParam, LPARAM lParam, const bool isDown, const bool isUp) { POINTER_INPUT_TYPE pointerType; @@ -2944,6 +2946,7 @@ private: return 1; //============================================================================== + #if JUCE_USE_WINDOWS_POINTER_API case WM_POINTERUPDATE: if (handlePointerInput (wParam, lParam, false, false)) return 0; @@ -2958,6 +2961,7 @@ private: if (handlePointerInput (wParam, lParam, false, true)) return 0; break; + #endif //============================================================================== case WM_MOUSEMOVE: doMouseMove (getPointFromLParam (lParam), false); return 0;