diff options
author | Marcus Fritzsch <marcus_fritzsch@mentor.com> | 2017-08-02 16:16:15 +0200 |
---|---|---|
committer | Marcus Fritzsch <marcus_fritzsch@mentor.com> | 2017-08-08 17:24:00 +0200 |
commit | 93c2a361b2144d82ec70208225c45afd8f355bd3 (patch) | |
tree | 43801ffca32edaec732b391f4bbf5633de09f6cf /src/wayland.cpp | |
parent | 9b094f7e17736529e8fd1d25515112f9a1a2daac (diff) |
app/wayland: move late-tasks to App
* Move late-tasks to App.
* Add add_task() to controller_hooks.
* Do not roundtrip at the end of App::execute_pending(), flush() is
enough.
* Tasks are now void() functions, need to capture what is needed.
Signed-off-by: Marcus Fritzsch <marcus_fritzsch@mentor.com>
Diffstat (limited to 'src/wayland.cpp')
-rw-r--r-- | src/wayland.cpp | 29 |
1 files changed, 6 insertions, 23 deletions
diff --git a/src/wayland.cpp b/src/wayland.cpp index 3be264b..672dab0 100644 --- a/src/wayland.cpp +++ b/src/wayland.cpp @@ -426,9 +426,9 @@ void controller::layer_screen(struct layer * /*l*/, struct wl_output *screen) { void controller::layer_destroyed(struct layer *l) { logdebug("genivi::layer %s @ %p", __func__, this->proxy.get()); - add_task("remove layer", [l](struct controller *c) { - c->lprops.erase(l->id); - c->layers.erase(l->id); + this->chooks->add_task("remove layer", [l, this] { + this->lprops.erase(l->id); + this->layers.erase(l->id); }); } @@ -662,9 +662,9 @@ void controller::surface_content(struct surface *s, int32_t content_state) { if (content_state == IVI_CONTROLLER_SURFACE_CONTENT_STATE_CONTENT_REMOVED) { // XXX is this the right thing to do? this->chooks->surface_removed(s->id); - add_task("remove surface", [s](struct controller *c) { - c->sprops.erase(s->id); - c->surfaces.erase(s->id); + this->chooks->add_task("remove surface", [this, s] { + this->sprops.erase(s->id); + this->surfaces.erase(s->id); }); } } @@ -703,23 +703,6 @@ void controller::remove_proxy_to_id_mapping(struct wl_output *p) { this->screen_proxy_to_id.erase(uintptr_t(p)); } -void controller::add_task(char const *name, - std::function<void(struct controller *)> &&f) { - this->pending.emplace_back(std::make_pair(name, f)); -} - -void controller::execute_pending() { - if (!this->pending.empty()) { - for (auto &t : this->pending) { - logdebug("executing task '%s'", t.first); - t.second(this); - } - this->pending.clear(); - ivi_controller_commit_changes(this->proxy.get()); - // XXX: No flush here... - } -} - // // ___ ___ _ __ ___ ___ _ __ // / __|/ __| '__/ _ \/ _ \ '_ \ |