From: Marcus Fritzsch Date: Tue, 5 Sep 2017 09:52:37 +0000 (+0200) Subject: App: remove last_active logic X-Git-Tag: 4.99.1~136 X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?p=staging%2Fwindowmanager.git;a=commitdiff_plain;h=6660e3c8783bb9481e862b93500cf4a3dac8fcc4 App: remove last_active logic Signed-off-by: Marcus Fritzsch --- diff --git a/src/app.cpp b/src/app.cpp index 527fe01..3e28a5f 100644 --- a/src/app.cpp +++ b/src/app.cpp @@ -128,8 +128,7 @@ App::App(wl::display *d) config(), layouts(), layers(), - id_alloc{}, - last_active() { + id_alloc{} { assert(g_app == nullptr); g_app = this; @@ -401,11 +400,6 @@ char const *App::activate_surface(char const *drawing_name) { this->controller->commit_changes(); this->display->flush(); - // Current active surface is the first in last_active - this->last_active.push_front(s->id); - /// // XXX: I am not sure I even need 5 elements... - /// this->last_active.resize(std::min(int(this->last_active.size()), 5)); - this->emit_activated(drawing_name); // no error @@ -428,33 +422,10 @@ char const *App::deactivate_surface(char const *drawing_name) { return "Cannot deactivate main_surface"; } - if (this->last_active.empty()) { - return "Cannot deactivate surface (not active)"; - } - - // XXX: should an active surface not alsways be front() or - // front+1() of last_active?! - // XXX: Should I really be able to deactivate a surface that is not - // front() of last_active? - auto is = std::find(this->last_active.begin(), - this->last_active.end(), - surface_id); - - if (is == this->last_active.end()) { - return "Cannot deactivate surface (not active)"; - } this->emit_deactivated(drawing_name); - this->last_active.erase(is); - - if (! this->last_active.empty()) { - // Should be active already, shouldn't it? - this->activate_surface(this->lookup_name(this->last_active.front()).value_or("unknown-name").c_str()); - } else { - this->activate_surface(this->layers.main_surface_name.c_str()); - } return nullptr; } @@ -479,13 +450,6 @@ void App::surface_removed(uint32_t surface_id) { logdebug("surface_id is %u", surface_id); this->id_alloc.remove_id(surface_id); - - // Also remove from last_active, if found - auto i = std::find(this->last_active.begin(), - this->last_active.end(), surface_id); - if (i != this->last_active.end()) { - this->last_active.erase(i); - } } void App::emit_activated(char const *label) { diff --git a/src/app.hpp b/src/app.hpp index 79498c2..3e3a56e 100644 --- a/src/app.hpp +++ b/src/app.hpp @@ -122,8 +122,6 @@ struct App { return this->id_alloc.lookup(id); } - std::deque last_active; - explicit App(wl::display *d); ~App();