Change struct WMAction
authorKazumasa Mitsunari <knimitz@witz-inc.co.jp>
Fri, 31 Aug 2018 11:50:28 +0000 (20:50 +0900)
committerKazumasa Mitsunari <knimitz@witz-inc.co.jp>
Fri, 31 Aug 2018 11:50:28 +0000 (20:50 +0900)
Change-Id: I46ce99ef4222018cbcaf371e7348040ebb992387
Signed-off-by: Kazumasa Mitsunari <knimitz@witz-inc.co.jp>
src/applist.cpp
src/applist.hpp
src/pm_wrapper.cpp
src/request.hpp
src/window_manager.cpp

index 644e41e..93c90ac 100644 (file)
@@ -428,7 +428,7 @@ WMError AppList::setAction(unsigned req_num, const struct WMAction &action)
  *            otherwise (visible is false) app should be invisible. Then enddraw_finished param is set to true.
  *            This function doesn't support actions for focus yet.
  */
-WMError AppList::setAction(unsigned req_num, const string &appid, const string &role, const string &area, TaskVisible visible)
+WMError AppList::setAction(unsigned req_num, shared_ptr<WMClient> client, const string &role, const string &area, TaskVisible visible)
 {
     std::lock_guard<std::mutex> lock(this->mtx);
     WMError result = WMError::FAIL;
@@ -440,7 +440,7 @@ WMError AppList::setAction(unsigned req_num, const string &appid, const string &
         }
         // If visible task is not invisible, redraw is required -> true
         bool edraw_f = (visible != TaskVisible::INVISIBLE) ? false : true;
-        WMAction action{appid, role, area, visible, edraw_f};
+        WMAction action{req_num, client, role, area, visible, edraw_f};
 
         x.sync_draw_req.push_back(action);
         result = WMError::SUCCESS;
@@ -476,7 +476,7 @@ bool AppList::setEndDrawFinished(unsigned req_num, const string &appid, const st
         {
             for (auto &y : x.sync_draw_req)
             {
-                if (y.appid == appid && y.role == role)
+                if (y.client->appID() == appid && y.role == role)
                 {
                     HMI_SEQ_INFO(req_num, "Role %s finish redraw", y.role.c_str());
                     y.end_draw_finished = true;
@@ -591,7 +591,7 @@ void AppList::reqDump()
         {
             DUMP(
                 "Action  : (APPID :%s, ROLE :%s, AREA :%s, VISIBLE : %s, END_DRAW_FINISHED: %d)",
-                y.appid.c_str(),
+                y.client->appID().c_str(),
                 y.role.c_str(),
                 y.area.c_str(),
                 (y.visible == TaskVisible::INVISIBLE) ? "invisible" : "visible",
index 9e86b83..1bc27c6 100644 (file)
@@ -73,7 +73,7 @@ class AppList
     unsigned getRequestNumber(const std::string &appid) const;
     unsigned addRequest(WMRequest req);
     WMError setAction(unsigned req_num, const struct WMAction &action);
-    WMError setAction(unsigned req_num, const std::string &appid,
+    WMError setAction(unsigned req_num, std::shared_ptr<WMClient> client,
                     const std::string &role, const std::string &area, TaskVisible visible);
     bool setEndDrawFinished(unsigned req_num, const std::string &appid, const std::string &role);
     bool endDrawFullfilled(unsigned req_num);
index efc6c64..f0efcac 100644 (file)
@@ -192,7 +192,8 @@ void PMWrapper::createLayoutChangeAction(json_object *json_out, std::vector<WMAc
                     bool end_draw_finished = false;
                     WMAction act
                     {
-                        "",
+                        0,
+                        nullptr,
                         role_name,
                         area_name,
                         TaskVisible::VISIBLE,
@@ -214,7 +215,8 @@ void PMWrapper::createLayoutChangeAction(json_object *json_out, std::vector<WMAc
                         bool end_draw_finished = false;
                         WMAction act
                         {
-                            "",
+                            0,
+                            nullptr,
                             role_name,
                             area_name,
                             TaskVisible::VISIBLE,
@@ -238,7 +240,8 @@ void PMWrapper::createLayoutChangeAction(json_object *json_out, std::vector<WMAc
                 bool end_draw_finished = true;
                 WMAction act
                 {
-                    "",
+                    0,
+                    nullptr,
                     i_prv.first,
                     "",
                     TaskVisible::INVISIBLE,
index 95b8c82..073dd27 100644 (file)
@@ -50,13 +50,12 @@ struct WMTrigger
 
 struct WMAction
 {
-    std::string appid;
+    unsigned req_num;
+    std::shared_ptr<WMClient> client;
     std::string role;
     std::string area;
     TaskVisible visible;
     bool end_draw_finished;
-    std::shared_ptr<WMClient> client;
-    unsigned req_num;
 };
 
 struct WMRequest
index cb45acd..fc333d4 100644 (file)
@@ -818,6 +818,7 @@ void WindowManager::timerHandler()
 void WindowManager::startTransitionWrapper(vector<WMAction> &actions)
 {
     WMError ret;
+    // req_num is guaranteed by Window Manager
     unsigned req_num = g_app_list.currentRequestNumber();
 
     if (actions.empty())
@@ -855,7 +856,9 @@ void WindowManager::startTransitionWrapper(vector<WMAction> &actions)
                     goto error;
                 }
             }
-            act.appid = appid;
+            auto client = g_app_list.lookUpClient(appid);
+            act.req_num = req_num;
+            act.client = client;
         }
 
         ret = g_app_list.setAction(req_num, act);
@@ -1290,12 +1293,14 @@ WMError WindowManager::startTransition(unsigned req_num)
         // Make it deactivate here
         for (const auto &x : actions)
         {
-            if (g_app_list.contains(x.appid))
+            this->lc->visibilityChange(x);
+            /* if (g_app_list.contains(x.appid))
             {
                 auto client = g_app_list.lookUpClient(x.appid);
-                this->deactivate(client->surfaceID(x.role));
-            }
+                //this->deactivate(client->surfaceID(x.role));
+            } */
         }
+        this->lc->commitChange();
         ret = WMError::NO_LAYOUT_CHANGE;
     }
     return ret;
@@ -1321,9 +1326,6 @@ WMError WindowManager::doEndDraw(unsigned req_num)
         if(act.visible != TaskVisible::NO_CHANGE)
         {
             // layout change
-            if(!g_app_list.contains(act.appid)){
-                ret = WMError::NOT_REGISTERED;
-            }
             ret = this->lc->layoutChange(act);
             if(ret != WMError::SUCCESS)
             {
@@ -1368,7 +1370,8 @@ WMError WindowManager::layoutChange(const WMAction &action)
         // Visibility is not change -> no redraw is required
         return WMError::SUCCESS;
     }
-    auto client = g_app_list.lookUpClient(action.appid);
+    WMError ret = this->lc->layoutChange(action);
+    /* auto client = g_app_list.lookUpClient(action.appid);
     unsigned surface = client->surfaceID(action.role);
     if (surface == 0)
     {
@@ -1377,14 +1380,14 @@ WMError WindowManager::layoutChange(const WMAction &action)
         return WMError::NOT_REGISTERED;
     }
     // Layout Manager
-    WMError ret = this->setSurfaceSize(surface, action.area);
+    WMError ret = this->setSurfaceSize(surface, action.area); */
     return ret;
 }
 
 WMError WindowManager::visibilityChange(const WMAction &action)
 {
     HMI_SEQ_DEBUG(g_app_list.currentRequestNumber(), "Change visibility");
-    if(!g_app_list.contains(action.appid)){
+    /* if(!g_app_list.contains(action.appid)){
         return WMError::NOT_REGISTERED;
     }
     auto client = g_app_list.lookUpClient(action.appid);
@@ -1394,17 +1397,18 @@ WMError WindowManager::visibilityChange(const WMAction &action)
         HMI_SEQ_ERROR(g_app_list.currentRequestNumber(),
                       "client doesn't have surface with role(%s)", action.role.c_str());
         return WMError::NOT_REGISTERED;
-    }
+    } */
+    WMError ret = this->lc->visibilityChange(action);
 
-    if (action.visible != TaskVisible::INVISIBLE)
+/*     if (action.visible != TaskVisible::INVISIBLE)
     {
         this->activate(surface); // Layout Manager task
     }
     else
     {
         this->deactivate(surface); // Layout Manager task
-    }
-    return WMError::SUCCESS;
+    } */
+    return ret;
 }
 
 WMError WindowManager::setSurfaceSize(unsigned surface, const string &area)
@@ -1429,7 +1433,7 @@ void WindowManager::emitScreenUpdated(unsigned req_num)
     {
         if(action.visible != TaskVisible::INVISIBLE)
         {
-            json_object_array_add(jarray, json_object_new_string(action.appid.c_str()));
+            json_object_array_add(jarray, json_object_new_string(action.client->appID().c_str()));
         }
     }
     json_object_object_add(j, kKeyIds, jarray);