this->layout_commit();
+ this->layers.setupArea(o->width, o->height);
+
return 0;
}
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)
/* 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;
for (const auto &y : actions)
{
- if (y.visible)
+ if (y.visible != TaskVisible::INVISIBLE)
{
sync_draw_happen = true;
this->emit_syncdraw(y.role, y.area);
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;
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;
}
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;
}
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);
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);
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);
}
}
}
-
return WMError::SUCCESS;
}
}
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
//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)
{
- if(act_flush.visible)
+ if(act_flush.visible != TaskVisible::INVISIBLE)
{
this->emit_flushdraw(act_flush.role.c_str());
}
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);
return WMError::NOT_REGISTERED;
}
- if (action.visible)
+ if (action.visible != TaskVisible::INVISIBLE)
{
this->activate(surface); // Layout Manager task
}
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 != TaskVisible::INVISIBLE)
+ {
+ // 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;
void App::emit_syncdraw(const std::string &role, const std::string &area)
{
- int x = 0, y = 0, w = 0, h = 0;
+ compositor::rect rect = this->layers.getAreaSize(area);
//this->lm_get_area_info(area, &x, &y, &w, &h);
this->send_event(kListEventName[Event_SyncDraw],
- role.c_str(), area.c_str(), x, y, w, h);
+ role.c_str(), area.c_str(), rect.x, rect.y, rect.w, rect.h);
}
void App::emit_flushdraw(char const *label)
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)
{