Remove floating surfaces when activate surface
authorKazumasa Mitsunari <knimitz@witz-inc.co.jp>
Sun, 10 Jun 2018 14:21:43 +0000 (23:21 +0900)
committerKazumasa Mitsunari <knimitz@witz-inc.co.jp>
Mon, 11 Jun 2018 00:01:10 +0000 (09:01 +0900)
Change-Id: Id8c4d28dfd32968cf0eb0e30cefdf9124ae134ec
Signed-off-by: Kazumasa Mitsunari <knimitz@witz-inc.co.jp>
src/app.cpp
src/applist.cpp
src/applist.hpp
src/wm_client.cpp
src/wm_client.hpp
src/wm_error.hpp

index 7dbf397..64a1835 100644 (file)
@@ -872,6 +872,11 @@ void App::api_activate_surface(char const *appid, char const *drawing_name, char
 
     auto client = app_list->lookUpClient(id);
 
+    unsigned srfc = client->surfaceID(role);
+    if(srfc != INVALID_SURFACE_ID){
+        // remove floating surface
+        app_list->removeFloatingSurface(client->surfaceID(role));
+    }
     /*
    * Queueing Phase
    */
index 5d7dce4..b5c1681 100644 (file)
@@ -124,6 +124,19 @@ void AppList::addFloatingSurface(unsigned surface, unsigned pid)
     this->floating_surfaces.push_back(fsurface);
 }
 
+void AppList::removeFloatingSurface(unsigned surface)
+{
+    for (auto itr = this->floating_surfaces.begin(); itr != this->floating_surfaces.end(); ++itr)
+    {
+        if (surface == itr->surface_id)
+        {
+            HMI_DEBUG("wm", "Erase surface %d", itr->surface_id);
+            itr = this->floating_surfaces.erase(itr);
+            break;
+        }
+    }
+}
+
 WMError AppList::appendRole(const std::string &id, const std::string &role, unsigned surface)
 {
     WMError wm_err = WMError::NO_ENTRY;
index 23d6b5a..36134a2 100644 (file)
@@ -51,11 +51,14 @@ class AppList
     int  countClient() const;
     std::shared_ptr<WMClient> lookUpClient(const std::string &appid);
     void removeSurface(unsigned surface);
-    WMError popFloatingSurface(unsigned pid, unsigned *surface);
-    WMError popFloatingSurface(const std::string &appid, unsigned *surface);
     WMError appendRole(const std::string &appid, const std::string &role, unsigned surface);
+
+    // Floating surface & client control
     void addFloatingClient(const std::string &appid, unsigned layer, const std::string &role);
     void addFloatingSurface(unsigned surface, unsigned pid);
+    WMError popFloatingSurface(unsigned pid, unsigned *surface);
+    WMError popFloatingSurface(const std::string &appid, unsigned *surface);
+    void removeFloatingSurface(unsigned surface);
 
     // Request Interface
     unsigned
index 6f1aa20..2194079 100644 (file)
@@ -18,8 +18,6 @@
 #include "wm_client.hpp"
 #include "hmi-debug.h"
 
-#define INVALID_SURFACE_ID 0
-
 using std::string;
 using std::vector;
 
index 5fa9444..fce323c 100644 (file)
@@ -20,6 +20,7 @@
 #include <vector>
 #include <string>
 #include <unordered_map>
+#include "wm_error.hpp"
 
 extern "C"
 {
index 155d791..c314439 100644 (file)
@@ -16,6 +16,7 @@
 
 #ifndef WINDOW_MANAGER_ERROR
 #define WINDOW_MANAGER_ERROR
+#define INVALID_SURFACE_ID 0
 
 namespace wm {