diff options
-rw-r--r-- | src/window_manager.cpp | 6 | ||||
-rw-r--r-- | src/wm_client.cpp | 46 | ||||
-rw-r--r-- | src/wm_client.hpp | 1 |
3 files changed, 53 insertions, 0 deletions
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<string>& 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<string> &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<unsigned> renderOrder() const; + WMError setRenderOrder(const std::vector<std::string>& order); #if GTEST_ENABLED bool subscribe(afb_req req, const std::string &event_name); |