diff options
author | Samuel Mannehed <samuel@cendio.se> | 2020-03-28 21:30:56 +0100 |
---|---|---|
committer | Niko Lehto <nikle@cendio.se> | 2020-05-29 15:28:31 +0200 |
commit | 642207f126cb1c5d647afcca98dc82095a463c34 (patch) | |
tree | faca14f568e24f7e0d41119b80e2a29e42ed0157 /vncviewer/Win32TouchHandler.h | |
parent | 95ad018961f384f6e43c80c4f5473064a6f3aedd (diff) | |
download | tigervnc-642207f126cb1c5d647afcca98dc82095a463c34.tar.gz tigervnc-642207f126cb1c5d647afcca98dc82095a463c34.zip |
Support touch gestures on Windows
This adds the same touch gesture support for Windows as already added
for Unix. Note that it uses Windows gesture detection instead of our own
here though to give the user a familiar experience. Unfortunately that
means we lose the three finger tap.
This also raises the base requirements to Windows 7 as that's when
Windows got proper touch support.
Diffstat (limited to 'vncviewer/Win32TouchHandler.h')
-rw-r--r-- | vncviewer/Win32TouchHandler.h | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/vncviewer/Win32TouchHandler.h b/vncviewer/Win32TouchHandler.h new file mode 100644 index 00000000..05039c88 --- /dev/null +++ b/vncviewer/Win32TouchHandler.h @@ -0,0 +1,60 @@ +/* Copyright 2020 Samuel Mannehed for Cendio AB + * + * This is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this software; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, + * USA. + */ + +#ifndef __WIN32TOUCHHANDLER_H__ +#define __WIN32TOUCHHANDLER_H__ + +#include <windows.h> + +#include "BaseTouchHandler.h" +#include "GestureEvent.h" + +class Win32TouchHandler: public BaseTouchHandler { + public: + Win32TouchHandler(HWND hWnd); + + bool processEvent(UINT Msg, WPARAM wParam, LPARAM lParam); + + private: + void handleWin32GestureEvent(GESTUREINFO gi); + bool isSinglePan(GESTUREINFO gi); + + protected: + virtual void fakeMotionEvent(const GestureEvent origEvent); + virtual void fakeButtonEvent(bool press, int button, + const GestureEvent origEvent); + virtual void fakeKeyEvent(bool press, int keycode, + const GestureEvent origEvent); + private: + void pushFakeEvent(UINT Msg, WPARAM wParam, LPARAM lParam); + + private: + HWND hWnd; + + bool gesturesConfigured; + bool startedSinglePan; + POINT gestureStart; + + bool gestureActive; + bool ignoringGesture; + + int fakeButtonMask; + POINT lastFakeMotionPos; +}; + +#endif // __WIN32TOUCHHANDLER_H__ |