Bug 1614864 [wpt PR 21746] - [webnfc] Add WPT tests for smart poster, a=testonly
[gecko.git] / widget / windows / nsWinGesture.h
blob040b460da9d861b0353bb90c3dc4d7be04d7ccca
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef WinGesture_h__
7 #define WinGesture_h__
9 /*
10 * nsWinGesture - Touch input handling for tablet displays.
13 #include "nsdefs.h"
14 #include <winuser.h>
15 #include <tpcshrd.h>
16 #include "nsPoint.h"
17 #include "mozilla/EventForwards.h"
18 #include "mozilla/TouchEvents.h"
20 // WM_TABLET_QUERYSYSTEMGESTURESTATUS return values
21 #define TABLET_ROTATE_GESTURE_ENABLE 0x02000000
23 class nsPointWin : public nsIntPoint {
24 public:
25 nsPointWin& operator=(const POINTS& aPoint) {
26 x = aPoint.x;
27 y = aPoint.y;
28 return *this;
30 nsPointWin& operator=(const POINT& aPoint) {
31 x = aPoint.x;
32 y = aPoint.y;
33 return *this;
35 nsPointWin& operator=(int val) {
36 x = y = val;
37 return *this;
39 void ScreenToClient(HWND hWnd) {
40 POINT tmp;
41 tmp.x = x;
42 tmp.y = y;
43 ::ScreenToClient(hWnd, &tmp);
44 *this = tmp;
48 class nsWinGesture {
49 public:
50 nsWinGesture();
52 public:
53 bool SetWinGestureSupport(
54 HWND hWnd, mozilla::WidgetGestureNotifyEvent::PanDirection aDirection);
55 bool ShutdownWinGestureSupport();
57 // Simple gesture process
58 bool ProcessGestureMessage(HWND hWnd, WPARAM wParam, LPARAM lParam,
59 mozilla::WidgetSimpleGestureEvent& evt);
61 // Pan processing
62 bool IsPanEvent(LPARAM lParam);
63 bool ProcessPanMessage(HWND hWnd, WPARAM wParam, LPARAM lParam);
64 bool PanDeltaToPixelScroll(mozilla::WidgetWheelEvent& aWheelEvent);
65 void UpdatePanFeedbackX(HWND hWnd, int32_t scrollOverflow, bool& endFeedback);
66 void UpdatePanFeedbackY(HWND hWnd, int32_t scrollOverflow, bool& endFeedback);
67 void PanFeedbackFinalize(HWND hWnd, bool endFeedback);
69 private:
70 // Delay load info
71 bool InitLibrary();
73 // Pan and feedback state
74 nsPointWin mPanIntermediate;
75 nsPointWin mPanRefPoint;
76 nsPointWin mPixelScrollDelta;
77 bool mPanActive;
78 bool mFeedbackActive;
79 bool mXAxisFeedback;
80 bool mYAxisFeedback;
81 bool mPanInertiaActive;
82 nsPointWin mPixelScrollOverflow;
84 // Zoom state
85 double mZoomIntermediate;
87 // Rotate state
88 double mRotateIntermediate;
91 #endif /* WinGesture_h__ */