X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fapplist.cpp;h=888ab7164cc6a6988531a3285520d74548a39d6a;hb=419360d5e88e4036bc9f4fd6a5068052cf8b8703;hp=93c90ac9e6ed15b7b6cd79a2a865d384499d8258;hpb=c4798401800dd1f325aca5333e1d3eebdda0abe3;p=apps%2Fagl-service-windowmanager.git diff --git a/src/applist.cpp b/src/applist.cpp index 93c90ac..888ab71 100644 --- a/src/applist.cpp +++ b/src/applist.cpp @@ -73,10 +73,10 @@ void AppList::addClient(const string &appid, unsigned layer, unsigned surface, c this->clientDump(); } -void AppList::addClient(const string &appid, unsigned layer, const string& layer_name, unsigned surface, const string &role) +void AppList::addClient(const string &appid, unsigned layer, const string &role) { std::lock_guard lock(this->mtx); - shared_ptr client = std::make_shared(appid, layer, layer_name, surface, role); + shared_ptr client = std::make_shared(appid, layer, role); this->app2client[appid] = client; this->clientDump(); } @@ -140,7 +140,14 @@ void AppList::removeSurface(unsigned surface){ */ shared_ptr AppList::lookUpClient(const string &appid) { - return this->app2client.at(appid); + if(this->app2client.count(appid) != 0) + { + return this->app2client.at(appid); + } + else + { + return nullptr; + } } /** @@ -167,7 +174,7 @@ int AppList::countClient() const * @return AppID * @attention If AppID is not found, param found will be false. */ -string AppList::getAppID(unsigned surface, const string& role, bool* found) const +/* string AppList::getAppID(unsigned surface, const string& role, bool* found) const { *found = false; for (const auto &x : this->app2client) @@ -178,6 +185,19 @@ string AppList::getAppID(unsigned surface, const string& role, bool* found) cons } } return string(""); +} */ + +string AppList::getAppID(unsigned surface, bool* found) const +{ + *found = false; + for (const auto &x : this->app2client) + { + if(x.second->surfaceID() == surface){ + *found = true; + return x.second->appID(); + } + } + return string(""); } WMError AppList::popFloatingSurface(unsigned pid, unsigned *surface)