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/applist.cpp | 4 ++-- src/applist.hpp | 3 +-- src/window_manager.cpp | 38 +++++++++++++++++++++----------------- src/wm_client.cpp | 17 +++++++---------- src/wm_client.hpp | 3 +-- src/wm_layer.hpp | 6 +++--- 6 files changed, 35 insertions(+), 36 deletions(-) diff --git a/src/applist.cpp b/src/applist.cpp index 93c90ac..e27bd03 100644 --- a/src/applist.cpp +++ b/src/applist.cpp @@ -73,10 +73,10 @@ void AppList::addClient(const string &appid, unsigned layer, unsigned surface, c this->clientDump(); } -void AppList::addClient(const string &appid, unsigned layer, const string& layer_name, unsigned surface, const string &role) +void AppList::addClient(const string &appid, unsigned layer, const string &role) { std::lock_guard lock(this->mtx); - shared_ptr client = std::make_shared(appid, layer, layer_name, surface, role); + shared_ptr client = std::make_shared(appid, layer, role); this->app2client[appid] = client; this->clientDump(); } diff --git a/src/applist.hpp b/src/applist.hpp index 1bc27c6..98ce1b8 100644 --- a/src/applist.hpp +++ b/src/applist.hpp @@ -51,8 +51,7 @@ class AppList */ void addClient(const std::string &appid, unsigned layer, unsigned surface, const std::string &role); - void addClient(const std::string &appid, unsigned layer, - const std::string& layer_name, unsigned surface, const std::string &role); + void addClient(const std::string &appid, unsigned layer, const std::string &role); void removeClient(const std::string &appid); bool contains(const std::string &appid) const; int countClient() const; 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 diff --git a/src/wm_client.cpp b/src/wm_client.cpp index 3bc2d31..0f78f9f 100644 --- a/src/wm_client.cpp +++ b/src/wm_client.cpp @@ -71,12 +71,14 @@ WMClient::WMClient(const string &appid, const string &role) } } -WMClient::WMClient(const string &appid, unsigned layer, - const string& layer_name, unsigned surface, const string &role) - : id(appid), layer(layer), wm_layer_name(layer_name), - role2surface(0) +WMClient::WMClient(const string &appid, unsigned layer, const string &role) + : id(appid), + layer(layer), + main_role(role), + role2surface(0), + evname2afb_event(0) { - role2surface[role] = surface; + role2surface[role] = INVALID_SURFACE_ID; for (auto x : kWMEvents) { #if GTEST_ENABLED @@ -129,11 +131,6 @@ unsigned WMClient::surfaceID() const return this->surface; } -const string& WMClient::getWMLayerName() -{ - return this->wm_layer_name; -} - void WMClient::setRole(const string& role) { this->role_list.clear(); diff --git a/src/wm_client.hpp b/src/wm_client.hpp index c78d6f9..4bc9421 100644 --- a/src/wm_client.hpp +++ b/src/wm_client.hpp @@ -42,6 +42,7 @@ class WMClient WMClient(const std::string &appid, unsigned layer, unsigned surface, const std::string &role); WMClient(const std::string &appid, const std::string &role); + WMClient(const std::string &appid, unsigned layer, const std::string &role); WMClient(const std::string &appid, unsigned layer, const std::string& layer_name, unsigned surface, const std::string &role); ~WMClient() = default; @@ -49,7 +50,6 @@ class WMClient std::string appID() const; unsigned surfaceID(const std::string &role) const; unsigned layerID() const; - const std::string& getWMLayerName(); unsigned surfaceID() const; std::vector renderOrder() const; std::string role(unsigned surface) const; @@ -71,7 +71,6 @@ class WMClient private: std::string id; unsigned layer; - std::string wm_layer_name; std::string main_role; std::string area; unsigned surface; // currently, main application has only one surface. diff --git a/src/wm_layer.hpp b/src/wm_layer.hpp index 2a5f9bd..1cb54ee 100644 --- a/src/wm_layer.hpp +++ b/src/wm_layer.hpp @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef WM_LAYERS_H -#define WM_LAYERS_H +#ifndef WM_LAYER_HPP +#define WM_LAYER_HPP #include #include @@ -83,4 +83,4 @@ class WMLayer } // namespace wm -#endif // WM_LAYERS_H +#endif // WM_LAYER_HPP -- cgit 1.2.3-korg