1 /* Copyright 2020 Samuel Mannehed for Cendio AB 2 * 3 * This is free software; you can redistribute it and/or modify 4 * it under the terms of the GNU General Public License as published by 5 * the Free Software Foundation; either version 2 of the License, or 6 * (at your option) any later version. 7 * 8 * This software is distributed in the hope that it will be useful, 9 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 * GNU General Public License for more details. 12 * 13 * You should have received a copy of the GNU General Public License 14 * along with this software; if not, write to the Free Software 15 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 16 * USA. 17 */ 18 19 #ifndef __WIN32TOUCHHANDLER_H__ 20 #define __WIN32TOUCHHANDLER_H__ 21 22 #include <windows.h> 23 24 #include "BaseTouchHandler.h" 25 #include "GestureEvent.h" 26 27 class Win32TouchHandler: public BaseTouchHandler { 28 public: 29 Win32TouchHandler(HWND hWnd); 30 31 bool processEvent(UINT Msg, WPARAM wParam, LPARAM lParam); 32 33 private: 34 void handleWin32GestureEvent(GESTUREINFO gi); 35 bool isSinglePan(GESTUREINFO gi); 36 37 protected: 38 virtual void fakeMotionEvent(const GestureEvent origEvent); 39 virtual void fakeButtonEvent(bool press, int button, 40 const GestureEvent origEvent); 41 virtual void fakeKeyEvent(bool press, int keycode, 42 const GestureEvent origEvent); 43 private: 44 void pushFakeEvent(UINT Msg, WPARAM wParam, LPARAM lParam); 45 46 private: 47 HWND hWnd; 48 49 bool gesturesConfigured; 50 bool startedSinglePan; 51 POINT gestureStart; 52 53 bool gestureActive; 54 bool ignoringGesture; 55 56 int fakeButtonMask; 57 POINT lastFakeMotionPos; 58 }; 59 60 #endif // __WIN32TOUCHHANDLER_H__ 61