}
auto client = g_app_list.lookUpClient(id);
- unsigned srfc = client->surfaceID(role);
- if(srfc == 0)
- {
- HMI_ERROR("role sould be set with surface");
- reply("role sould be set with surface");
- return;
- }
- g_app_list.removeFloatingSurface(client->surfaceID());
+ // unsigned srfc = client->surfaceID(role);
+ // unsigned layer = client->layerID();
+
+ // g_app_list.removeFloatingSurface(client->surfaceID());
+ // g_app_list.removeFloatingSurface(client);
Task task = Task::TASK_ALLOCATE;
unsigned req_num = 0;
if(!g_app_list.contains(act.appid)){
ret = WMError::NOT_REGISTERED;
}
- ret = this->layoutChange(act);
+ ret = this->lc->layoutChange(act);
if(ret != WMError::SUCCESS)
{
HMI_SEQ_WARNING(req_num,
"Failed to manipulate surfaces while state change : %s", errorDescription(ret));
return ret;
}
- ret = this->visibilityChange(act);
+ ret = this->lc->visibilityChange(act);
if (ret != WMError::SUCCESS)
{
HMI_SEQ_WARNING(req_num,
//this->lc_enddraw(act.role.c_str());
}
}
- this->layout_commit();
+ this->lc->commitChange();
HMI_SEQ_INFO(req_num, "emit flushDraw");
#include <unistd.h>\r
#include "wm_layer_control.hpp"\r
#include "wm_layer.hpp"\r
+#include "wm_client.hpp"\r
+#include "request.hpp"\r
#include "json_helper.hpp"\r
\r
#define LC_AREA_PATH "/etc/areas.db"\r
\r
using std::string;\r
using std::vector;\r
+using std::shared_ptr;\r
\r
namespace wm {\r
\r
return WMError::SUCCESS;\r
}\r
\r
+WMError LayerControl::layoutChange(const WMAction& action)\r
+{\r
+ WMError ret = WMError::FAIL;\r
+ if (action.visible == TaskVisible::INVISIBLE)\r
+ {\r
+ // Visibility is not change -> no redraw is required\r
+ return WMError::SUCCESS;\r
+ }\r
+ if(action.client == nullptr)\r
+ {\r
+ HMI_SEQ_ERROR(action.req_num, "client may vanish");\r
+ return WMError::NOT_REGISTERED;\r
+ }\r
+ unsigned layer = action.client->layerID();\r
+\r
+ // Layout Manager\r
+ // WMError ret = this->setLayerSize(layer, action.area);\r
+ auto rect = this->getAreaSize(action.area);\r
+ ilmErrorTypes err = ilm_layerSetDestinationRectangle(layer, rect.x, rect.y, rect.w, rect.h);\r
+ if(err == ILM_SUCCESS)\r
+ {\r
+ ret = WMError::SUCCESS;\r
+ }\r
+ return ret;\r
+}\r
+\r
+WMError LayerControl::visibilityChange(const WMAction& action)\r
+{\r
+ WMError ret = WMError::FAIL;\r
+ if(action.client == nullptr)\r
+ {\r
+ HMI_SEQ_ERROR(action.req_num, "client may vanish");\r
+ return WMError::NOT_REGISTERED;\r
+ }\r
+\r
+ if (action.visible != TaskVisible::INVISIBLE)\r
+ {\r
+ ret = this->makeVisible(action.client);\r
+ }\r
+ else\r
+ {\r
+ ret = this->makeInvisible(action.client);\r
+ }\r
+ return ret;\r
+}\r
+\r
void LayerControl::dispatchCreateEvent(ilmObjectType object, unsigned id, bool created)\r
{\r
this->cb.test(id);\r
}\r
}\r
\r
+WMError LayerControl::makeVisible(const shared_ptr<WMClient> client)\r
+{\r
+ WMError ret = WMError::FAIL;\r
+ // Don't check here the client is not nullptr\r
+ unsigned layer = client->layerID();\r
+ bool contains;// = this->checkBackGround(action.client->role());\r
+ if(contains)\r
+ {\r
+ shared_ptr<WMLayer> l;\r
+ // Move background from back ground layer\r
+ for(const auto& wm_layer : this->wm_layers)\r
+ {\r
+ if(wm_layer->layerName() == "BackGroundLayer")\r
+ {\r
+ //wm_layer.removeLayer(layer);\r
+ }\r
+ else\r
+ {\r
+ if(wm_layer->checkIDBelongTo(layer))\r
+ {\r
+ l = wm_layer;\r
+ }\r
+ }\r
+ }\r
+ if(l != nullptr)\r
+ {\r
+ // make invisible first\r
+ ilm_layerSetVisibility(layer, 0);\r
+ ilm_commitChanges();\r
+ //l->addLayer(layer);\r
+ }\r
+ }\r
+ for(const auto& wm_layer : this->wm_layers)\r
+ {\r
+ // make visible\r
+ //l->makeVisible(layer);\r
+ }\r
+\r
+ return ret;\r
+}\r
+\r
+WMError LayerControl::makeInvisible(const shared_ptr<WMClient> client)\r
+{\r
+ WMError ret = WMError::FAIL;\r
+ // Don't check here the client is not nullptr\r
+ unsigned layer = client->layerID();\r
+ bool contains;// = this->checkBackGround(client->role());\r
+ if(contains)\r
+ {\r
+ // Pop from background\r
+ }\r
+ else\r
+ {\r
+\r
+ }\r
+ return ret;\r
+}\r
} // namespace wm
\ No newline at end of file
\r
class WMLayer;\r
class LayerState;\r
+class WMAction;\r
+class WMClient;\r
+\r
class LayerControl\r
{\r
public:\r
WMError updateLayer(LayerState& layer_state);\r
WMError commitChange();\r
void undoUpdate();\r
+ WMError layoutChange(const WMAction& action);\r
+ WMError visibilityChange(const WMAction &action);\r
\r
// Don't use this function.\r
void dispatchCreateEvent(ilmObjectType object, unsigned id, bool created);\r
void dispatchPropertyChangeEvent(unsigned id, struct ilmSurfaceProperties*, t_ilm_notification_mask);\r
void dispatchPropertyChangeEvent(unsigned id, struct ilmLayerProperties*, t_ilm_notification_mask);\r
private:\r
+ WMError makeVisible(const std::shared_ptr<WMClient> client);\r
+ WMError makeInvisible(const std::shared_ptr<WMClient> client);\r
WMError loadLayerSetting(const std::string& path);\r
WMError loadAreaDb(const std::string& path);\r
\r