Fix window_manager.cpp used old_role
[apps/agl-service-windowmanager.git] / src / wm_client.cpp
index 3bc2d31..baed828 100644 (file)
@@ -17,6 +17,7 @@
 #include <json-c/json.h>
 #include "wm_client.hpp"
 #include "util.hpp"
+#include <ilm/ilm_control.h>
 
 #define INVALID_SURFACE_ID 0
 
@@ -71,12 +72,14 @@ WMClient::WMClient(const string &appid, const string &role)
     }
 }
 
-WMClient::WMClient(const string &appid, unsigned layer,
-    const string& layer_name, unsigned surface, const string &role)
-    : id(appid), layer(layer), wm_layer_name(layer_name),
-      role2surface(0)
+WMClient::WMClient(const string &appid, unsigned layer, const string &role)
+    : id(appid),
+      layer(layer),
+      main_role(role),
+      role2surface(0),
+      evname2afb_event(0)
 {
-    role2surface[role] = surface;
+    role2surface[role] = INVALID_SURFACE_ID;
     for (auto x : kWMEvents)
     {
 #if GTEST_ENABLED
@@ -129,11 +132,6 @@ unsigned WMClient::surfaceID() const
     return this->surface;
 }
 
-const string& WMClient::getWMLayerName()
-{
-    return this->wm_layer_name;
-}
-
 void WMClient::setRole(const string& role)
 {
     this->role_list.clear();
@@ -158,7 +156,7 @@ void WMClient::appendRole(const string& role)
  * @param     unsigned[in] surface
  * @return    true
  */
-bool WMClient::addSurface(const string &role, unsigned surface)
+/* bool WMClient::addSurface(const string &role, unsigned surface)
 {
     HMI_DEBUG("Add role %s with surface %d", role.c_str(), surface);
     if (0 != this->role2surface.count(role))
@@ -167,6 +165,18 @@ bool WMClient::addSurface(const string &role, unsigned surface)
     }
     this->role2surface[role] = surface;
     return true;
+} */
+
+WMError WMClient::addSurface(unsigned surface)
+{
+    this->surface = surface;
+    ilmErrorTypes err = ilm_layerAddSurface(this->layer, surface);
+
+    if(err == ILM_SUCCESS)
+    {
+        err = ilm_commitChanges();
+    }
+    return (err == ILM_SUCCESS) ? WMError::SUCCESS : WMError::FAIL;
 }
 
 bool WMClient::removeSurfaceIfExist(unsigned surface)