aboutsummaryrefslogtreecommitdiffstats
path: root/src/window_manager.cpp
diff options
context:
space:
mode:
authorKazumasa Mitsunari <knimitz@witz-inc.co.jp>2018-09-12 17:46:01 +0900
committerKazumasa Mitsunari <knimitz@witz-inc.co.jp>2018-09-12 17:46:01 +0900
commitbbe3c614c8ed8e54586f2f70dcb95d771e2a7d22 (patch)
tree3b831cde3e471dcb527ff0e0b2151cc118086af3 /src/window_manager.cpp
parentec3cf2a4ba6c5c7be5db13b0e950b2869c50e99c (diff)
Fix requestSurfaceXDG
Signed-off-by: Kazumasa Mitsunari <knimitz@witz-inc.co.jp>
Diffstat (limited to 'src/window_manager.cpp')
-rw-r--r--src/window_manager.cpp45
1 files changed, 29 insertions, 16 deletions
diff --git a/src/window_manager.cpp b/src/window_manager.cpp
index 1ab0291..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 */
}
}