From 1b1051702003391f958f4bf68c5dfe88676d56d4 Mon Sep 17 00:00:00 2001 From: Kazumasa Mitsunari Date: Fri, 7 Sep 2018 11:27:06 +0900 Subject: Remove wm_layer_name in wm_client Change-Id: I6b146ca41f9be311d0d21163e5fe23aeabbfe3fc Signed-off-by: Kazumasa Mitsunari --- src/window_manager.cpp | 38 +++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 17 deletions(-) (limited to 'src/window_manager.cpp') diff --git a/src/window_manager.cpp b/src/window_manager.cpp index fc333d4..a924ab5 100644 --- a/src/window_manager.cpp +++ b/src/window_manager.cpp @@ -260,25 +260,31 @@ result WindowManager::api_request_surface(char const *appid, char const *dr // so convert role old to new const char *role = this->convertRoleOldToNew(drawing_name); string l_name; + string s_appid = appid; + string s_role = drawing_name; - // auto lid = this->layers.get_layer_id(string(role)); - unsigned l_id = this->lc->getNewLayerID(role, &l_name); - if (l_id == 0) + if(!g_app_list.contains(s_appid)) { - /** - * register drawing_name as fallback and make it displayed. - */ - // lid = this->layers.get_layer_id(string("fallback")); - l_id = this->lc->getNewLayerID("fallback", &l_name); - HMI_DEBUG("%s is not registered in layers.json, then fallback as normal app", role); + // auto lid = this->layers.get_layer_id(string(role)); + unsigned l_id = this->lc->getNewLayerID(s_role, &l_name); if (l_id == 0) { - return Err("Designated role does not match any role, fallback is disabled"); + /** + * register drawing_name as fallback and make it displayed. + */ + // lid = this->layers.get_layer_id(string("fallback")); + l_id = this->lc->getNewLayerID("fallback", &l_name); + HMI_DEBUG("%s is not registered in layers.json, then fallback as normal app", role); + if (l_id == 0) + { + return Err("Designated role does not match any role, fallback is disabled"); + } } + this->lc->createNewLayer(l_id); + // add client into the db + g_app_list.addClient(s_appid, l_id, s_role); } - this->lc->createNewLayer(l_id); - // generate surface ID for ivi-shell application auto rname = this->id_alloc.lookup(string(role)); @@ -296,9 +302,7 @@ result WindowManager::api_request_surface(char const *appid, char const *dr // HMI_DEBUG("Set main_surface id to %u", id); // } - // add client into the db - string appid_str(appid); - g_app_list.addClient(appid_str, l_id, l_name, id, string(role)); + /* if(g_app_list.contains(appid_str)) { @@ -366,7 +370,7 @@ char const *WindowManager::api_request_surface(char const *appid, char const *dr // add client into the db string appid_str(appid); - g_app_list.addClient(appid_str, lid, l_name, sid, string(role)); + g_app_list.addClient(appid_str, lid, string(role)); // Set role map of (new, old) this->rolenew2old[role] = string(drawing_name); @@ -434,7 +438,7 @@ bool WindowManager::api_set_role(char const *appid, char const *drawing_name, un else{ HMI_INFO("Create new client: %s, surface: %d into layer: %d with role: %s", id.c_str(), surface, lid, role.c_str()); - g_app_list.addClient(id, lid, l_name, surface, role); + g_app_list.addClient(id, lid, role); } // register pair drawing_name and ivi_id -- cgit 1.2.3-korg