diff options
Diffstat (limited to 'src/app.cpp')
-rw-r--r-- | src/app.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/app.cpp b/src/app.cpp index e42d05f..7b2b69c 100644 --- a/src/app.cpp +++ b/src/app.cpp @@ -147,9 +147,8 @@ int App::init() { } int App::dispatch_events() { - if (this->pending_events.load(std::memory_order_consume)) { - this->pending_events.store(false, std::memory_order_release); - return this->display->dispatch_pending(); + if (this->dispatch_events() == 0) { + return 0; } int ret = this->display->dispatch(); @@ -166,6 +165,15 @@ int App::dispatch_events() { return 0; } +int App::dispatch_pending_events() { + if (this->pending_events.load(std::memory_order_consume)) { + this->pending_events.store(false, std::memory_order_release); + this->display->dispatch_pending(); + return 0; + } + return -1; +} + // _ _ _ _ _ ____ // (_)_ __ (_) |_ | | __ _ _ _ ___ _ _| |_ / /\ \ // | | '_ \| | __| | |/ _` | | | |/ _ \| | | | __| | | | |