Allow flushing of queued input events.
This commit is contained in:
@@ -354,6 +354,16 @@ void InputFilter::GetInputEvents( vector<InputEvent> &array )
|
|||||||
array.swap( queue );
|
array.swap( queue );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void InputFilter::FlushInputEvents()
|
||||||
|
{
|
||||||
|
/* Calling clear() will delete each InputEvent while holding the lock.
|
||||||
|
* This way, the LockMutex will be deleted before array which will unlock
|
||||||
|
* the mutex before deleting each InputEvent. */
|
||||||
|
vector<InputEvent> array;
|
||||||
|
LockMut(*queuemutex);
|
||||||
|
array.swap( queue );
|
||||||
|
}
|
||||||
|
|
||||||
void InputFilter::GetPressedButtons( vector<DeviceInput> &array )
|
void InputFilter::GetPressedButtons( vector<DeviceInput> &array )
|
||||||
{
|
{
|
||||||
LockMut(*queuemutex);
|
LockMut(*queuemutex);
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ public:
|
|||||||
RString GetButtonComment( const DeviceInput &di ) const;
|
RString GetButtonComment( const DeviceInput &di ) const;
|
||||||
|
|
||||||
void GetInputEvents( vector<InputEvent> &aEventOut );
|
void GetInputEvents( vector<InputEvent> &aEventOut );
|
||||||
|
void FlushInputEvents();
|
||||||
void GetPressedButtons( vector<DeviceInput> &array );
|
void GetPressedButtons( vector<DeviceInput> &array );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
Reference in New Issue
Block a user