1 /* This Source Code Form is subject to the terms of the Mozilla Public 2 * License, v. 2.0. If a copy of the MPL was not distributed with this 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 4 5 #ifndef touchinjection_sdk80_h 6 #define touchinjection_sdk80_h 7 8 // Note, this isn't inclusive of all touch injection header info. 9 // You may need to add more to expand on current apis. 10 11 #ifndef TOUCH_FEEDBACK_DEFAULT 12 13 # define TOUCH_FEEDBACK_DEFAULT 0x1 14 # define TOUCH_FEEDBACK_INDIRECT 0x2 15 # define TOUCH_FEEDBACK_NONE 0x3 16 17 enum { 18 PT_POINTER = 0x00000001, // Generic pointer 19 PT_TOUCH = 0x00000002, // Touch 20 PT_PEN = 0x00000003, // Pen 21 PT_MOUSE = 0x00000004, // Mouse 22 PT_TOUCHPAD = 0x00000005, // Touch pad 23 }; 24 25 typedef DWORD POINTER_INPUT_TYPE; 26 typedef UINT32 POINTER_FLAGS; 27 28 typedef enum { 29 POINTER_CHANGE_NONE, 30 POINTER_CHANGE_FIRSTBUTTON_DOWN, 31 POINTER_CHANGE_FIRSTBUTTON_UP, 32 POINTER_CHANGE_SECONDBUTTON_DOWN, 33 POINTER_CHANGE_SECONDBUTTON_UP, 34 POINTER_CHANGE_THIRDBUTTON_DOWN, 35 POINTER_CHANGE_THIRDBUTTON_UP, 36 POINTER_CHANGE_FOURTHBUTTON_DOWN, 37 POINTER_CHANGE_FOURTHBUTTON_UP, 38 POINTER_CHANGE_FIFTHBUTTON_DOWN, 39 POINTER_CHANGE_FIFTHBUTTON_UP, 40 } POINTER_BUTTON_CHANGE_TYPE; 41 42 typedef struct { 43 POINTER_INPUT_TYPE pointerType; 44 UINT32 pointerId; 45 UINT32 frameId; 46 POINTER_FLAGS pointerFlags; 47 HANDLE sourceDevice; 48 HWND hwndTarget; 49 POINT ptPixelLocation; 50 POINT ptHimetricLocation; 51 POINT ptPixelLocationRaw; 52 POINT ptHimetricLocationRaw; 53 DWORD dwTime; 54 UINT32 historyCount; 55 INT32 InputData; 56 DWORD dwKeyStates; 57 UINT64 PerformanceCount; 58 POINTER_BUTTON_CHANGE_TYPE ButtonChangeType; 59 } POINTER_INFO; 60 61 typedef UINT32 TOUCH_FLAGS; 62 typedef UINT32 TOUCH_MASK; 63 64 typedef struct { 65 POINTER_INFO pointerInfo; 66 TOUCH_FLAGS touchFlags; 67 TOUCH_MASK touchMask; 68 RECT rcContact; 69 RECT rcContactRaw; 70 UINT32 orientation; 71 UINT32 pressure; 72 } POINTER_TOUCH_INFO; 73 74 # define TOUCH_FLAG_NONE 0x00000000 // Default 75 76 # define TOUCH_MASK_NONE \ 77 0x00000000 // Default - none of the optional fields are valid 78 # define TOUCH_MASK_CONTACTAREA 0x00000001 // The rcContact field is valid 79 # define TOUCH_MASK_ORIENTATION 0x00000002 // The orientation field is valid 80 # define TOUCH_MASK_PRESSURE 0x00000004 // The pressure field is valid 81 82 # define POINTER_FLAG_NONE 0x00000000 // Default 83 # define POINTER_FLAG_NEW 0x00000001 // New pointer 84 # define POINTER_FLAG_INRANGE 0x00000002 // Pointer has not departed 85 # define POINTER_FLAG_INCONTACT 0x00000004 // Pointer is in contact 86 # define POINTER_FLAG_FIRSTBUTTON 0x00000010 // Primary action 87 # define POINTER_FLAG_SECONDBUTTON 0x00000020 // Secondary action 88 # define POINTER_FLAG_THIRDBUTTON 0x00000040 // Third button 89 # define POINTER_FLAG_FOURTHBUTTON 0x00000080 // Fourth button 90 # define POINTER_FLAG_FIFTHBUTTON 0x00000100 // Fifth button 91 # define POINTER_FLAG_PRIMARY 0x00002000 // Pointer is primary 92 # define POINTER_FLAG_CONFIDENCE \ 93 0x00004000 // Pointer is considered unlikely to be accidental 94 # define POINTER_FLAG_CANCELED \ 95 0x00008000 // Pointer is departing in an abnormal manner 96 # define POINTER_FLAG_DOWN \ 97 0x00010000 // Pointer transitioned to down state (made contact) 98 # define POINTER_FLAG_UPDATE 0x00020000 // Pointer update 99 # define POINTER_FLAG_UP \ 100 0x00040000 // Pointer transitioned from down state (broke contact) 101 # define POINTER_FLAG_WHEEL 0x00080000 // Vertical wheel 102 # define POINTER_FLAG_HWHEEL 0x00100000 // Horizontal wheel 103 # define POINTER_FLAG_CAPTURECHANGED 0x00200000 // Lost capture 104 105 #endif // TOUCH_FEEDBACK_DEFAULT 106 107 #define TOUCH_FLAGS_CONTACTUPDATE \ 108 (POINTER_FLAG_UPDATE | POINTER_FLAG_INRANGE | POINTER_FLAG_INCONTACT) 109 #define TOUCH_FLAGS_CONTACTDOWN \ 110 (POINTER_FLAG_DOWN | POINTER_FLAG_INRANGE | POINTER_FLAG_INCONTACT) 111 112 typedef BOOL(WINAPI* InitializeTouchInjectionPtr)(UINT32 maxCount, 113 DWORD dwMode); 114 typedef BOOL(WINAPI* InjectTouchInputPtr)(UINT32 count, 115 CONST POINTER_TOUCH_INFO* info); 116 117 #endif // touchinjection_sdk80_h