summaryrefslogtreecommitdiffstats
path: root/src/wayland.hpp
diff options
context:
space:
mode:
authorMarcus Fritzsch <marcus_fritzsch@mentor.com>2017-06-22 16:23:17 +0200
committerMarcus Fritzsch <marcus_fritzsch@mentor.com>2017-08-08 17:24:00 +0200
commitac1c1b8bbd509637514e6709c904a4a62d2ea595 (patch)
tree36f4560f41756c87b65d7215362d0f92d336e365 /src/wayland.hpp
parent47b4446227ac06b2873118717a4c868325b64162 (diff)
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 <marcus_fritzsch@mentor.com>
Diffstat (limited to 'src/wayland.hpp')
-rw-r--r--src/wayland.hpp15
1 files changed, 15 insertions, 0 deletions
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<struct ivi_controller> {
std::map<uint32_t, std::unique_ptr<struct layer>> layers;
std::map<uint32_t, std::unique_ptr<struct screen>> screens;
+ std::vector<std::function<void(struct controller *)>> pending;
+
+ void add_task(std::function<void(struct controller *)> &&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;