// Classic Shell (c) 2009-2017, Ivo Beltchev // Open-Shell (c) 2017-2018, The Open-Shell Team // Confidential information of Ivo Beltchev. Not for disclosure or distribution without prior written consent from the author #pragma once // define some Windows 8 touch features here so we don't need the Win8 SDK #ifndef WM_NCPOINTERUPDATE #define WM_NCPOINTERUPDATE 0x0241 #define WM_NCPOINTERDOWN 0x0242 #define WM_NCPOINTERUP 0x0243 #define WM_POINTERUPDATE 0x0245 #define WM_POINTERDOWN 0x0246 #define WM_POINTERUP 0x0247 #define WM_POINTERENTER 0x0249 #define WM_POINTERLEAVE 0x024A #define WM_POINTERACTIVATE 0x024B #define WM_POINTERCAPTURECHANGED 0x024C #define WM_TOUCHHITTESTING 0x024D #define WM_POINTERWHEEL 0x024E #define WM_POINTERHWHEEL 0x024F /* * Flags that appear in pointer input message parameters */ #define POINTER_MESSAGE_FLAG_NEW 0x00000001 // New pointer #define POINTER_MESSAGE_FLAG_INRANGE 0x00000002 // Pointer has not departed #define POINTER_MESSAGE_FLAG_INCONTACT 0x00000004 // Pointer is in contact #define POINTER_MESSAGE_FLAG_FIRSTBUTTON 0x00000010 // Primary action #define POINTER_MESSAGE_FLAG_SECONDBUTTON 0x00000020 // Secondary action #define POINTER_MESSAGE_FLAG_THIRDBUTTON 0x00000040 // Third button #define POINTER_MESSAGE_FLAG_FOURTHBUTTON 0x00000080 // Fourth button #define POINTER_MESSAGE_FLAG_FIFTHBUTTON 0x00000100 // Fifth button #define POINTER_MESSAGE_FLAG_PRIMARY 0x00002000 // Pointer is primary #define POINTER_MESSAGE_FLAG_CONFIDENCE 0x00004000 // Pointer is considered unlikely to be accidental #define POINTER_MESSAGE_FLAG_CANCELED 0x00008000 // Pointer is departing in an abnormal manner /* * Macros to retrieve information from pointer input message parameters */ #define GET_POINTERID_WPARAM(wParam) (LOWORD(wParam)) #define IS_POINTER_FLAG_SET_WPARAM(wParam, flag) (((DWORD)HIWORD(wParam) & (flag)) == (flag)) #define IS_POINTER_NEW_WPARAM(wParam) IS_POINTER_FLAG_SET_WPARAM(wParam, POINTER_MESSAGE_FLAG_NEW) #define IS_POINTER_INRANGE_WPARAM(wParam) IS_POINTER_FLAG_SET_WPARAM(wParam, POINTER_MESSAGE_FLAG_INRANGE) #define IS_POINTER_INCONTACT_WPARAM(wParam) IS_POINTER_FLAG_SET_WPARAM(wParam, POINTER_MESSAGE_FLAG_INCONTACT) #define IS_POINTER_FIRSTBUTTON_WPARAM(wParam) IS_POINTER_FLAG_SET_WPARAM(wParam, POINTER_MESSAGE_FLAG_FIRSTBUTTON) #define IS_POINTER_SECONDBUTTON_WPARAM(wParam) IS_POINTER_FLAG_SET_WPARAM(wParam, POINTER_MESSAGE_FLAG_SECONDBUTTON) #define IS_POINTER_THIRDBUTTON_WPARAM(wParam) IS_POINTER_FLAG_SET_WPARAM(wParam, POINTER_MESSAGE_FLAG_THIRDBUTTON) #define IS_POINTER_FOURTHBUTTON_WPARAM(wParam) IS_POINTER_FLAG_SET_WPARAM(wParam, POINTER_MESSAGE_FLAG_FOURTHBUTTON) #define IS_POINTER_FIFTHBUTTON_WPARAM(wParam) IS_POINTER_FLAG_SET_WPARAM(wParam, POINTER_MESSAGE_FLAG_FIFTHBUTTON) #define IS_POINTER_PRIMARY_WPARAM(wParam) IS_POINTER_FLAG_SET_WPARAM(wParam, POINTER_MESSAGE_FLAG_PRIMARY) #define HAS_POINTER_CONFIDENCE_WPARAM(wParam) IS_POINTER_FLAG_SET_WPARAM(wParam, POINTER_MESSAGE_FLAG_CONFIDENCE) #define IS_POINTER_CANCELED_WPARAM(wParam) IS_POINTER_FLAG_SET_WPARAM(wParam, POINTER_MESSAGE_FLAG_CANCELED) enum tagPOINTER_INPUT_TYPE { PT_POINTER = 0x00000001, // Generic pointer PT_TOUCH = 0x00000002, // Touch PT_PEN = 0x00000003, // Pen PT_MOUSE = 0x00000004, // Mouse }; typedef enum tagPOINTER_BUTTON_CHANGE_TYPE { POINTER_CHANGE_NONE, POINTER_CHANGE_FIRSTBUTTON_DOWN, POINTER_CHANGE_FIRSTBUTTON_UP, POINTER_CHANGE_SECONDBUTTON_DOWN, POINTER_CHANGE_SECONDBUTTON_UP, POINTER_CHANGE_THIRDBUTTON_DOWN, POINTER_CHANGE_THIRDBUTTON_UP, POINTER_CHANGE_FOURTHBUTTON_DOWN, POINTER_CHANGE_FOURTHBUTTON_UP, POINTER_CHANGE_FIFTHBUTTON_DOWN, POINTER_CHANGE_FIFTHBUTTON_UP, } POINTER_BUTTON_CHANGE_TYPE; typedef DWORD POINTER_INPUT_TYPE; typedef UINT32 POINTER_FLAGS; typedef struct tagPOINTER_INFO { POINTER_INPUT_TYPE pointerType; UINT32 pointerId; UINT32 frameId; POINTER_FLAGS pointerFlags; HANDLE sourceDevice; HWND hwndTarget; POINT ptPixelLocation; POINT ptHimetricLocation; POINT ptPixelLocationRaw; POINT ptHimetricLocationRaw; DWORD dwTime; UINT32 historyCount; INT32 InputData; DWORD dwKeyStates; UINT64 PerformanceCount; POINTER_BUTTON_CHANGE_TYPE ButtonChangeType; } POINTER_INFO; typedef enum tagINPUT_MESSAGE_DEVICE_TYPE { IMDT_UNAVAILABLE = 0x00000000, // not specified IMDT_KEYBOARD = 0x00000001, // from keyboard IMDT_MOUSE = 0x00000002, // from mouse IMDT_TOUCH = 0x00000004, // from touch IMDT_PEN = 0x00000008, // from pen } INPUT_MESSAGE_DEVICE_TYPE; typedef enum tagINPUT_MESSAGE_ORIGIN_ID { IMO_UNAVAILABLE = 0x00000000, // not specified IMO_HARDWARE = 0x00000001, // from a hardware device or injected by a UIAccess app IMO_INJECTED = 0x00000002, // injected via SendInput() by a non-UIAccess app IMO_SYSTEM = 0x00000004, // injected by the system } INPUT_MESSAGE_ORIGIN_ID; /* * Input source structure. */ typedef struct tagINPUT_MESSAGE_SOURCE { INPUT_MESSAGE_DEVICE_TYPE deviceType; INPUT_MESSAGE_ORIGIN_ID originId; } INPUT_MESSAGE_SOURCE; #endif void InitTouchHelper( void ); BOOL GetPointerType2( UINT32 pointerId, POINTER_INPUT_TYPE *pointerType ); BOOL GetPointerCursorId2( UINT32 pointerId, UINT32 *cursorId ); BOOL GetPointerInfo2( UINT32 pointerId, POINTER_INFO *pointerInfo ); BOOL GetCurrentInputMessageSource2( INPUT_MESSAGE_SOURCE *inputMessageSource ); BOOL GetCIMSSM2( INPUT_MESSAGE_SOURCE *inputMessageSource );