X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fwindow_manager.cpp;h=58ae4bcf0d0b475b55ec464f67063c11cf43c232;hb=7f262e8a9781d060b0a59dd45c92d59aef85b474;hp=2a50e7633fa1fbca3db636cc431cddd0d0abb2d2;hpb=03a040ad80c40cca33b0dc21e50bddf7d72689c1;p=apps%2Fagl-service-windowmanager.git diff --git a/src/window_manager.cpp b/src/window_manager.cpp index 2a50e76..58ae4bc 100644 --- a/src/window_manager.cpp +++ b/src/window_manager.cpp @@ -200,32 +200,43 @@ char const *WindowManager::api_request_surface(char const *appid, char const *dr // TODO: application requests by old role, // so convert role old to new const char *role = this->convertRoleOldToNew(drawing_name); - string str = role; + string s_role = role; + string s_appid = appid; string l_name; - // auto lid = this->layers.get_layer_id(string(role)); - unsigned lid = this->lc->getNewLayerID(str, &l_name); - unsigned sid = std::stol(ivi_id); - - if (lid == 0) + if(!g_app_list.contains(s_appid)) { - //register drawing_name as fallback and make it displayed. - lid = this->lc->getNewLayerID(str, &l_name); - HMI_DEBUG("%s is not registered in layers.json, then fallback as normal app", role); - if (lid == 0) + // auto lid = this->layers.get_layer_id(string(role)); + unsigned l_id = this->lc->getNewLayerID(s_role, &l_name); + if (l_id == 0) { - return "Drawing name does not match any role, fallback is disabled"; + /** + * register drawing_name as fallback and make it displayed. + */ + 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 "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(lid); - - auto rname = this->id_alloc.lookup(str); + unsigned sid = std::stol(ivi_id); + auto rname = this->id_alloc.lookup(s_role); if (rname) { return "Surface already present"; } + if(this->tmp_surface2app.count(sid) != 0) + { + this->tmp_surface2app.erase(sid); + } + // register pair drawing_name and ivi_id this->id_alloc.register_name_id(role, sid); @@ -238,8 +249,9 @@ char const *WindowManager::api_request_surface(char const *appid, char const *dr // this->layout_commit(); // add client into the db - string appid_str(appid); - g_app_list.addClient(appid_str, lid, string(role)); + // g_app_list.addClient(appid_str, lid, s_role); + auto client = g_app_list.lookUpClient(s_appid); + client->addSurface(sid); // Set role map of (new, old) this->rolenew2old[role] = string(drawing_name); @@ -565,6 +577,7 @@ void WindowManager::surface_created(uint32_t surface_id) else { HMI_NOTICE("Unknown surface %d", surface_id); + this->tmp_surface2app[surface_id] = ""; /* Store for requestSurfaceXDG */ } } @@ -883,6 +896,9 @@ WMError WindowManager::startTransition(unsigned req_num) for (const auto &x : actions) { this->lc->visibilityChange(x); + string old_role = this->rolenew2old[x.role]; + emit_deactivated(old_role.c_str()); + /* if (g_app_list.contains(x.appid)) { auto client = g_app_list.lookUpClient(x.appid); @@ -923,6 +939,18 @@ WMError WindowManager::doEndDraw(unsigned req_num) return ret; } ret = this->lc->visibilityChange(act); + + // Emit active/deactive event + string old_role = this->rolenew2old[act.role]; + if(act.visible == VISIBLE) + { + emit_activated(old_role.c_str()); + } + else + { + emit_deactivated(old_role.c_str()); + } + if (ret != WMError::SUCCESS) { HMI_SEQ_WARNING(req_num,