diff options
author | Kazumasa Mitsunari <knimitz@witz-inc.co.jp> | 2018-07-13 13:21:34 +0900 |
---|---|---|
committer | Kazumasa Mitsunari <knimitz@witz-inc.co.jp> | 2018-07-13 13:54:08 +0900 |
commit | 1925bd207a01eeabc98c5894656fd5af34a468a5 (patch) | |
tree | 1833186ad46457cacb57d009c29b5924c3809dd6 /src/applist.cpp | |
parent | 67f414f67ee22ddf40003d1be3fa1d0cb13deb8f (diff) |
Merge "set_role_pid_ver"
Change-Id: If982a22e72cee32c2d4d5445492526d3abb3ab69
Signed-off-by: Kazumasa Mitsunari <knimitz@witz-inc.co.jp>
Diffstat (limited to 'src/applist.cpp')
-rw-r--r-- | src/applist.cpp | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/src/applist.cpp b/src/applist.cpp index a5ae9f0..c083c20 100644 --- a/src/applist.cpp +++ b/src/applist.cpp @@ -172,6 +172,74 @@ string AppList::getAppID(unsigned surface, const string& role, bool* found) cons return string(""); } +WMError AppList::popFloatingSurface(unsigned pid, unsigned *surface) +{ + WMError ret = WMError::NO_ENTRY; + + auto fwd_itr = std::remove_if(this->floating_surfaces.begin(), this->floating_surfaces.end(), + [pid, surface, &ret](FloatingSurface x) { + if(pid == x.pid){ + *surface = x.surface_id; + ret = WMError::SUCCESS; + return true; + } + else{ + return false; + } + }); + if (fwd_itr != this->floating_surfaces.cend()) + { + HMI_INFO("wm", "pop floating surface: %d", *surface); + } + this->floating_surfaces.erase(fwd_itr, this->floating_surfaces.end()); + return ret; +} + +// =================== Floating(Temporary) surface/client API =================== + +WMError AppList::popFloatingSurface(const std::string &appid, unsigned *surface) +{ + HMI_ERROR("wm", "This function is not implemented"); + return WMError::SUCCESS; +} + +void AppList::addFloatingClient(const std::string &appid, unsigned layer, const std::string &role) +{ +} + +void AppList::addFloatingSurface(unsigned surface, unsigned pid) +{ + struct FloatingSurface fsurface{surface, pid}; + this->floating_surfaces.push_back(fsurface); + this->dumpFloatingSurfaces(); +} + +void AppList::removeFloatingSurface(unsigned surface) +{ + this->dumpFloatingSurfaces(); + auto fwd_itr = std::remove_if(this->floating_surfaces.begin(), this->floating_surfaces.end(), + [surface](FloatingSurface x) { + return x.surface_id == surface; + }); + if(fwd_itr != this->floating_surfaces.cend()){ + HMI_INFO("wm", "remove floating surface: %d", surface); + } + this->floating_surfaces.erase(fwd_itr, this->floating_surfaces.end()); +} + +WMError AppList::appendRole(const std::string &id, const std::string &role, unsigned surface) +{ + WMError wm_err = WMError::NO_ENTRY; + if (this->contains(id)) + { + auto x = this->lookUpClient(id); + x->addSurface(role, surface); + wm_err = WMError::SUCCESS; + } + return wm_err; +} + + // =================== Request Date container API =================== /** @@ -523,4 +591,15 @@ void AppList::reqDump() } DUMP("======= req dump end ====="); } + +void AppList::dumpFloatingSurfaces() +{ + DUMP("======= floating surface dump ====="); + for (const auto &x : this->floating_surfaces) + { + DUMP("surface : %d, pid : %d", x.surface_id, x.pid); + } + DUMP("======= floating surface dump end =====\n"); +} + } // namespace wm |