X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;ds=inline;f=src%2Fwayland.cpp;h=672dab03844980c640e19c70be70c055ebcb86c3;hb=93c2a361b2144d82ec70208225c45afd8f355bd3;hp=3be264b5f598c711c4480bf2894f2607347c839a;hpb=daf3f38d2d89b0073bdbee2a531e00dc00e172c1;p=staging%2Fwindowmanager.git 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 &&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... - } -} - // // ___ ___ _ __ ___ ___ _ __ // / __|/ __| '__/ _ \/ _ \ '_ \