diff options
author | Kazumasa Mitsunari <knimitz@witz-inc.co.jp> | 2018-08-10 15:15:16 +0900 |
---|---|---|
committer | Kazumasa Mitsunari <knimitz@witz-inc.co.jp> | 2018-08-10 15:15:16 +0900 |
commit | 1a23bad65e9825a143c716f1e148dc7fcedf028d (patch) | |
tree | 174752549b5d8a5ac05dfa88c0f89db1dbd8ca2b | |
parent | 69bcb135b8785c76320e103be1ed92e860352e73 (diff) |
Move to launcher when the top application is terminated
* Re-activate top surface when under app is terminated, but not works well...
Change-Id: Ia2c70bb2d042e023fb3b39141df9e5b4ba0fc0dd
Signed-off-by: Kazumasa Mitsunari <knimitz@witz-inc.co.jp>
-rw-r--r-- | src/window_manager.cpp | 41 |
1 files changed, 38 insertions, 3 deletions
diff --git a/src/window_manager.cpp b/src/window_manager.cpp index aa9a459..e785e4b 100644 --- a/src/window_manager.cpp +++ b/src/window_manager.cpp @@ -37,6 +37,7 @@ const char kNameLayoutSplit[] = "split"; const char kNameAreaFull[] = "full"; const char kNameAreaMain[] = "main"; const char kNameAreaSub[] = "sub"; +const char kNameAreaDefault[] = "normal.full"; /* Key for json obejct */ const char kKeyDrawingName[] = "drawing_name"; @@ -626,14 +627,23 @@ void WindowManager::onApplicationTerminated(const WMClientCtxt& ctxt) { return; } + struct LayoutState priv; + bool found = false; auto client = g_app_list.lookUpClient(ctxt.name); unsigned sid = client->surfaceID(ctxt.role); - if (sid != 0) + if(sid == 0) { + auto pSid = this->id_alloc.lookup(ctxt.role.c_str()); + if(pSid) { + sid = *pSid; + } + } + // reset state + if(sid != 0) { - // update state auto o_state = *this->layers.get_layout_state(sid); if (o_state != nullptr) { + priv = *o_state; if (o_state->main == sid) { o_state->main = -1; @@ -645,8 +655,33 @@ void WindowManager::onApplicationTerminated(const WMClientCtxt& ctxt) } this->id_alloc.remove_id(sid); this->layers.remove_surface(sid); - HMI_DEBUG("wm", "delete surfaceID %d", sid); + HMI_INFO("wm", "delete surfaceID %d", sid); + } + + // Recovery Phase + if(priv.main == sid) + { + HMI_DEBUG("wm", "go to launcher"); + if(ctxt.role != "launcher") + { + // goto launcher + auto pSid = this->id_alloc.lookup("launcher"); + std::string app = g_app_list.getAppID(*pSid, "launcher", &found); + if(found) + { + this->api_activate_surface(app.c_str(), "launcher", kNameAreaDefault, + [](const char*){}); + } + } + } + else if(priv.main != sid && priv.sub != sid) + { + // re-show top surface + this->deactivate(priv.main); + this->activate(priv.main); + this->layout_commit(); } + else {} g_app_list.removeClient(ctxt.name); } |