NDEVR
API Documentation
NDEVRMouseManager

Handles converting QEvents into NDEVR MouseEvents and queuing them up appropriately. More...

Inheritance diagram for NDEVRMouseManager:
[legend]
Collaboration diagram for NDEVRMouseManager:
[legend]

Public Member Functions

void addMouseEvent (MouseEvent &mouse_event)
 Adds a pre-constructed MouseEvent directly to the queue.
bool addMouseEvent (QEvent *event, Vector< 2, uint04 > size, WindowInstance *instance=nullptr)
 Converts a QEvent into a MouseEvent and adds it to the queue.
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.
void clearEvents (const WindowInstance *instance)
 Clears all queued events associated with the given window instance.
void clearTouchEvent (WindowInstance *instance)
 Clears the active touch event state for the given window instance.
void eraseOldestEvent ()
 Removes the oldest event from the queue.
const Buffer< MouseEvent > & mouseEvents () const
 Gets the current buffer of queued mouse events.
MouseEvent oldestEvent () const
 Gets the oldest queued mouse event without removing it.
void processMouseEvent ()
 Processes the next queued mouse event and dispatches it to the appropriate window.
void setUseMouseClicks (bool use_mouse_clicks)
 Sets whether mouse click events should be processed.
Public Member Functions inherited from Thread
 Thread ()
 Constructs a Thread with a default name.
 Thread (const StringView &name)
 Constructs a Thread with the specified name.
virtual ~Thread ()
 Destroys the Thread and cleans up resources.
void detach ()
 Detaches the thread, allowing it to run independently.
void forceStop ()
 Forces the running flag to false without waiting for the thread to finish.
bool isPrimaryThread () const
 Checks whether this thread is the primary thread.
bool isRunning () const
 Checks whether the thread is currently running.
void join ()
 Blocks the calling thread until this thread finishes execution.
virtual void requestStopThread ()
 Requests the thread to stop without blocking.
void setIsPrimaryThread (bool is_primary_thread)
 Sets whether this thread should be treated as the primary thread.
void setThreadName (const StringView &name)
 Sets the name of this thread.
virtual bool shouldExitThread () const
 Checks whether the thread has been requested to exit.
void start ()
 Starts the thread execution.
virtual void stopThread ()
 Stops the thread and waits for it to finish.
const StringthreadName () const
 Gets the name assigned to this thread.

Static Public Member Functions

static NDEVRMouseManager & defaultInstance ()
 Gets the singleton instance of the mouse manager.
Static Public Member Functions inherited from Thread
static ThreadCurrentThread ()
 Gets a reference to the Thread object for the calling thread.
static String CurrentThreadName ()
 Gets the name of the current thread.
static void ServiceVirtualThreads ()
 Services any virtual threads that require periodic execution.
static void SetCurrentThreadName (const StringView &name)
 Sets the name of the current thread.
static void StopAllThreads ()
 Stops all tracked threads.

Static Public Attributes

static ApplicationOption< bool > seperate_mouse_thread
 Application option controlling whether mouse processing runs on a separate thread.

Protected Attributes

bool m_is_init
 Whether the mouse manager has been initialized.
Buffer< MouseEventm_last_mouse_events
 The queue of pending mouse events.
Vector< 2, fltp04m_last_mouse_press_point
 The screen location of the last mouse press.
uint08 m_last_mouse_press_time
 The timestamp of the last mouse press event.
Buffer< Vector< 2, fltp04 > > m_last_touch_press_points
 The screen locations of active touch points.
fltp08 m_last_touch_scale_factor = Constant<fltp08>::Invalid
 The last computed pinch-zoom scale factor.
bool m_use_mouse_clicks
 Whether mouse click events are being processed.
Protected Attributes inherited from Thread
volatile bool m_is_running = false
 Whether the thread is currently running.
volatile bool m_is_single_run = true
 Whether the thread should execute only once before stopping.

Additional Inherited Members

Protected Member Functions inherited from Thread
virtual void run ()
 The main execution body of the thread.
const std::thread & self ()
 Gets a const reference to the underlying std::thread.

Detailed Description

Handles converting QEvents into NDEVR MouseEvents and queuing them up appropriately.


Definition at line 54 of file NDEVRMouseManager.h.

Member Function Documentation

◆ addMouseEvent() [1/2]

void NDEVRMouseManager::addMouseEvent ( MouseEvent & mouse_event)

Adds a pre-constructed MouseEvent directly to the queue.

Parameters
[in]mouse_eventThe mouse event to add.

◆ addMouseEvent() [2/2]

bool NDEVRMouseManager::addMouseEvent ( QEvent * event,
Vector< 2, uint04 > size,
WindowInstance * instance = nullptr )

Converts a QEvent into a MouseEvent and adds it to the queue.

Parameters
[in]eventThe Qt event to convert.
[in]sizeThe viewport size.
[in]instanceThe window instance receiving the event.
Returns
True if the event was consumed and added to the queue.

◆ addTouchEvent()

void NDEVRMouseManager::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.

Parameters
[in]locationThe touch point locations in screen coordinates.
[in]sizeThe viewport size.
[in]touch_pressedWhether the touch is currently pressed.
[in]instanceThe window instance receiving the touch event.

◆ clearEvents()

void NDEVRMouseManager::clearEvents ( const WindowInstance * instance)

Clears all queued events associated with the given window instance.

Parameters
[in]instanceThe window instance whose events should be cleared.

References Thread::run(), and Thread::stopThread().

◆ clearTouchEvent()

void NDEVRMouseManager::clearTouchEvent ( WindowInstance * instance)

Clears the active touch event state for the given window instance.

Parameters
[in]instanceThe window instance whose touch state should be cleared.

◆ defaultInstance()

NDEVRMouseManager & NDEVRMouseManager::defaultInstance ( )
static

Gets the singleton instance of the mouse manager.

Returns
A reference to the default NDEVRMouseManager instance.

◆ mouseEvents()

const Buffer< MouseEvent > & NDEVRMouseManager::mouseEvents ( ) const

Gets the current buffer of queued mouse events.

Returns
A const reference to the mouse event buffer.

◆ oldestEvent()

MouseEvent NDEVRMouseManager::oldestEvent ( ) const

Gets the oldest queued mouse event without removing it.

Returns
The oldest mouse event in the queue.

◆ setUseMouseClicks()

void NDEVRMouseManager::setUseMouseClicks ( bool use_mouse_clicks)

Sets whether mouse click events should be processed.

Parameters
[in]use_mouse_clicksWhether to use mouse clicks.

The documentation for this class was generated from the following file: