+char const *App::activate_surface(uint32_t surface_id) {
+ if (! this->controller->surface_exists(surface_id)) {
+ return "Surface does not exist";
+ }
+
+ // This shouild involve a policy check, but as we do not (yet) have
+ // such a thing, we will just switch to this surface.
+ // XXX: input focus missing!!1
+
+ // Make it visible, no (or little effect) if already visible
+ auto &s = this->controller->surfaces[surface_id];
+ s->set_visibility(1);
+
+ // Set all others invisible
+ for (auto &i: this->controller->surfaces) {
+ auto &si = this->controller->sprops[i.second->id];
+ // XXX: filtering out homescreen ID ... set this in a known place!!1
+ if (si.visibility == 1 && si.id != s->id && int(si.id) != this->layers.main_surface) {
+ i.second->set_visibility(0);
+ }
+ }
+
+ // commit changes
+ this->controller->commit_changes();
+ this->display->flush();
+
+ // no error
+ return nullptr;
+}
+