From ac1c1b8bbd509637514e6709c904a4a62d2ea595 Mon Sep 17 00:00:00 2001 From: Marcus Fritzsch Date: Thu, 22 Jun 2017 16:23:17 +0200 Subject: wayland: added a pending tasks list to controller With this item it is possible to append tasks to the controller, which will be executed after the current events have been dispatched. Note, that tasks need to check their needed resources are still alive! Signed-off-by: Marcus Fritzsch --- src/wayland.hpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/wayland.hpp') diff --git a/src/wayland.hpp b/src/wayland.hpp index 3914e38..c3d4c2f 100644 --- a/src/wayland.hpp +++ b/src/wayland.hpp @@ -276,6 +276,21 @@ struct controller : public wayland_proxy { std::map> layers; std::map> screens; + std::vector> pending; + + void add_task(std::function &&f) { + this->pending.emplace_back(f); + } + void execute_pending() { + if (!this->pending.empty()) { + for (auto &t : this->pending) { + t(this); + } + this->pending.clear(); + ivi_controller_commit_changes(this->proxy); + } + } + controller(struct wl_registry *r, uint32_t name, uint32_t version); ~controller() override; -- cgit 1.2.3-korg