Use instead enum of bool visible
[apps/agl-service-windowmanager.git] / src / app.cpp
index f1c9ed3..c42ae9c 100644 (file)
@@ -578,13 +578,12 @@ WMError App::checkPolicy(unsigned req_num)
             HMI_SEQ_INFO(req_num, "Additional split app %s, role: %s, area: %s",
                          add_name.c_str(), add_role.c_str(), add_area.c_str());
             // Set split action
-            bool visible = true;
             bool end_draw_finished = false;
             WMAction split_action{
                 add_name,
                 add_role,
                 add_area,
-                visible,
+                TaskVisible::VISIBLE,
                 end_draw_finished};
             WMError ret = g_app_list.setAction(req_num, split_action);
             if (ret != WMError::SUCCESS)
@@ -610,8 +609,9 @@ WMError App::checkPolicy(unsigned req_num)
 
     /*  get new status from Policy Manager */
     HMI_SEQ_NOTICE(req_num, "ATM, Policy manager does't exist, then set WMAction as is");
+    TaskVisible task_visible = (trigger.task == Task::TASK_ALLOCATE) ? TaskVisible::VISIBLE : TaskVisible::INVISIBLE;
 
-    ret = g_app_list.setAction(req_num, trigger.appid, trigger.role, req_area, trigger.task);
+    ret = g_app_list.setAction(req_num, trigger.appid, trigger.role, req_area, task_visible);
     g_app_list.reqDump();
 
     return ret;
@@ -632,7 +632,7 @@ WMError App::startTransition(unsigned req_num)
 
     for (const auto &y : actions)
     {
-        if (y.visible)
+        if (y.visible != TaskVisible::INVISIBLE)
         {
             sync_draw_happen = true;
             this->emit_syncdraw(y.role, y.area);
@@ -676,7 +676,7 @@ WMError App::setInvisibleTask(const std::string &role, bool split)
     std::string add_name, add_role;
     std::string add_area = "";
     int surface;
-    bool visible = false;
+    TaskVisible task_visible = TaskVisible::INVISIBLE;
     bool end_draw_finished = true;
     bool found = false;
 
@@ -696,7 +696,7 @@ WMError App::setInvisibleTask(const std::string &role, bool split)
                 return WMError::NOT_REGISTERED;
             }
             HMI_SEQ_INFO(req, "Invisible %s", add_name.c_str());
-            WMAction act{add_name, add_role, add_area, visible, end_draw_finished};
+            WMAction act{add_name, add_role, add_area, task_visible, end_draw_finished};
             g_app_list.setAction(req, act);
             l.second.state.main = -1;
         }
@@ -712,7 +712,7 @@ WMError App::setInvisibleTask(const std::string &role, bool split)
                 return WMError::NOT_REGISTERED;
             }
             HMI_SEQ_INFO(req, "Invisible %s", add_name.c_str());
-            WMAction act{add_name, add_role, add_area, visible, end_draw_finished};
+            WMAction act{add_name, add_role, add_area, task_visible, end_draw_finished};
             g_app_list.setAction(req, act);
             l.second.state.sub = -1;
         }
@@ -756,7 +756,7 @@ WMError App::setInvisibleTask(const std::string &role, bool split)
                             HMI_SEQ_DEBUG(req, "sub surface ddoesn't exist");
                             return WMError::NOT_REGISTERED;
                         }
-                        deact_sub.visible = visible;
+                        deact_sub.visible = task_visible;
                         deact_sub.end_draw_finished = end_draw_finished;
                         HMI_SEQ_DEBUG(req, "sub surface ddoesn't exist");
                         g_app_list.setAction(req, deact_sub);
@@ -782,7 +782,7 @@ WMError App::setInvisibleTask(const std::string &role, bool split)
                         HMI_SEQ_DEBUG(req, "sub surface ddoesn't exist");
                         return WMError::NOT_REGISTERED;
                     }
-                    deact_main.visible = visible;
+                    deact_main.visible = task_visible;
                     deact_main.end_draw_finished = end_draw_finished;
                     HMI_SEQ_DEBUG(req, "sub surface doesn't exist");
                     g_app_list.setAction(req, deact_main);
@@ -802,7 +802,7 @@ WMError App::setInvisibleTask(const std::string &role, bool split)
                             HMI_SEQ_DEBUG(req, "sub surface ddoesn't exist");
                             return WMError::NOT_REGISTERED;
                         }
-                        deact_sub.visible = visible;
+                        deact_sub.visible = task_visible;
                         deact_sub.end_draw_finished = end_draw_finished;
                         HMI_SEQ_DEBUG(req, "sub surface ddoesn't exist");
                         g_app_list.setAction(req, deact_sub);
@@ -812,7 +812,6 @@ WMError App::setInvisibleTask(const std::string &role, bool split)
             }
         }
     }
-
     return WMError::SUCCESS;
 }
 
@@ -1051,7 +1050,7 @@ WMError App::doEndDraw(unsigned req_num)
 
     for(const auto &act_flush : actions)
     {
-        if(act_flush.visible)
+        if(act_flush.visible != TaskVisible::INVISIBLE)
         {
             this->emit_flushdraw(act_flush.role.c_str());
         }
@@ -1069,8 +1068,9 @@ WMError App::setSurfaceSize(unsigned surface, const std::string &area)
 
 WMError App::layoutChange(const WMAction &action)
 {
-    if (action.visible == false)
+    if (action.visible == TaskVisible::INVISIBLE)
     {
+        // Visibility is not change -> no redraw is required
         return WMError::SUCCESS;
     }
     auto client = g_app_list.lookUpClient(action.appid);
@@ -1097,7 +1097,7 @@ WMError App::visibilityChange(const WMAction &action)
         return WMError::NOT_REGISTERED;
     }
 
-    if (action.visible)
+    if (action.visible != TaskVisible::INVISIBLE)
     {
         this->activate(surface); // Layout Manager task
     }
@@ -1125,7 +1125,7 @@ WMError App::changeCurrentState(unsigned req_num)
 
     for(const auto &action : actions)
     {
-        if(action.visible)
+        if(action.visible != TaskVisible::INVISIBLE)
         {
             // visible == true -> layout changes
             areas.push_back(action.area);