From a13afdbe2af9815f4b4c2073d30a0ebc40a296b7 Mon Sep 17 00:00:00 2001 From: Kazumasa Mitsunari Date: Fri, 7 Sep 2018 14:09:19 +0900 Subject: addSurface to client Change-Id: I2f09a94893699fc73bc82ac2caad5a9e282405b3 Signed-off-by: Kazumasa Mitsunari --- src/window_manager.cpp | 13 +++++++++++++ src/window_manager.hpp | 1 + src/wm_client.cpp | 15 ++++++++++++++- src/wm_client.hpp | 3 ++- 4 files changed, 30 insertions(+), 2 deletions(-) diff --git a/src/window_manager.cpp b/src/window_manager.cpp index a924ab5..7ee9dbd 100644 --- a/src/window_manager.cpp +++ b/src/window_manager.cpp @@ -292,6 +292,8 @@ result WindowManager::api_request_surface(char const *appid, char const *dr { // name does not exist yet, allocate surface id... auto id = int(this->id_alloc.generate_id(role)); + this->tmp_surface2app[id] = s_appid; + // this->layers.add_surface(id, *lid); // set the main_surface[_name] here and now @@ -732,6 +734,17 @@ void WindowManager::send_event(char const *evname, char const *label, char const void WindowManager::surface_created(uint32_t surface_id) { HMI_DEBUG("current : %d", surface_id); + if(this->tmp_surface2app.count(surface_id) != 0) + { + string appid = this->tmp_surface2app[surface_id]; + this->tmp_surface2app.erase(surface_id); + auto client = g_app_list.lookUpClient(appid); + bool ret = client->addSurface(surface_id); + if(!ret) + { + HMI_ERROR("Failed to add surface to client %s", client->appID().c_str()); + } + } /* this->controller->get_surface_properties(surface_id, IVI_WM_PARAM_SIZE); auto layer_id = this->layers.get_layer_id(surface_id); diff --git a/src/window_manager.hpp b/src/window_manager.hpp index f3b3c64..189d249 100644 --- a/src/window_manager.hpp +++ b/src/window_manager.hpp @@ -266,6 +266,7 @@ class WindowManager rect_map area_info; // FOR CES DEMO std::vector surface_bg; + std::unordered_map tmp_surface2app; static const char* kDefaultOldRoleDb; }; diff --git a/src/wm_client.cpp b/src/wm_client.cpp index 0f78f9f..500c60e 100644 --- a/src/wm_client.cpp +++ b/src/wm_client.cpp @@ -17,6 +17,7 @@ #include #include "wm_client.hpp" #include "util.hpp" +#include #define INVALID_SURFACE_ID 0 @@ -155,7 +156,7 @@ void WMClient::appendRole(const string& role) * @param unsigned[in] surface * @return true */ -bool WMClient::addSurface(const string &role, unsigned surface) +/* bool WMClient::addSurface(const string &role, unsigned surface) { HMI_DEBUG("Add role %s with surface %d", role.c_str(), surface); if (0 != this->role2surface.count(role)) @@ -164,6 +165,18 @@ bool WMClient::addSurface(const string &role, unsigned surface) } this->role2surface[role] = surface; return true; +} */ + +bool WMClient::addSurface(unsigned surface) +{ + this->surface = surface; + ilmErrorTypes err = ilm_layerAddSurface(this->layer, surface); + + if(err == ILM_SUCCESS) + { + err = ilm_commitChanges(); + } + return (err == ILM_SUCCESS) ? true : false; } bool WMClient::removeSurfaceIfExist(unsigned surface) diff --git a/src/wm_client.hpp b/src/wm_client.hpp index 4bc9421..7c6c0b4 100644 --- a/src/wm_client.hpp +++ b/src/wm_client.hpp @@ -57,7 +57,8 @@ class WMClient const std::vector &roles() const; void setRole(const std::string& role); void appendRole(const std::string& role); - bool addSurface(const std::string& role, unsigned surface); + //bool addSurface(const std::string& role, unsigned surface); + bool addSurface(unsigned surface); bool removeSurfaceIfExist(unsigned surface); bool removeRole(const std::string& role); -- cgit 1.2.3-korg