aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/app.cpp58
-rw-r--r--src/app.hpp4
2 files changed, 58 insertions, 4 deletions
diff --git a/src/app.cpp b/src/app.cpp
index 2d82e95..f1c9ed3 100644
--- a/src/app.cpp
+++ b/src/app.cpp
@@ -1020,8 +1020,8 @@ WMError App::doEndDraw(unsigned req_num)
}
HMI_SEQ_INFO(req_num, "do endDraw");
- // layout change and make it visible
+ // layout change and make it visible
for (const auto &act : actions)
{
// layout change
@@ -1044,6 +1044,9 @@ WMError App::doEndDraw(unsigned req_num)
//this->lm_enddraw(act.role.c_str());
}
+ // Change current state
+ this->changeCurrentState(req_num);
+
HMI_SEQ_INFO(req_num, "emit flushDraw");
for(const auto &act_flush : actions)
@@ -1105,6 +1108,52 @@ WMError App::visibilityChange(const WMAction &action)
return WMError::SUCCESS;
}
+WMError App::changeCurrentState(unsigned req_num)
+{
+ HMI_SEQ_DEBUG(req_num, "Change current layout status");
+ bool found = false;
+ auto actions = g_app_list.getActions(req_num, &found);
+ if(!found)
+ {
+ HMI_SEQ_ERROR(req_num, "Action not found");
+ return WMError::LAYOUT_CHANGE_FAIL;
+ }
+
+ struct LayoutState state;
+ std::vector<std::string> areas;
+ bool state_change = false;
+
+ for(const auto &action : actions)
+ {
+ if(action.visible)
+ {
+ // visible == true -> layout changes
+ areas.push_back(action.area);
+ auto client = g_app_list.lookUpClient(action.appid);
+ if(action.area == "normal.full" || action.area == "split.main")
+ {
+ state.main = (int)client->surfaceID(action.role);
+ }
+ else if(action.role == "split.sub")
+ {
+ state.sub = (int)client->surfaceID(action.role);
+ }
+ state_change = true;
+ }
+ }
+
+ if(state_change)
+ {
+ auto trigger = g_app_list.getRequest(req_num, &found);
+ auto client = g_app_list.lookUpClient(trigger.appid);
+ auto pCurState = *this->layers.get_layout_state((int)client->surfaceID(trigger.role));
+ struct LayoutState &curState = *pCurState;
+ curState = state;
+ }
+
+ return WMError::SUCCESS;
+}
+
void App::api_enddraw(char const *appid, char const *drawing_name)
{
std::string id = appid;
@@ -1440,8 +1489,11 @@ void App::activate(int id)
char const *label =
this->lookup_name(id).value_or("unknown-name").c_str();
- // FOR CES DEMO >>>
- if ((0 == strcmp(label, "Radio")) || (0 == strcmp(label, "MediaPlayer")) || (0 == strcmp(label, "Music")) || (0 == strcmp(label, "Navigation")))
+ // FOR CES DEMO >>>
+ if ((0 == strcmp(label, "Radio")) ||
+ (0 == strcmp(label, "MediaPlayer")) ||
+ (0 == strcmp(label, "Music")) ||
+ (0 == strcmp(label, "Navigation")))
{
for (auto i = surface_bg.begin(); i != surface_bg.end(); ++i)
{
diff --git a/src/app.hpp b/src/app.hpp
index 74361a2..04caf12 100644
--- a/src/app.hpp
+++ b/src/app.hpp
@@ -274,8 +274,10 @@ struct App
WMError layoutChange(const WMAction &action);
WMError visibilityChange(const WMAction &action);
WMError setSurfaceSize(unsigned surface, const std::string& area);
+ WMError changeCurrentState(unsigned req_num);
- void setTimer();
+ void
+ setTimer();
void stopTimer();
void processNextRequest();