34#include <NDEVR/WidgetOptions.h>
35#include <NDEVR/WindowInstance.h>
36#include <NDEVR/Thread.h>
37#include <NDEVR/TimeSpan.h>
39#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
41#define points touchPoints
43#if NDEVR_SUPPORTS_THREADING
44#define RUN_MOUSE_MANAGER_THREADED 0
46#define RUN_MOUSE_MANAGER_THREADED 0
54 class NDEVR_API NDEVRMouseManager
55#if NDEVR_SUPPORTS_THREADING
89#if RUN_MOUSE_MANAGER_THREADED
91 virtual void run()
override;
128#if RUN_MOUSE_MANAGER_THREADED
129 mutable std::mutex m_critical_section;
The default object to store data of any type that should persist through sessions of the application.
The equivelent of std::vector but with a bit more control.
Describes a mouse or touch input event with position, button, and modifier information.
void setUseMouseClicks(bool use_mouse_clicks)
Sets whether mouse click events should be processed.
void processMouseEvent()
Processes the next queued mouse event and dispatches it to the appropriate window.
const Buffer< MouseEvent > & mouseEvents() const
Gets the current buffer of queued mouse events.
Buffer< Vector< 2, fltp04 > > m_last_touch_press_points
The screen locations of active touch points.
bool m_use_mouse_clicks
Whether mouse click events are being processed.
bool m_is_init
Whether the mouse manager has been initialized.
static NDEVRMouseManager & defaultInstance()
Gets the singleton instance of the mouse manager.
void addTouchEvent(Buffer< Vector< 2, fltp04 > > location, Vector< 2, uint04 > size, bool touch_pressed, WindowInstance *instance=nullptr)
Adds a touch event to the queue from raw touch data.
Vector< 2, fltp04 > m_last_mouse_press_point
The screen location of the last mouse press.
fltp08 m_last_touch_scale_factor
The last computed pinch-zoom scale factor.
uint08 m_last_mouse_press_time
The timestamp of the last mouse press event.
Buffer< MouseEvent > m_last_mouse_events
The queue of pending mouse events.
static ApplicationOption< bool > seperate_mouse_thread
Application option controlling whether mouse processing runs on a separate thread.
void clearTouchEvent(WindowInstance *instance)
Clears the active touch event state for the given window instance.
void eraseOldestEvent()
Removes the oldest event from the queue.
MouseEvent oldestEvent() const
Gets the oldest queued mouse event without removing it.
bool addMouseEvent(QEvent *event, Vector< 2, uint04 > size, WindowInstance *instance=nullptr)
Converts a QEvent into a MouseEvent and adds it to the queue.
void addMouseEvent(MouseEvent &mouse_event)
Adds a pre-constructed MouseEvent directly to the queue.
void clearEvents(const WindowInstance *instance)
Clears all queued events associated with the given window instance.
virtual void stopThread()
Stops the thread and waits for it to finish.
Thread()
Constructs a Thread with a default name.
virtual void run()
The main execution body of the thread.
A fixed-size array with N dimensions used as the basis for geometric and mathematical types.
Contains core information about a Viewport.
The primary namespace for the NDEVR SDK.
uint64_t uint08
-Defines an alias representing an 8 byte, unsigned integer
double fltp08
Defines an alias representing an 8 byte floating-point number.