Clean: Remove split_layout structure
[apps/agl-service-windowmanager.git] / src / layers.cpp
index f73daf2..b7a0fa2 100644 (file)
@@ -31,35 +31,7 @@ layer::layer(nlohmann::json const &j)
     this->name = j["name"];
     this->layer_id = j["layer_id"];
 
-    // Init flag of normal layout only
-    this->is_normal_layout_only = true;
-
-    auto split_layouts = j.find("split_layouts");
-    if (split_layouts != j.end())
-    {
-
-        // Clear flag of normal layout only
-        this->is_normal_layout_only = false;
-
-        auto &sls = j["split_layouts"];
-        // this->layouts.reserve(sls.size());
-        std::transform(std::cbegin(sls), std::cend(sls),
-                       std::back_inserter(this->layouts), [this](json const &sl) {
-                           struct split_layout l
-                           {
-                               sl["name"], sl["main_match"], sl["sub_match"]
-                           };
-                           HMI_DEBUG("wm",
-                                     "layer %d add split_layout \"%s\" (main: \"%s\") (sub: "
-                                     "\"%s\")",
-                                     this->layer_id,
-                                     l.name.c_str(), l.main_match.c_str(),
-                                     l.sub_match.c_str());
-                           return l;
-                       });
-    }
-    HMI_DEBUG("wm", "layer_id:%d is_normal_layout_only:%d\n",
-              this->layer_id, this->is_normal_layout_only);
+    HMI_DEBUG("wm", "layer_id:%d name:%s", this->layer_id, this->name.c_str());
 }
 
 struct result<struct layer_map> to_layer_map(nlohmann::json const &j)
@@ -181,7 +153,7 @@ json layer_map::to_json() const
     return j;
 }
 
-void layer_map::setupArea(int output_w, int output_h)
+void layer_map::setupArea(double scaling)
 {
     compositor::rect rct;
 
@@ -191,6 +163,11 @@ void layer_map::setupArea(int output_w, int output_h)
 
     for (auto &i : this->area2size)
     {
+        i.second.x = static_cast<int>(scaling * i.second.x + 0.5);
+        i.second.y = static_cast<int>(scaling * i.second.y + 0.5);
+        i.second.w = static_cast<int>(scaling * i.second.w + 0.5);
+        i.second.h = static_cast<int>(scaling * i.second.h + 0.5);
+
         HMI_DEBUG("wm:lm", "area:%s size(after) : x:%d y:%d w:%d h:%d",
             i.first.c_str(), i.second.x, i.second.y, i.second.w, i.second.h);
     }