X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fwm_client.cpp;h=f2ad7be467a0d59708683c959ce3925ea438eaa9;hb=b9da444f98dd5075dcda05932c47c732a5ae230f;hp=691c3cb36e7a6620a1e1eded7ccea00c0a9a5503;hpb=bb6647d071a188defa2a36b8aead23d48f7df85d;p=apps%2Fagl-service-windowmanager.git diff --git a/src/wm_client.cpp b/src/wm_client.cpp index 691c3cb..f2ad7be 100644 --- a/src/wm_client.cpp +++ b/src/wm_client.cpp @@ -18,6 +18,8 @@ #include "wm_client.hpp" #include "util.hpp" #include +#include + #define INVALID_SURFACE_ID 0 @@ -139,6 +141,88 @@ bool WMClient::removeSurfaceIfExist(unsigned surface) this->surface = INVALID_SURFACE_ID; ret = true; } + else + { + for(auto &x : this->service2surfaces) + { + if(x.second = surface) + { + ret = true; + string key = x.first; + this->service2surfaces.erase(key); + this->service2supplier.erase(key); + } + } + } + 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; +} + +string WMClient::attachTmpServiceSurface(const string& supplier, const string& service_surface) +{ + string uuid; + uuid_t u; + char out[37]; // uuid is 36 characters + uuid_generate_random(u); + uuid_unparse(u, out); + uuid = out; + this->service2supplier.emplace(service_surface, supplier); + return uuid; +} + +WMError WMClient::attachServiceSurface(const string& service_surface, unsigned surface) +{ + WMError ret = WMError::NOT_REGISTERED; + if(this->service2supplier.count(service_surface) != 0) + { + this->service2surfaces.emplace(service_surface, surface); + ret = WMError::SUCCESS; + } return ret; }