diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/app.cpp | 22 | ||||
-rw-r--r-- | src/app.hpp | 2 |
2 files changed, 18 insertions, 6 deletions
diff --git a/src/app.cpp b/src/app.cpp index f76ebbd..2bb74b4 100644 --- a/src/app.cpp +++ b/src/app.cpp @@ -386,9 +386,9 @@ char const *App::activate_surface(char const *drawing_name) { // Set all others invisible for (auto &i : this->controller->surfaces) { auto &si = this->controller->sprops[i.second->id]; - if (si.visibility != 0 && + if (si.id != s->id && si.visibility != 0 && int(si.id) != this->layers.main_surface) { - this->deactivate(i.second->id); + this->deactivate(si.id); } } this->activate(s->id); @@ -463,6 +463,14 @@ void App::emit_visible(char const *label, bool is_visible) { this->api.send_event(is_visible ? "visible" : "invisible", label); } +void App::emit_invisible(char const *label) { + return emit_visible(label, 0); +} + +void App::emit_visible(char const *label) { + return emit_visible(label, 1); +} + result<int> App::request_surface(char const *drawing_name) { auto lid = this->layers.get_layer_id(std::string(drawing_name)); if (!lid) { @@ -494,16 +502,18 @@ result<int> App::request_surface(char const *drawing_name) { void App::activate(unsigned id) { if (this->controller->sprops[id].visibility == 0) { this->controller->surfaces[id]->set_visibility(1); - this->emit_activated( - this->lookup_name(id).value_or("unknown-name").c_str()); + char const *label = this->lookup_name(id).value_or("unknown-name").c_str(); + this->emit_activated(label); + this->emit_visible(label); } } void App::deactivate(unsigned id) { if (this->controller->sprops[id].visibility != 0) { this->controller->surfaces[id]->set_visibility(0); - this->emit_deactivated( - this->lookup_name(id).value_or("unknown-name").c_str()); + char const *label = this->lookup_name(id).value_or("unknown-name").c_str(); + this->emit_deactivated(label); + this->emit_invisible(label); } } diff --git a/src/app.hpp b/src/app.hpp index fa26e39..d1fc912 100644 --- a/src/app.hpp +++ b/src/app.hpp @@ -154,6 +154,8 @@ struct App { void emit_syncdraw(char const *label); void emit_flushdraw(char const *label); void emit_visible(char const *label, bool is_visible); + void emit_invisible(char const *label); + void emit_visible(char const *label); void activate(unsigned id); void deactivate(unsigned id); |