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);
});
}
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);
});
}
}
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...
- }
-}
-
//
// ___ ___ _ __ ___ ___ _ __
// / __|/ __| '__/ _ \/ _ \ '_ \