X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fwm_layer_control.cpp;h=9ac1ffce3cbb339c1781826ab0f467cd3f19d892;hb=b73c8310f2ca06b356135ef3a1b17e5cb6e2ec5d;hp=9c602866aeb581d4811845607247d538b5ade65d;hpb=a5106227c3c9ddbe2b07fbc2ecfc4e2ae1e4de74;p=apps%2Fagl-service-windowmanager.git diff --git a/src/wm_layer_control.cpp b/src/wm_layer_control.cpp index 9c60286..9ac1ffc 100644 --- a/src/wm_layer_control.cpp +++ b/src/wm_layer_control.cpp @@ -17,6 +17,8 @@ #include #include "wm_layer_control.hpp" #include "wm_layer.hpp" +#include "wm_client.hpp" +#include "request.hpp" #include "json_helper.hpp" #define LC_AREA_PATH "/etc/areas.db" @@ -25,6 +27,7 @@ using std::string; using std::vector; +using std::shared_ptr; namespace wm { @@ -319,6 +322,52 @@ WMError LayerControl::loadAreaDb(const std::string& path) return WMError::SUCCESS; } +WMError LayerControl::layoutChange(const WMAction& action) +{ + WMError ret = WMError::FAIL; + if (action.visible == TaskVisible::INVISIBLE) + { + // Visibility is not change -> no redraw is required + return WMError::SUCCESS; + } + if(action.client == nullptr) + { + HMI_SEQ_ERROR(action.req_num, "client may vanish"); + return WMError::NOT_REGISTERED; + } + unsigned layer = action.client->layerID(); + + // Layout Manager + // WMError ret = this->setLayerSize(layer, action.area); + auto rect = this->getAreaSize(action.area); + ilmErrorTypes err = ilm_layerSetDestinationRectangle(layer, rect.x, rect.y, rect.w, rect.h); + if(err == ILM_SUCCESS) + { + ret = WMError::SUCCESS; + } + return ret; +} + +WMError LayerControl::visibilityChange(const WMAction& action) +{ + WMError ret = WMError::FAIL; + if(action.client == nullptr) + { + HMI_SEQ_ERROR(action.req_num, "client may vanish"); + return WMError::NOT_REGISTERED; + } + + if (action.visible != TaskVisible::INVISIBLE) + { + ret = this->makeVisible(action.client); + } + else + { + ret = this->makeInvisible(action.client); + } + return ret; +} + void LayerControl::dispatchCreateEvent(ilmObjectType object, unsigned id, bool created) { this->cb.test(id); @@ -477,4 +526,61 @@ void LayerControl::dispatchPropertyChangeEvent(unsigned id, } } +WMError LayerControl::makeVisible(const shared_ptr client) +{ + WMError ret = WMError::FAIL; + // Don't check here the client is not nullptr + unsigned layer = client->layerID(); + bool contains;// = this->checkBackGround(action.client->role()); + if(contains) + { + shared_ptr l; + // Move background from back ground layer + for(const auto& wm_layer : this->wm_layers) + { + if(wm_layer->layerName() == "BackGroundLayer") + { + //wm_layer.removeLayer(layer); + } + else + { + if(wm_layer->checkIDBelongTo(layer)) + { + l = wm_layer; + } + } + } + if(l != nullptr) + { + // make invisible first + ilm_layerSetVisibility(layer, 0); + ilm_commitChanges(); + //l->addLayer(layer); + } + } + for(const auto& wm_layer : this->wm_layers) + { + // make visible + //l->makeVisible(layer); + } + + return ret; +} + +WMError LayerControl::makeInvisible(const shared_ptr client) +{ + WMError ret = WMError::FAIL; + // Don't check here the client is not nullptr + unsigned layer = client->layerID(); + bool contains;// = this->checkBackGround(client->role()); + if(contains) + { + // Pop from background + } + else + { + + } + return ret; +} } // namespace wm \ No newline at end of file