Add initialize of Layout Manager
authorKazumasa Mitsunari <knimitz@witz-inc.co.jp>
Mon, 20 Aug 2018 09:35:53 +0000 (18:35 +0900)
committerKazumasa Mitsunari <knimitz@witz-inc.co.jp>
Mon, 20 Aug 2018 09:35:53 +0000 (18:35 +0900)
Layout Manager is not suitable in this case... but this name is set be architecture...

Change-Id: Ia1612f243dcae2af229357cc982918b2b5ea7d7d
Signed-off-by: Kazumasa Mitsunari <knimitz@witz-inc.co.jp>
src/CMakeLists.txt
src/layers.hpp
src/window_manager.cpp
src/window_manager.hpp

index 3c8da4c..b1597b7 100644 (file)
@@ -38,7 +38,9 @@ add_library(${TARGETS_WM} MODULE
    wm_error.cpp
    applist.cpp
    request.cpp
-   pm_wrapper.cpp)
+   pm_wrapper.cpp
+   wm_layer.cpp
+   layout_manager.cpp)
 
 target_include_directories(${TARGETS_WM}
     PRIVATE
index 6d0dcf2..f52886e 100644 (file)
@@ -65,54 +65,6 @@ struct layer
     json to_json() const;
 };
 
-/*
- * WMLayer is the logical container of application/system application(such like HomeScreen)
- * This is handled by Window Manager to classify the application.
- */
-class WMLayer
-{
-  public:
-    enum MANAGEMENT_TYPE
-    {
-        TILE,
-        STACK
-    };
-
-    explicit WMLayer(const std::string& name, MANAGEMENT_TYPE type, unsigned begin, unsigned end);
-    virtual ~WMLayer();
-
-    const std::string& layerName();
-    MANAGEMENT_TYPE layerType();
-    void appendRole(const std::string& name);
-    void appendArea(const std::string& area);
-
-/*     unsigned getNewID(const std::string& role);
-    void remove(unsigned ivi_layer_id);
-    void clear();
-    bool attach(unsigned ivi_layer_id, const std::string& area);
-    void stack(unsigned ivi_layer_id, const std::string& area);
-    bool updateRenderOrder(const std::vector<unsigned> list); */
-
-  private:
-    std::string _name = ""; // Layer name
-    MANAGEMENT_TYPE _type;
-    std::vector<std::string> _roles;
-    unsigned _id_begin;
-    unsigned _id_end;
-    // current holding apps. This dynamically changes.
-    std::vector<unsigned> _ivi_layer_id_list;
-    // std::map<std::string, unsigned> _render_order;
-};
-
-class LayerManager
-{
-  public:
-    void setRenderOrder(const std::vector<unsigned> layer_render_order);
-    std::vector<unsigned> getAllRenderOrder();
-    std::vector<std::shared_ptr<WMLayer>>& getAllLayers();
-    std::vector<unsigned> getRenderOrder(const std::string& layer_name);
-};
-
 struct layer_map
 {
     using json = nlohmann::json;
index 4e41d40..bb8b073 100644 (file)
@@ -126,19 +126,19 @@ WindowManager::WindowManager(wl::display *d)
       id_alloc{},
       pending_events(false)
 {
-    char const *path_layers_json = getenv("AFM_APP_INSTALL_DIR");
-    string path;
-    if (!path_layers_json)
+    const char *path = getenv("AFM_APP_INSTALL_DIR");
+    string lm_setting_path = path;
+    if (!path)
     {
         HMI_ERROR("wm", "AFM_APP_INSTALL_DIR is not defined");
-        path = string(path_layers_json);
     }
     else
     {
-        path = string(path_layers_json) + string("/etc/layers.json");
+        lm_setting_path += "/etc/layers_setting.json";
     }
+    this->lm = std::make_shared<LayoutManager>(lm_setting_path);
 
-    try
+/*     try
     {
         {
             auto l = load_layer_map(path.c_str());
@@ -155,7 +155,7 @@ WindowManager::WindowManager(wl::display *d)
     catch (std::exception &e)
     {
         HMI_ERROR("wm", "Loading of configuration failed: %s", e.what());
-    }
+    } */
 }
 
 int WindowManager::init()
index aa1b4cc..d77d23a 100644 (file)
@@ -29,6 +29,7 @@
 #include "hmi-debug.h"
 #include "request.hpp"
 #include "wm_error.hpp"
+#include "layout_manager.hpp"
 
 struct json_object;
 
@@ -280,7 +281,7 @@ class WindowManager
     std::unordered_map<std::string, struct compositor::rect> area2size;
     std::unordered_map<std::string, std::string> roleold2new;
     std::unordered_map<std::string, std::string> rolenew2old;
-
+    std::shared_ptr<LayoutManager> lm;
     PMWrapper pmw;
 
     static const char* kDefaultOldRoleDb;