summaryrefslogtreecommitdiff
path: root/plugingui/eventhandler.cc
diff options
context:
space:
mode:
Diffstat (limited to 'plugingui/eventhandler.cc')
-rw-r--r--plugingui/eventhandler.cc21
1 files changed, 18 insertions, 3 deletions
diff --git a/plugingui/eventhandler.cc b/plugingui/eventhandler.cc
index a5249a6..9643d3f 100644
--- a/plugingui/eventhandler.cc
+++ b/plugingui/eventhandler.cc
@@ -40,23 +40,38 @@ EventHandler::EventHandler(NativeWindow& nativeWindow, Window& window)
bool EventHandler::hasEvent()
{
- return nativeWindow.hasEvent();
+ return !events.empty();
}
std::shared_ptr<Event> EventHandler::getNextEvent()
{
- return nativeWindow.getNextEvent();
+ if(events.empty())
+ {
+ return nullptr;
+ }
+
+ auto event = events.front();
+ events.pop();
+ return event;
}
std::shared_ptr<Event> EventHandler::peekNextEvent()
{
- return nativeWindow.peekNextEvent();
+ if(events.empty())
+ {
+ return nullptr;
+ }
+
+ auto event = events.front();
+ return event;
}
void EventHandler::processEvents()
{
Painter p(window); // Make sure we only redraw buffer one time.
+ events = nativeWindow.getEvents();
+
while(hasEvent())
{
auto event = getNextEvent();