aboutsummaryrefslogtreecommitdiffstats
path: root/src/app.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/app.cpp')
-rw-r--r--src/app.cpp47
1 files changed, 31 insertions, 16 deletions
diff --git a/src/app.cpp b/src/app.cpp
index 0976a19..6689148 100644
--- a/src/app.cpp
+++ b/src/app.cpp
@@ -319,7 +319,7 @@ int App::init_layers()
return 0;
}
-void App::surface_set_layout(int surface_id, optional<int> sub_surface_id)
+void App::surface_set_layout(int surface_id, const std::string& area)
{
if (!this->controller->surface_exists(surface_id))
{
@@ -338,7 +338,7 @@ void App::surface_set_layout(int surface_id, optional<int> sub_surface_id)
uint32_t layer_id = *o_layer_id;
auto const &layer = this->layers.get_layer(layer_id);
- auto rect = layer.value().rect;
+ auto rect = this->layers.getAreaSize(area);
auto &s = this->controller->surfaces[surface_id];
int x = rect.x;
@@ -754,12 +754,12 @@ WMError App::setInvisibleTask(const std::string &role, bool split)
deact_sub.appid = g_app_list.getAppID(state.sub, main, &found);
if (!found)
{
- HMI_SEQ_DEBUG(req, "sub surface ddoesn't exist");
+ HMI_SEQ_DEBUG(req, "sub surface doesn't exist");
return WMError::NOT_REGISTERED;
}
deact_sub.visible = task_visible;
deact_sub.end_draw_finished = end_draw_finished;
- HMI_SEQ_DEBUG(req, "sub surface ddoesn't exist");
+ HMI_SEQ_DEBUG(req, "sub surface doesn't exist");
g_app_list.setAction(req, deact_sub);
}
}
@@ -1062,7 +1062,7 @@ WMError App::doEndDraw(unsigned req_num)
WMError App::setSurfaceSize(unsigned surface, const std::string &area)
{
- this->surface_set_layout(surface);
+ this->surface_set_layout(surface, area);
return WMError::SUCCESS;
}
@@ -1089,6 +1089,10 @@ WMError App::layoutChange(const WMAction &action)
WMError App::visibilityChange(const WMAction &action)
{
+ HMI_SEQ_DEBUG(g_app_list.currentRequestNumber(), "Change visibility");
+ if(!g_app_list.contains(action.appid)){
+ return WMError::NOT_REGISTERED;
+ }
auto client = g_app_list.lookUpClient(action.appid);
unsigned surface = client->surfaceID(action.role);
if(surface == 0)
@@ -1111,13 +1115,10 @@ WMError App::visibilityChange(const WMAction &action)
WMError App::changeCurrentState(unsigned req_num)
{
- HMI_SEQ_DEBUG(req_num, "Change current layout status");
+ HMI_SEQ_DEBUG(req_num, "Change current layout state");
bool trigger_found = false, action_found = false;
auto trigger = g_app_list.getRequest(req_num, &trigger_found);
auto actions = g_app_list.getActions(req_num, &action_found);
- //auto client = g_app_list.lookUpClient(trigger.appid);
- //auto pCurState = *this->layers.get_layout_state((int)client->surfaceID(trigger.role));
- //pCurState = state;
if (!trigger_found || !action_found)
{
HMI_SEQ_ERROR(req_num, "Action not found");
@@ -1126,25 +1127,39 @@ WMError App::changeCurrentState(unsigned req_num)
// Layout state reset
struct LayoutState reset_state{-1, -1};
- HMI_SEQ_DEBUG(req_num."Reset layout state");
+ HMI_SEQ_DEBUG(req_num,"Reset layout state");
for (const auto &action : actions)
{
+ if(!g_app_list.contains(action.appid)){
+ return WMError::NOT_REGISTERED;
+ }
auto client = g_app_list.lookUpClient(trigger.appid);
auto pCurState = *this->layers.get_layout_state((int)client->surfaceID(trigger.role));
- *pCurState = reset_state;
+ if(pCurState == nullptr)
+ {
+ HMI_SEQ_ERROR(req_num, "Counldn't find current status");
+ continue;
+ }
+ pCurState->main = reset_state.main;
+ pCurState->sub = reset_state.sub;
}
- for(const auto &action : actions)
+ HMI_SEQ_DEBUG(req_num, "Change state");
+ for (const auto &action : actions)
{
auto client = g_app_list.lookUpClient(action.appid);
- auto pLayerCurState = *this->layers.get_layout_state((int)client->surfaceID(trigger.role));
- int surface = -1;
- if(action.visible != TaskVisible::INVISIBLE)
+ auto pLayerCurState = *this->layers.get_layout_state((int)client->surfaceID(action.role));
+ if (pLayerCurState == nullptr)
{
- surface = (int)client->surfaceID(action.role);
+ HMI_SEQ_ERROR(req_num, "Counldn't find current status");
+ continue;
}
+ int surface = -1;
+
if (action.visible != TaskVisible::INVISIBLE)
{
+ surface = (int)client->surfaceID(action.role);
+ HMI_SEQ_INFO(req_num, "Change %s state visible area : %s", action.role.c_str(), action.area.c_str());
// visible == true -> layout changes
if(action.area == "normal.full" || action.area == "split.main")
{