fix for als2019 8.0.0
[apps/agl-service-windowmanager.git] / src / wm_layer_control.cpp
index 887fc58..3e3d0d5 100644 (file)
@@ -861,18 +861,7 @@ bool LayerControl::moveForeGround(const shared_ptr<WMClient> client)
 bool LayerControl::moveRemote(unsigned layer, const std::string& area)
 {
     bool ret = false;
-    std::string remote_layer;
-    std::string ecu_name = area;
-
-    if (area.find('.') != std::string::npos)
-    {
-        std::vector<std::string> elements;
-        elements = parseString(area, '.');
-        ecu_name = elements[0];
-    }
-
-    remote_layer = this->areaToRemoteLayer(ecu_name);
-
+    std::string remote_layer = this->areaToRemoteLayer(area);
     auto remote = this->getWMLayer(remote_layer);
     
     if(remote != nullptr)
@@ -944,13 +933,46 @@ std::string LayerControl::hasRemoteLayer(unsigned layer)
     return "";
 }
 
-std::string LayerControl::areaToRemoteLayer(std::string area)
+std::string LayerControl::areaToRemoteLayer(const std::string& area)
 {
+    std::vector<std::string> elements;
+
+    if (area.find('.') != std::string::npos)
+    {
+        elements = parseString(area, '.');
+    }
+    else
+    {
+        elements.push_back(area);
+    }
+
     for (auto itr = wm_remoteLayerName.begin(); itr != wm_remoteLayerName.end(); ++itr)
     {
-        if (std::regex_search(*itr, std::regex(area, std::regex::icase)))
+        unsigned int idx = 0;
+        for (auto itr_elem = elements.begin(); itr_elem != elements.end(); ++itr_elem)
         {
-            return *itr;
+            if (std::regex_search(*itr, std::regex(*itr_elem, std::regex::icase)))
+            {
+                if (++idx == elements.size())
+               {
+                    return *itr;
+               }
+            }
+           else
+           {
+                // TODO: workaround, skip normal case
+                if ((itr_elem->compare("normal") == 0) || (itr_elem->compare("full") == 0))
+                {
+                    if (++idx == elements.size())
+                    {
+                        return *itr;
+                    }
+                }
+                else
+                {
+                    break;
+                }
+           }
         }
     }