diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2017-09-28 13:48:08 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2017-10-05 08:45:14 +0000 |
commit | cccede8fc75d5bdcfc7be3b4390bca52f0f2093f (patch) | |
tree | 381166e338dedc8d4f248457f4ae1974193ed9f0 /src/plugins/platforms/windows/qwindowsmousehandler.cpp | |
parent | 53fb2c48ef472ee74a2a2a47d3a460a0ee74d38b (diff) |
Windows QPA: Directly link against touch functions
They are available on Windows 7.
Change-Id: Ia937c459fe0df0d39d407ca0e65641f8aa583f4a
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
Diffstat (limited to 'src/plugins/platforms/windows/qwindowsmousehandler.cpp')
-rw-r--r-- | src/plugins/platforms/windows/qwindowsmousehandler.cpp | 45 |
1 files changed, 10 insertions, 35 deletions
diff --git a/src/plugins/platforms/windows/qwindowsmousehandler.cpp b/src/plugins/platforms/windows/qwindowsmousehandler.cpp index af4304cb19..75190a19f7 100644 --- a/src/plugins/platforms/windows/qwindowsmousehandler.cpp +++ b/src/plugins/platforms/windows/qwindowsmousehandler.cpp @@ -37,6 +37,13 @@ ** ****************************************************************************/ +#if defined(WINVER) && WINVER < 0x0601 +# undef WINVER +#endif +#if !defined(WINVER) +# define WINVER 0x0601 // Enable touch functions for MinGW +#endif + #include "qwindowsmousehandler.h" #include "qwindowskeymapper.h" #include "qwindowscontext.h" @@ -56,37 +63,6 @@ #include <windowsx.h> -/* Touch is supported from Windows 7 onwards and data structures - * are present in the Windows SDK's, but not in older MSVC Express - * versions. */ - -#if defined(Q_CC_MINGW) || !defined(TOUCHEVENTF_MOVE) - -typedef struct tagTOUCHINPUT { - LONG x; - LONG y; - HANDLE hSource; - DWORD dwID; - DWORD dwFlags; - DWORD dwMask; - DWORD dwTime; - ULONG_PTR dwExtraInfo; - DWORD cxContact; - DWORD cyContact; -} TOUCHINPUT, *PTOUCHINPUT; -typedef TOUCHINPUT const * PCTOUCHINPUT; - -# define TOUCHEVENTF_MOVE 0x0001 -# define TOUCHEVENTF_DOWN 0x0002 -# define TOUCHEVENTF_UP 0x0004 -# define TOUCHEVENTF_INRANGE 0x0008 -# define TOUCHEVENTF_PRIMARY 0x0010 -# define TOUCHEVENTF_NOCOALESCE 0x0020 -# define TOUCHEVENTF_PALM 0x0080 -# define TOUCHINPUTMASKF_CONTACTAREA 0x0004 -# define TOUCHINPUTMASKF_EXTRAINFO 0x0002 -#endif // if defined(Q_CC_MINGW) || !defined(TOUCHEVENTF_MOVE) - QT_BEGIN_NAMESPACE static inline void compressMouseMove(MSG *msg) @@ -522,9 +498,8 @@ bool QWindowsMouseHandler::translateTouchEvent(QWindow *window, HWND, touchPoints.reserve(winTouchPointCount); Qt::TouchPointStates allStates = 0; - QWindowsContext::user32dll.getTouchInputInfo(reinterpret_cast<HANDLE>(msg.lParam), - UINT(msg.wParam), - winTouchInputs.data(), sizeof(TOUCHINPUT)); + GetTouchInputInfo(reinterpret_cast<HTOUCHINPUT>(msg.lParam), + UINT(msg.wParam), winTouchInputs.data(), sizeof(TOUCHINPUT)); for (int i = 0; i < winTouchPointCount; ++i) { const TOUCHINPUT &winTouchInput = winTouchInputs[i]; int id = m_touchInputIDToTouchPointID.value(winTouchInput.dwID, -1); @@ -565,7 +540,7 @@ bool QWindowsMouseHandler::translateTouchEvent(QWindow *window, HWND, touchPoints.append(touchPoint); } - QWindowsContext::user32dll.closeTouchInputHandle(reinterpret_cast<HANDLE>(msg.lParam)); + CloseTouchInputHandle(reinterpret_cast<HTOUCHINPUT>(msg.lParam)); // all touch points released, forget the ids we've seen, they may not be reused if (allStates == Qt::TouchPointReleased) |