summaryrefslogtreecommitdiff
path: root/plugingui/eventhandler.cc
diff options
context:
space:
mode:
Diffstat (limited to 'plugingui/eventhandler.cc')
-rw-r--r--plugingui/eventhandler.cc16
1 files changed, 8 insertions, 8 deletions
diff --git a/plugingui/eventhandler.cc b/plugingui/eventhandler.cc
index 2177433..a57e74b 100644
--- a/plugingui/eventhandler.cc
+++ b/plugingui/eventhandler.cc
@@ -35,7 +35,6 @@ namespace GUI
EventHandler::EventHandler(NativeWindow& nativeWindow, Window& window)
: window(window)
, nativeWindow(nativeWindow)
-// , last_click(0)
, lastWasDoubleClick(false)
{}
@@ -44,6 +43,12 @@ bool EventHandler::hasEvent()
return !events.empty();
}
+bool EventHandler::queryNextEventType(EventType type)
+{
+ return !events.empty() &&
+ (events.front()->type() == type);
+}
+
std::shared_ptr<Event> EventHandler::getNextEvent()
{
if(events.empty())
@@ -94,13 +99,9 @@ void EventHandler::processEvents()
case EventType::mouseMove:
{
- while(true)
+ // Skip all consecutive mouse move events and handle only the last one.
+ while(queryNextEventType(EventType::mouseMove))
{
- if(!hasEvent())
- {
- break;
- }
-
event = getNextEvent();
}
@@ -147,7 +148,6 @@ void EventHandler::processEvents()
case EventType::button:
{
auto buttonEvent = static_cast<ButtonEvent*>(event.get());
-
if(lastWasDoubleClick && (buttonEvent->direction == Direction::down))
{
lastWasDoubleClick = false;