Skip to content

Commit c09febd

Browse files
committed
Fixed a dependency on GetPointerInfo Windows 8 API in WindowsTouch.dll.
1 parent 3160691 commit c09febd

3 files changed

Lines changed: 66 additions & 0 deletions

File tree

External/WindowsTouch/WindowsTouch.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ extern "C"
1919
_currentWindow = FindWindowA("UnityWndClass", NULL);
2020
if (api == WIN8)
2121
{
22+
HINSTANCE h = LoadLibrary(TEXT("user32.dll"));
23+
GetPointerInfo = (GET_POINTER_INFO) GetProcAddress(h, "GetPointerInfo");
24+
2225
_oldWindowProc = SetWindowLongPtr(_currentWindow, GWLP_WNDPROC, (LONG_PTR)wndProc8);
2326
}
2427
else

External/WindowsTouch/WindowsTouch.h

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
* @author Valentin Simonov / http://va.lent.in/
33
*/
44

5+
#define WINVER _WIN32_WINNT_WIN7
6+
#define _WIN32_WINNT _WIN32_WINNT_WIN7
7+
58
#include <windows.h>
69

710
#define EXPORT_API __declspec(dllexport)
@@ -23,6 +26,65 @@ typedef enum
2326
WIN8
2427
} TOUCH_API;
2528

29+
// <Windows 8 touch API>
30+
31+
#define WM_POINTERUPDATE 0x0245
32+
#define WM_POINTERDOWN 0x0246
33+
#define WM_POINTERUP 0x0247
34+
35+
#define POINTER_FLAG_CANCELED 0x00008000 // Pointer is departing in an abnormal manner
36+
37+
#define GET_POINTERID_WPARAM(wParam) (LOWORD(wParam))
38+
39+
typedef UINT32 POINTER_FLAGS;
40+
41+
typedef enum {
42+
PT_POINTER = 0x00000001,
43+
PT_TOUCH = 0x00000002,
44+
PT_PEN = 0x00000003,
45+
PT_MOUSE = 0x00000004,
46+
PT_TOUCHPAD = 0x00000005
47+
} POINTER_INPUT_TYPE;
48+
49+
typedef enum {
50+
POINTER_CHANGE_NONE,
51+
POINTER_CHANGE_FIRSTBUTTON_DOWN,
52+
POINTER_CHANGE_FIRSTBUTTON_UP,
53+
POINTER_CHANGE_SECONDBUTTON_DOWN,
54+
POINTER_CHANGE_SECONDBUTTON_UP,
55+
POINTER_CHANGE_THIRDBUTTON_DOWN,
56+
POINTER_CHANGE_THIRDBUTTON_UP,
57+
POINTER_CHANGE_FOURTHBUTTON_DOWN,
58+
POINTER_CHANGE_FOURTHBUTTON_UP,
59+
POINTER_CHANGE_FIFTHBUTTON_DOWN,
60+
POINTER_CHANGE_FIFTHBUTTON_UP,
61+
} POINTER_BUTTON_CHANGE_TYPE;
62+
63+
typedef struct {
64+
POINTER_INPUT_TYPE pointerType;
65+
UINT32 pointerId;
66+
UINT32 frameId;
67+
POINTER_FLAGS pointerFlags;
68+
HANDLE sourceDevice;
69+
HWND hwndTarget;
70+
POINT ptPixelLocation;
71+
POINT ptHimetricLocation;
72+
POINT ptPixelLocationRaw;
73+
POINT ptHimetricLocationRaw;
74+
DWORD dwTime;
75+
UINT32 historyCount;
76+
INT32 InputData;
77+
DWORD dwKeyStates;
78+
UINT64 PerformanceCount;
79+
POINTER_BUTTON_CHANGE_TYPE ButtonChangeType;
80+
} POINTER_INFO;
81+
82+
typedef BOOL (WINAPI *GET_POINTER_INFO)(UINT32 pointerId, POINTER_INFO *pointerInfo);
83+
84+
GET_POINTER_INFO GetPointerInfo;
85+
86+
// </Windows 8 touch API>
87+
2688
typedef void(__stdcall * PointerBeganFuncPtr)(int id, POINTER_INPUT_TYPE type, unsigned int buttons, Vector2 position);
2789
typedef void(__stdcall * PointerMovedFuncPtr)(int id, POINTER_INPUT_TYPE type, unsigned int buttonsSet, unsigned int buttonsClear, Vector2 position);
2890
typedef void(__stdcall * PointerEndedFuncPtr)(int id, POINTER_INPUT_TYPE type, unsigned int buttons);

External/WindowsTouch/WindowsTouch.vcxproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
<Keyword>Win32Proj</Keyword>
2424
<RootNamespace>WindowsTouch</RootNamespace>
2525
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
26+
<ProjectName>WindowsTouch</ProjectName>
2627
</PropertyGroup>
2728
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
2829
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">

0 commit comments

Comments
 (0)