aboutsummaryrefslogtreecommitdiffstats
path: root/src/wm_layer_control.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/wm_layer_control.cpp')
-rw-r--r--src/wm_layer_control.cpp105
1 files changed, 105 insertions, 0 deletions
diff --git a/src/wm_layer_control.cpp b/src/wm_layer_control.cpp
index 9c60286..3f39d65 100644
--- a/src/wm_layer_control.cpp
+++ b/src/wm_layer_control.cpp
@@ -17,6 +17,8 @@
#include <unistd.h>
#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"
@@ -319,6 +321,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.get());
+ }
+ else
+ {
+ ret = this->makeInvisible(action.client.get());
+ }
+ return ret;
+}
+
void LayerControl::dispatchCreateEvent(ilmObjectType object, unsigned id, bool created)
{
this->cb.test(id);
@@ -477,4 +525,61 @@ void LayerControl::dispatchPropertyChangeEvent(unsigned id,
}
}
+WMError LayerControl::makeVisible(const WMClient* 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)
+ {
+ std::shared_ptr<WMLayer> 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 WMClient* 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