diff options
Diffstat (limited to 'src/app.cpp')
-rw-r--r-- | src/app.cpp | 163 |
1 files changed, 68 insertions, 95 deletions
diff --git a/src/app.cpp b/src/app.cpp index 48c6740..414e1fb 100644 --- a/src/app.cpp +++ b/src/app.cpp @@ -577,7 +577,8 @@ WMError App::checkPolicy(unsigned req_num) * Check Policy */ // get current trigger - bool found, split; + bool found = false; + bool split = false; WMError ret = WMError::LAYOUT_CHANGE_FAIL; auto trigger = g_app_list.getRequest(req_num, &found); if (!found) @@ -605,7 +606,7 @@ WMError App::checkPolicy(unsigned req_num) struct LayoutState &state = *o_state; unsigned curernt_sid = state.main; - bool split = this->can_split(state, *surface_id); + split = this->can_split(state, *surface_id); if (split) { @@ -772,120 +773,92 @@ WMError App::setInvisibleTask(const std::string &role, bool split) if (state.main == -1) { - this->try_layout( + HMI_DEBUG("wm", "Layout: %s", kNameLayoutNormal); + state = LayoutState{*surface_id}; + /* this->try_layout( state, LayoutState{*surface_id}, [&](LayoutState const &nl) { HMI_DEBUG("wm", "Layout: %s", kNameLayoutNormal); //this->surface_set_layout(*surface_id); state = nl; //compositor::rect area_rect = this->area_info[*surface_id]; - }); + }); */ } else { - if (0 == strcmp(drawing_name, "HomeScreen")) - { - // Nothing To do - this->try_layout( - state, LayoutState{*surface_id}, [&](LayoutState const &nl) { - HMI_DEBUG("wm", "Layout: %s", kNameLayoutNormal); - }); - } - else + if (0 != strcmp(drawing_name, "HomeScreen")) { if (split) { - this->try_layout( - state, - LayoutState{state.main, *surface_id}, - [&](LayoutState const &nl) { - HMI_DEBUG("wm", "Layout: %s", kNameLayoutSplit); - std::string main = - std::move(*this->id_alloc.lookup(state.main)); - if (state.sub != *surface_id) + std::string main = + std::move(*this->id_alloc.lookup(state.main)); + if (state.sub != *surface_id) + { + if (state.sub != -1) + { + //this->deactivate(state.sub); + WMAction deact_sub; + deact_sub.role = main; + deact_sub.area = add_area; + deact_sub.appid = g_app_list.getAppID(state.sub, main, &found); + if (!found) { - if (state.sub != -1) - { - //this->deactivate(state.sub); - WMAction deact_sub; - deact_sub.role = main; - deact_sub.area = add_area; - deact_sub.appid = g_app_list.getAppID(state.sub, main, &found); - if(!found){ - HMI_SEQ_DEBUG(req, "sub surface ddoesn't exist"); - return WMError::NOT_REGISTERED; - } - deact_sub.visible = 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; } - state = nl; - - /* std::string str_area_main = std::string(kNameLayoutSplit) + "." + std::string(kNameAreaMain); - std::string str_area_sub = std::string(kNameLayoutSplit) + "." + std::string(kNameAreaSub); - compositor::rect area_rect_main = this->area_info[state.main]; - compositor::rect area_rect_sub = this->area_info[*surface_id]; - // >>> HACK - HMI_WARNING("wm", "HACK!!! mediaplayer and hvac is only supported for split"); - std::string request_role = drawing_name; - //std::string request_app = transform(request_role.begin(), request_role.end(), request_role.begin(), tolower); //hvac or mediaplayer - std::string hack_appid = "navigation"; - std::string hack_role = main; - std::string hack_area = str_area_main; - //g_app_list.setAction(g_app_list.currentRequestNumber(), hack_appid, hack_role, hack_area, true); - // >>> HACK */ - }); + deact_sub.visible = 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); + } + } + state = LayoutState{state.main, *surface_id}; } else { - this->try_layout( - state, LayoutState{*surface_id}, [&](LayoutState const &nl) { - HMI_DEBUG("wm", "Layout: %s", kNameLayoutNormal); + HMI_DEBUG("wm", "Layout: %s", kNameLayoutNormal); - //this->surface_set_layout(*surface_id); - if (state.main != *surface_id) + //this->surface_set_layout(*surface_id); + if (state.main != *surface_id) + { + // this->deactivate(state.main); + WMAction deact_main; + deact_main.role = std::move(*this->id_alloc.lookup(state.main)); + ; + deact_main.area = add_area; + deact_main.appid = g_app_list.getAppID(state.main, deact_main.role, &found); + if (!found) + { + HMI_SEQ_DEBUG(req, "sub surface ddoesn't exist"); + return WMError::NOT_REGISTERED; + } + deact_main.visible = 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); + } + if (state.sub != -1) + { + if (state.sub != *surface_id) + { + //this->deactivate(state.sub); + WMAction deact_sub; + deact_sub.role = std::move(*this->id_alloc.lookup(state.sub)); + ; + deact_sub.area = add_area; + deact_sub.appid = g_app_list.getAppID(state.sub, deact_sub.role, &found); + if (!found) { - // this->deactivate(state.main); - WMAction deact_main; - deact_main.role = std::move(*this->id_alloc.lookup(state.main)); - ; - deact_main.area = add_area; - deact_main.appid = g_app_list.getAppID(state.main, deact_main.role, &found); - if (!found) - { - HMI_SEQ_DEBUG(req, "sub surface ddoesn't exist"); - return WMError::NOT_REGISTERED; - } - deact_main.visible = visible; - deact_main.end_draw_finished = end_draw_finished; HMI_SEQ_DEBUG(req, "sub surface ddoesn't exist"); - g_app_list.setAction(req, deact_main); + return WMError::NOT_REGISTERED; } - if (state.sub != -1) - { - if (state.sub != *surface_id) - { - //this->deactivate(state.sub); - WMAction deact_sub; - deact_sub.role = std::move(*this->id_alloc.lookup(state.sub)); - ; - deact_sub.area = add_area; - deact_sub.appid = g_app_list.getAppID(state.sub, deact_sub.role, &found); - if (!found) - { - HMI_SEQ_DEBUG(req, "sub surface ddoesn't exist"); - return WMError::NOT_REGISTERED; - } - deact_sub.visible = 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); - } - } - state = nl; - }); + deact_sub.visible = 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); + } + } + state = LayoutState{*surface_id}; } } } |