X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fapplist.cpp;h=17b47e3e580f71578b45b5c6efe2722f937305f7;hb=010ca3f3459a52e44deb5e70e94e9cd394814e3e;hp=79df62c3b3597de2c87d1566348be5818a311c65;hpb=c2110a3ec8fa74f2fc37e4909db547aa4a36c851;p=apps%2Fagl-service-windowmanager.git diff --git a/src/applist.cpp b/src/applist.cpp index 79df62c..17b47e3 100644 --- a/src/applist.cpp +++ b/src/applist.cpp @@ -73,6 +73,14 @@ void AppList::addClient(const string &appid, unsigned layer, unsigned surface, c this->clientDump(); } +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, role); + this->app2client[appid] = client; + this->clientDump(); +} + /** * Remove WMClient from the list * @@ -132,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; + } } /** @@ -154,17 +169,16 @@ int AppList::countClient() const * Returns AppID if found. * * @param unsigned[in] surfaceID - * @param string[in] role * @param bool[in,out] AppID is found or not * @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, bool* found) const { *found = false; for (const auto &x : this->app2client) { - if(x.second->surfaceID(role) == surface){ + if(x.second->surfaceID() == surface){ *found = true; return x.second->appID(); }