From 3a9996eb359accdbadb0e5eaa5259c910b7ae46a Mon Sep 17 00:00:00 2001 From: Kazumasa Mitsunari Date: Thu, 30 Aug 2018 21:00:53 +0900 Subject: temporary change Change-Id: I48618fd00e607176c95b4e3950fca7dbb058a3b1 Signed-off-by: Kazumasa Mitsunari --- layers_setting.json | 2 +- src/request.hpp | 3 ++ src/window_manager.cpp | 19 ++++----- src/wm_layer_control.cpp | 105 +++++++++++++++++++++++++++++++++++++++++++++++ src/wm_layer_control.hpp | 7 ++++ 5 files changed, 124 insertions(+), 12 deletions(-) diff --git a/layers_setting.json b/layers_setting.json index ed43288..7c55677 100644 --- a/layers_setting.json +++ b/layers_setting.json @@ -2,7 +2,7 @@ "description": "Layer mapping", "mappings": [ { - "name": "EvacuationLayer", + "name": "BackGroundLayer", "role" : "", "type" : "stack", "id_range_begin": 0, diff --git a/src/request.hpp b/src/request.hpp index 6b2bda1..84973de 100644 --- a/src/request.hpp +++ b/src/request.hpp @@ -19,6 +19,7 @@ #include #include +#include namespace wm { @@ -52,6 +53,8 @@ struct WMAction std::string area; TaskVisible visible; bool end_draw_finished; + std::shared_ptr client; + unsigned req_num; }; struct WMRequest diff --git a/src/window_manager.cpp b/src/window_manager.cpp index ea3c794..95b0d5a 100644 --- a/src/window_manager.cpp +++ b/src/window_manager.cpp @@ -470,14 +470,11 @@ void WindowManager::api_activate_surface(char const *appid, char const *drawing_ } 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; @@ -1321,14 +1318,14 @@ WMError WindowManager::doEndDraw(unsigned req_num) 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, @@ -1339,7 +1336,7 @@ WMError WindowManager::doEndDraw(unsigned req_num) //this->lc_enddraw(act.role.c_str()); } } - this->layout_commit(); + this->lc->commitChange(); HMI_SEQ_INFO(req_num, "emit flushDraw"); 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 #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 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 diff --git a/src/wm_layer_control.hpp b/src/wm_layer_control.hpp index db482bf..ea122a3 100644 --- a/src/wm_layer_control.hpp +++ b/src/wm_layer_control.hpp @@ -54,6 +54,9 @@ class LayerControlCallbacks { class WMLayer; class LayerState; +class WMAction; +class WMClient; + class LayerControl { public: @@ -73,12 +76,16 @@ class LayerControl WMError updateLayer(LayerState& layer_state); WMError commitChange(); void undoUpdate(); + WMError layoutChange(const WMAction& action); + WMError visibilityChange(const WMAction &action); // Don't use this function. void dispatchCreateEvent(ilmObjectType object, unsigned id, bool created); void dispatchPropertyChangeEvent(unsigned id, struct ilmSurfaceProperties*, t_ilm_notification_mask); void dispatchPropertyChangeEvent(unsigned id, struct ilmLayerProperties*, t_ilm_notification_mask); private: + WMError makeVisible(const WMClient* client); + WMError makeInvisible(const WMClient* client); WMError loadLayerSetting(const std::string& path); WMError loadAreaDb(const std::string& path); -- cgit 1.2.3-korg