Fix output debug message
[apps/agl-service-windowmanager.git] / src / applist.cpp
index e27bd03..888ab71 100644 (file)
@@ -140,7 +140,14 @@ void AppList::removeSurface(unsigned surface){
  */
 shared_ptr<WMClient> 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)