Remove config source
[apps/agl-service-windowmanager.git] / src / app.cpp
index c9bb103..8ff0c17 100644 (file)
@@ -160,17 +160,26 @@ App::App(wl::display *d)
       display{d},
       controller{},
       outputs(),
-      config(),
       layers(),
       id_alloc{},
-      pending_events(false),
-      policy{}
+      pending_events(false)
 {
+    char const *path_layers_json = getenv("AFM_APP_INSTALL_DIR");
+    std::string path;
+    if (!path_layers_json)
+    {
+        HMI_ERROR("wm", "AFM_APP_INSTALL_DIR is not defined");
+        path = std::string(path_layers_json);
+    }
+    else
+    {
+        path = std::string(path_layers_json) + std::string("/etc/layers.json");
+    }
+
     try
     {
         {
-            auto l = load_layer_map(
-                this->config.get_string("layers.json").value().c_str());
+            auto l = load_layer_map(path.c_str());
             if (l.is_ok())
             {
                 this->layers = l.unwrap();
@@ -649,15 +658,6 @@ WMError App::setInvisibleTask(const std::string &role, bool split)
     if (state.main == -1)
     {
         HMI_DEBUG("wm", "Layout: %s", kNameLayoutNormal);
-        //state = LayoutState{*surface_id};
-        /* this->try_layout(
-            state, LayoutState{*surface_id}, [&](LayoutState const &nl) {
-                HMI_DEBUG("wm", "Layout: %s", kNameLayoutNormal);
-                //this->surface_set_layout(*surface_id);
-                state = nl;
-
-                //compositor::rect area_rect = this->area_info[*surface_id];
-            }); */
     }
     else
     {
@@ -1186,19 +1186,6 @@ void App::surface_created(uint32_t surface_id)
 
     this->controller->layers[*layer_id]->add_surface(surface_id);
     this->layout_commit();
-    // activate the main_surface right away
-    /*if (surface_id == static_cast<unsigned>(this->layers.main_surface)) {
-      HMI_DEBUG("wm", "Activating main_surface (%d)", surface_id);
-
-      this->api_activate_surface(
-         this->lookup_name(surface_id).value_or("unknown-name").c_str());
-   }*/
-
-    // search pid from surfaceID
-
-    // pick up appid from pid from application manager
-
-    // check appid then add it to the client
 }
 
 void App::surface_removed(uint32_t surface_id)
@@ -1530,16 +1517,6 @@ bool App::can_split(struct LayoutState const &state, int new_id)
     return false;
 }
 
-void App::try_layout(struct LayoutState & /*state*/,
-                     struct LayoutState const &new_layout,
-                     std::function<void(LayoutState const &nl)> apply)
-{
-    if (this->policy.layout_is_valid(new_layout))
-    {
-        apply(new_layout);
-    }
-}
-
 /**
  * controller_hooks
  */