temporary change
authorKazumasa Mitsunari <knimitz@witz-inc.co.jp>
Thu, 30 Aug 2018 12:00:53 +0000 (21:00 +0900)
committerKazumasa Mitsunari <knimitz@witz-inc.co.jp>
Thu, 30 Aug 2018 12:00:53 +0000 (21:00 +0900)
Change-Id: I48618fd00e607176c95b4e3950fca7dbb058a3b1
Signed-off-by: Kazumasa Mitsunari <knimitz@witz-inc.co.jp>
layers_setting.json
src/request.hpp
src/window_manager.cpp
src/wm_layer_control.cpp
src/wm_layer_control.hpp

index ed43288..7c55677 100644 (file)
@@ -2,7 +2,7 @@
     "description": "Layer mapping",
     "mappings": [
         {
-            "name": "EvacuationLayer",
+            "name": "BackGroundLayer",
             "role" : "",
             "type" : "stack",
             "id_range_begin": 0,
index 6b2bda1..84973de 100644 (file)
@@ -19,6 +19,7 @@
 
 #include <string>
 #include <vector>
+#include <memory>
 
 namespace wm
 {
@@ -52,6 +53,8 @@ struct WMAction
     std::string area;
     TaskVisible visible;
     bool end_draw_finished;
+    std::shared_ptr<WMAction> client;
+    unsigned req_num;
 };
 
 struct WMRequest
index ea3c794..95b0d5a 100644 (file)
@@ -470,14 +470,11 @@ void WindowManager::api_activate_surface(char const *appid, char const *drawing_
     }
     auto client = g_app_list.lookUpClient(id);
 
-    unsigned srfc = client->surfaceID(role);
-    if(srfc == 0)
-    {
-        HMI_ERROR("role sould be set with surface");
-        reply("role sould be set with surface");
-        return;
-    }
-    g_app_list.removeFloatingSurface(client->surfaceID());
+    // unsigned srfc = client->surfaceID(role);
+    // unsigned layer = client->layerID();
+
+    // g_app_list.removeFloatingSurface(client->surfaceID());
+    // g_app_list.removeFloatingSurface(client);
 
     Task task = Task::TASK_ALLOCATE;
     unsigned req_num = 0;
@@ -1321,14 +1318,14 @@ WMError WindowManager::doEndDraw(unsigned req_num)
             if(!g_app_list.contains(act.appid)){
                 ret = WMError::NOT_REGISTERED;
             }
-            ret = this->layoutChange(act);
+            ret = this->lc->layoutChange(act);
             if(ret != WMError::SUCCESS)
             {
                 HMI_SEQ_WARNING(req_num,
                     "Failed to manipulate surfaces while state change : %s", errorDescription(ret));
                 return ret;
             }
-            ret = this->visibilityChange(act);
+            ret = this->lc->visibilityChange(act);
             if (ret != WMError::SUCCESS)
             {
                 HMI_SEQ_WARNING(req_num,
@@ -1339,7 +1336,7 @@ WMError WindowManager::doEndDraw(unsigned req_num)
             //this->lc_enddraw(act.role.c_str());
         }
     }
-    this->layout_commit();
+    this->lc->commitChange();
 
     HMI_SEQ_INFO(req_num, "emit flushDraw");
 
index 9c60286..3f39d65 100644 (file)
@@ -17,6 +17,8 @@
 #include <unistd.h>\r
 #include "wm_layer_control.hpp"\r
 #include "wm_layer.hpp"\r
+#include "wm_client.hpp"\r
+#include "request.hpp"\r
 #include "json_helper.hpp"\r
 \r
 #define LC_AREA_PATH "/etc/areas.db"\r
@@ -319,6 +321,52 @@ WMError LayerControl::loadAreaDb(const std::string& path)
     return WMError::SUCCESS;\r
 }\r
 \r
+WMError LayerControl::layoutChange(const WMAction& action)\r
+{\r
+    WMError ret = WMError::FAIL;\r
+    if (action.visible == TaskVisible::INVISIBLE)\r
+    {\r
+        // Visibility is not change -> no redraw is required\r
+        return WMError::SUCCESS;\r
+    }\r
+    if(action.client == nullptr)\r
+    {\r
+        HMI_SEQ_ERROR(action.req_num, "client may vanish");\r
+        return WMError::NOT_REGISTERED;\r
+    }\r
+    unsigned layer = action.client->layerID();\r
+\r
+    // Layout Manager\r
+    // WMError ret = this->setLayerSize(layer, action.area);\r
+    auto rect = this->getAreaSize(action.area);\r
+    ilmErrorTypes err = ilm_layerSetDestinationRectangle(layer, rect.x, rect.y, rect.w, rect.h);\r
+    if(err == ILM_SUCCESS)\r
+    {\r
+        ret = WMError::SUCCESS;\r
+    }\r
+    return ret;\r
+}\r
+\r
+WMError LayerControl::visibilityChange(const WMAction& action)\r
+{\r
+    WMError ret = WMError::FAIL;\r
+    if(action.client == nullptr)\r
+    {\r
+        HMI_SEQ_ERROR(action.req_num, "client may vanish");\r
+        return WMError::NOT_REGISTERED;\r
+    }\r
+\r
+    if (action.visible != TaskVisible::INVISIBLE)\r
+    {\r
+        ret = this->makeVisible(action.client.get());\r
+    }\r
+    else\r
+    {\r
+        ret = this->makeInvisible(action.client.get());\r
+    }\r
+    return ret;\r
+}\r
+\r
 void LayerControl::dispatchCreateEvent(ilmObjectType object, unsigned id, bool created)\r
 {\r
     this->cb.test(id);\r
@@ -477,4 +525,61 @@ void LayerControl::dispatchPropertyChangeEvent(unsigned id,
     }\r
 }\r
 \r
+WMError LayerControl::makeVisible(const WMClient* client)\r
+{\r
+    WMError ret = WMError::FAIL;\r
+    // Don't check here the client is not nullptr\r
+    unsigned layer = client->layerID();\r
+    bool contains;// = this->checkBackGround(action.client->role());\r
+    if(contains)\r
+    {\r
+        std::shared_ptr<WMLayer> l;\r
+        // Move background from back ground layer\r
+        for(const auto& wm_layer : this->wm_layers)\r
+        {\r
+            if(wm_layer->layerName() == "BackGroundLayer")\r
+            {\r
+                //wm_layer.removeLayer(layer);\r
+            }\r
+            else\r
+            {\r
+                if(wm_layer->checkIDBelongTo(layer))\r
+                {\r
+                    l = wm_layer;\r
+                }\r
+            }\r
+        }\r
+        if(l != nullptr)\r
+        {\r
+            // make invisible first\r
+            ilm_layerSetVisibility(layer, 0);\r
+            ilm_commitChanges();\r
+            //l->addLayer(layer);\r
+        }\r
+    }\r
+    for(const auto& wm_layer : this->wm_layers)\r
+    {\r
+        // make visible\r
+        //l->makeVisible(layer);\r
+    }\r
+\r
+    return ret;\r
+}\r
+\r
+WMError LayerControl::makeInvisible(const WMClient* client)\r
+{\r
+    WMError ret = WMError::FAIL;\r
+    // Don't check here the client is not nullptr\r
+    unsigned layer = client->layerID();\r
+    bool contains;// = this->checkBackGround(client->role());\r
+    if(contains)\r
+    {\r
+        // Pop from background\r
+    }\r
+    else\r
+    {\r
+\r
+    }\r
+    return ret;\r
+}\r
 } // namespace wm
\ No newline at end of file
index db482bf..ea122a3 100644 (file)
@@ -54,6 +54,9 @@ class LayerControlCallbacks {
 \r
 class WMLayer;\r
 class LayerState;\r
+class WMAction;\r
+class WMClient;\r
+\r
 class LayerControl\r
 {\r
   public:\r
@@ -73,12 +76,16 @@ class LayerControl
     WMError updateLayer(LayerState& layer_state);\r
     WMError commitChange();\r
     void undoUpdate();\r
+    WMError layoutChange(const WMAction& action);\r
+    WMError visibilityChange(const WMAction &action);\r
 \r
     // Don't use this function.\r
     void dispatchCreateEvent(ilmObjectType object, unsigned id, bool created);\r
     void dispatchPropertyChangeEvent(unsigned id, struct ilmSurfaceProperties*, t_ilm_notification_mask);\r
     void dispatchPropertyChangeEvent(unsigned id, struct ilmLayerProperties*, t_ilm_notification_mask);\r
   private:\r
+    WMError makeVisible(const WMClient* client);\r
+    WMError makeInvisible(const WMClient* client);\r
     WMError loadLayerSetting(const std::string& path);\r
     WMError loadAreaDb(const std::string& path);\r
 \r