aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKazumasa Mitsunari <knimitz@witz-inc.co.jp>2018-06-18 09:16:23 +0900
committerKazumasa Mitsunari <knimitz@witz-inc.co.jp>2018-06-18 09:24:15 +0900
commit494fe928438bd08f6a5794a2a77119d5fa9dcdd2 (patch)
treeb501a193e3846f3c0932eeb2f9e33bc6ed148c78
parent5ae7f0df360a72a42b4722cbffddd169da21b4d0 (diff)
Use instead enum of bool visible
To improve readability, use enum TaskVisible instead of visible Change-Id: I40f15635a62177443e32725fe90a4d6d3f253f8a Signed-off-by: Kazumasa Mitsunari <knimitz@witz-inc.co.jp>
-rw-r--r--src/app.cpp30
-rw-r--r--src/applist.cpp7
-rw-r--r--src/applist.hpp2
-rw-r--r--src/request.hpp9
4 files changed, 28 insertions, 20 deletions
diff --git a/src/app.cpp b/src/app.cpp
index f1c9ed3..c42ae9c 100644
--- a/src/app.cpp
+++ b/src/app.cpp
@@ -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);
diff --git a/src/applist.cpp b/src/applist.cpp
index 130eb61..d3a839c 100644
--- a/src/applist.cpp
+++ b/src/applist.cpp
@@ -343,14 +343,14 @@ WMError AppList::setAction(unsigned req_num, const struct WMAction &action)
* @param string[in] application id
* @param string[in] role
* @param string[in] area
- * @param bool[in] the role should be visible or not.
+ * @param Task[in] the role should be visible or not.
* @return WMError If request number is not valid, FAIL will be returned.
* @attention This function set action with parameters, then caller doesn't need to create WMAction object.
* If visible is true, it means app should be visible, so enddraw_finished parameter will be false.
* 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, bool visible)
+WMError AppList::setAction(unsigned req_num, const string &appid, const string &role, const string &area, TaskVisible visible)
{
std::lock_guard<std::mutex> lock(this->mtx);
WMError result = WMError::FAIL;
@@ -360,7 +360,8 @@ WMError AppList::setAction(unsigned req_num, const string &appid, const string &
{
continue;
}
- bool edraw_f = (visible) ? false : true;
+ // 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};
x.sync_draw_req.push_back(action);
diff --git a/src/applist.hpp b/src/applist.hpp
index 6305a4b..9431ff6 100644
--- a/src/applist.hpp
+++ b/src/applist.hpp
@@ -55,7 +55,7 @@ class AppList
unsigned getRequestNumber(const std::string &appid) const;
unsigned addAllocateRequest(WMRequest req);
WMError setAction(unsigned req_num, const struct WMAction &action);
- WMError setAction(unsigned req_num, const std::string &appid, const std::string &role, const std::string &area, bool visible = true);
+ WMError setAction(unsigned req_num, const std::string &appid, 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);
void removeRequest(unsigned req_num);
diff --git a/src/request.hpp b/src/request.hpp
index ded2c02..6b2bda1 100644
--- a/src/request.hpp
+++ b/src/request.hpp
@@ -30,6 +30,13 @@ enum Task
TASK_INVALID
};
+enum TaskVisible
+{
+ VISIBLE,
+ INVISIBLE,
+ NO_CHANGE
+};
+
struct WMTrigger
{
std::string appid;
@@ -43,7 +50,7 @@ struct WMAction
std::string appid;
std::string role;
std::string area;
- bool visible;
+ TaskVisible visible;
bool end_draw_finished;
};