From b7957f3fc1e5f5ce0525d62c67da64457ef1d9e0 Mon Sep 17 00:00:00 2001 From: Kazumasa Mitsunari Date: Tue, 18 Sep 2018 12:24:58 +0900 Subject: Add setRenderOrder into WMClient Implement finishes but not tested Change-Id: I59929038c163c445b562e9d9f28516da57516339 Signed-off-by: Kazumasa Mitsunari --- src/window_manager.cpp | 6 ++++++ src/wm_client.cpp | 46 ++++++++++++++++++++++++++++++++++++++++++++++ src/wm_client.hpp | 1 + 3 files changed, 53 insertions(+) diff --git a/src/window_manager.cpp b/src/window_manager.cpp index a72f4a5..60470b4 100644 --- a/src/window_manager.cpp +++ b/src/window_manager.cpp @@ -505,6 +505,12 @@ void WindowManager::api_enddraw(char const *appid, char const *drawing_name) bool WindowManager::api_client_set_render_order(char const* appid, const vector& render_order) { bool ret = false; + string id = appid; + auto client = g_app_list.lookUpClient(id); + if(client) + { + client->setRenderOrder(render_order); + } return ret; } diff --git a/src/wm_client.cpp b/src/wm_client.cpp index 691c3cb..84f9842 100644 --- a/src/wm_client.cpp +++ b/src/wm_client.cpp @@ -142,6 +142,52 @@ bool WMClient::removeSurfaceIfExist(unsigned surface) return ret; } +WMError WMClient::setRenderOrder(const vector &order) +{ + WMError ret = WMError::SUCCESS; + this->surface_render_order.clear(); + for(const auto& x : order) + { + unsigned s; // surface + if(x == this->role()) + { + s = this->surfaceID(); + } + else if(this->service2surfaces.count(x) != 0) + { + s = this->service2surfaces[x]; + } + else + { + ret = WMError::NOT_REGISTERED; + break; + } + this->surface_render_order.push_back(s); + } + if(ret == WMError::SUCCESS) + { + int count = 0; + t_ilm_layer* id_array = new t_ilm_surface[this->surface_render_order.size()]; + if(id_array == nullptr) + { + HMI_WARNING("short memory"); + ret = WMError::FAIL; + } + else + { + for(const auto& i : this->surface_render_order) + { + id_array[count] = i; + ++count; + } + ilm_layerSetRenderOrder(this->layerID(), + id_array, this->surface_render_order.size()); + delete id_array; + } + } + return ret; +} + #if GTEST_ENABLED bool WMClient::subscribe(afb_req req, const string &evname) { diff --git a/src/wm_client.hpp b/src/wm_client.hpp index 40a0d1d..65c68b9 100644 --- a/src/wm_client.hpp +++ b/src/wm_client.hpp @@ -58,6 +58,7 @@ class WMClient bool removeSurfaceIfExist(unsigned surface); // bool removeRole(const std::string& role); std::vector renderOrder() const; + WMError setRenderOrder(const std::vector& order); #if GTEST_ENABLED bool subscribe(afb_req req, const std::string &event_name); -- cgit 1.2.3-korg