MeshLib Documentation
Loading...
Searching...
No Matches
MRTouchpadWin32Handler.h
Go to the documentation of this file.
1#pragma once
2#ifdef _WIN32
3
5
6#pragma warning( push )
7#pragma warning( disable: 4265 )
8#pragma warning( disable: 4986 )
9#pragma warning( disable: 5204 )
10#pragma warning( disable: 5220 )
11#include <directmanipulation.h>
12#include <wrl.h>
13#pragma warning( pop )
14
15#include <map>
16
17namespace MR
18{
19
20// Touchpad event handler for Windows using Direct Manipulation API
21// More info: https://learn.microsoft.com/en-us/windows/win32/directmanipulation/direct-manipulation-portal
22class TouchpadWin32Handler : public TouchpadController::Handler
23{
24public:
25 TouchpadWin32Handler( GLFWwindow* window );
26 ~TouchpadWin32Handler() override;
27
28 static LRESULT WINAPI WindowSubclassProc( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam );
29 static void CALLBACK TouchpadEventPoll( PVOID lpParam, BOOLEAN timerOrWaitFired );
30
31private:
32 HWND window_;
33
34 LONG_PTR glfwProc_{ NULL };
35 void processPointerHitTestEvent_( WPARAM wParam );
36
37 Microsoft::WRL::ComPtr<IDirectManipulationManager> manager_;
38 Microsoft::WRL::ComPtr<IDirectManipulationUpdateManager> updateManager_;
39 Microsoft::WRL::ComPtr<IDirectManipulationViewport> viewport_;
40
41 class DirectManipulationViewportEventHandler;
42 Microsoft::WRL::ComPtr<DirectManipulationViewportEventHandler> eventHandler_;
43 DWORD eventHandlerCookie_;
44
45 friend class DirectManipulationViewportEventHandler;
46 HANDLE timerQueue_{ NULL };
47 HANDLE timer_{ NULL };
48 void startTouchpadEventPolling_();
49 void stopTouchpadEventPolling_();
50
51 static std::map<HWND, MR::TouchpadWin32Handler*>& registry_();
52 static MR::TouchpadWin32Handler* findHandler_( HWND view );
53};
54
55} // namespace MR
56
57#endif
Definition MRCameraOrientationPlugin.h:8