-char const *App::activate_surface(char const *drawing_name) {
- auto osid = this->id_alloc.lookup(drawing_name);
-
- if (osid) {
- logdebug("ativate surface with name %s and id %u", drawing_name,
- osid.value());
- auto ret = this->activate_surface(osid.value());
- if (!ret) {
- this->emit_activated(drawing_name);
- }
- return ret;
- }
-
- logerror("surface %s unknown", drawing_name);
- return "Surface unknown";
-}
-
-char const *App::deactivate_surface(char const *drawing_name) {
- auto osid = this->id_alloc.lookup(drawing_name);
-
- if (osid) {
- logdebug("deativate surface with name %s and id %u", drawing_name,
- osid.value());
- return this->deactivate_surface(osid.value());
- }
-
- logerror("surface %s unknown", drawing_name);
- return "Surface unknown";
-}
-
-// _ _ _ _ _ _ _
-// | |__ (_)_ __ __| (_)_ __ __ _ __ _ _ __ (_) (_)_ __ ___ _ __ | |
-// | '_ \| | '_ \ / _` | | '_ \ / _` | / _` | '_ \| | | | '_ ` _ \| '_ \| |
-// | |_) | | | | | (_| | | | | | (_| | | (_| | |_) | | | | | | | | | |_) | |
-// |_.__/|_|_| |_|\__,_|_|_| |_|\__, |___\__,_| .__/|_| |_|_| |_| |_| .__/|_|
-// |___/_____| |_| |_|
-binding_api::result_type binding_api::request_surface(
- char const *drawing_name) {
- auto r = this->app->request_surface(drawing_name);
- if (r.is_err()) {
- return Err<json_object *>(r.unwrap_err());
- }
- return Ok(json_object_new_int(r.unwrap()));
-}
-
-binding_api::result_type binding_api::activate_surface(
- char const *drawing_name) {
- logdebug("%s drawing_name %s", __func__, drawing_name);
- auto r = this->app->activate_surface(drawing_name);
- if (r != nullptr) {
- return Err<json_object *>(r);
+void App::activate(int id) {
+ if (this->controller->sprops[id].visibility == 0) {
+ this->controller->surfaces[id]->set_visibility(1);
+ char const *label =
+ this->lookup_name(id).value_or("unknown-name").c_str();
+ this->emit_activated(label);
+ this->emit_visible(label);