X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fapplist.cpp;h=888ab7164cc6a6988531a3285520d74548a39d6a;hb=788789a6f310d5e907b4d74284ab3c9e91ae2b3f;hp=391a3ce976b84048e348ab61e889780583ad73a2;hpb=c3291c967516a188789a860821471d8c872fbb47;p=apps%2Fagl-service-windowmanager.git diff --git a/src/applist.cpp b/src/applist.cpp index 391a3ce..888ab71 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; + } } /** @@ -159,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) @@ -170,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) @@ -228,16 +256,15 @@ void AppList::removeFloatingSurface(unsigned surface) this->floating_surfaces.erase(fwd_itr, this->floating_surfaces.end()); } -WMError AppList::appendRole(const string &id, const string &role, unsigned surface) +WMError AppList::appendRole(const string &id, const string &role) { WMError wm_err = WMError::NO_ENTRY; - HMI_ERROR("This function is disabled"); - /* if (this->contains(id)) + if (this->contains(id)) { auto x = this->lookUpClient(id); - x->addSurface(role, surface); + x->appendRole(role); wm_err = WMError::SUCCESS; - } */ + } return wm_err; } @@ -421,7 +448,7 @@ WMError AppList::setAction(unsigned req_num, const struct WMAction &action) * otherwise (visible is false) app should be invisible. Then enddraw_finished param is set to true. * This function doesn't support actions for focus yet. */ -WMError AppList::setAction(unsigned req_num, const string &appid, const string &role, const string &area, TaskVisible visible) +WMError AppList::setAction(unsigned req_num, shared_ptr client, const string &role, const string &area, TaskVisible visible) { std::lock_guard lock(this->mtx); WMError result = WMError::FAIL; @@ -433,7 +460,7 @@ WMError AppList::setAction(unsigned req_num, const string &appid, const string & } // If visible task is not invisible, redraw is required -> true bool edraw_f = (visible != TaskVisible::INVISIBLE) ? false : true; - WMAction action{appid, role, area, visible, edraw_f}; + WMAction action{req_num, client, role, area, visible, edraw_f}; x.sync_draw_req.push_back(action); result = WMError::SUCCESS; @@ -469,7 +496,7 @@ bool AppList::setEndDrawFinished(unsigned req_num, const string &appid, const st { for (auto &y : x.sync_draw_req) { - if (y.appid == appid && y.role == role) + if (y.client->appID() == appid && y.role == role) { HMI_SEQ_INFO(req_num, "Role %s finish redraw", y.role.c_str()); y.end_draw_finished = true; @@ -584,7 +611,7 @@ void AppList::reqDump() { DUMP( "Action : (APPID :%s, ROLE :%s, AREA :%s, VISIBLE : %s, END_DRAW_FINISHED: %d)", - y.appid.c_str(), + y.client->appID().c_str(), y.role.c_str(), y.area.c_str(), (y.visible == TaskVisible::INVISIBLE) ? "invisible" : "visible",