diff options
author | 2018-09-07 14:09:19 +0900 | |
---|---|---|
committer | 2018-09-07 14:09:19 +0900 | |
commit | a13afdbe2af9815f4b4c2073d30a0ebc40a296b7 (patch) | |
tree | 62640eeeb4d7bb74ba0fe35ab3cb64628286fe31 /src | |
parent | 1b1051702003391f958f4bf68c5dfe88676d56d4 (diff) |
addSurface to client
Change-Id: I2f09a94893699fc73bc82ac2caad5a9e282405b3
Signed-off-by: Kazumasa Mitsunari <knimitz@witz-inc.co.jp>
Diffstat (limited to 'src')
-rw-r--r-- | src/window_manager.cpp | 13 | ||||
-rw-r--r-- | src/window_manager.hpp | 1 | ||||
-rw-r--r-- | src/wm_client.cpp | 15 | ||||
-rw-r--r-- | 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<int> 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<int> surface_bg; + std::unordered_map<unsigned, std::string> 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 <json-c/json.h> #include "wm_client.hpp" #include "util.hpp" +#include <ilm/ilm_control.h> #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<std::string> &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); |