aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/applist.cpp29
-rw-r--r--src/applist.hpp1
2 files changed, 27 insertions, 3 deletions
diff --git a/src/applist.cpp b/src/applist.cpp
index 4e0dc11..919c099 100644
--- a/src/applist.cpp
+++ b/src/applist.cpp
@@ -133,15 +133,38 @@ shared_ptr<WMClient> AppList::lookUpClient(const string &appid)
*
* Returns the number of client stored in the list.
*
- * @param string[in] application id(key)
- * @return WMClient object
- * @attention Must call cantains to check appid is stored before this function.
+ * @param None
+ * @return The number of client
*/
int AppList::countClient() const
{
return this->app2client.size();
}
+/**
+ * Get AppID with surface and role.
+ *
+ * Returns AppID if found.
+ *
+ * @param unsigned[in] surfaceID
+ * @param string[in] role
+ * @param bool[in,out] (key)
+ * @return WMClient object
+ * @attention If AppID is not found, param found will be false.
+ */
+string AppList::getAppID(unsigned surface, const string& role, bool* found) const
+{
+ *found = false;
+ for (const auto &x : this->app2client)
+ {
+ if(x.second->surfaceID(role) == surface){
+ *found = true;
+ return x.second->appID();
+ }
+ }
+ return string("");
+}
+
// =================== Request Date container API ===================
/**
diff --git a/src/applist.hpp b/src/applist.hpp
index eaa7e99..6305a4b 100644
--- a/src/applist.hpp
+++ b/src/applist.hpp
@@ -48,6 +48,7 @@ class AppList
int countClient() const;
std::shared_ptr<WMClient> lookUpClient(const std::string &appid);
void removeSurface(unsigned surface);
+ std::string getAppID(unsigned surface, const std::string &role, bool *found) const;
// Request Interface
unsigned currentRequestNumber() const;