aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKazumasa Mitsunari <knimitz@witz-inc.co.jp>2018-08-31 09:27:22 +0900
committerKazumasa Mitsunari <knimitz@witz-inc.co.jp>2018-08-31 09:27:22 +0900
commit9f4fb3b34b4b8152c4355b735c5b7a3825086c4b (patch)
treee76c2929855cbb6b7143040e70cd68b8be5ad0ff
parent59844dbc6fd2676d69cba702a9c43ffbc625a5d5 (diff)
parent8f0f90cbffda62b8bc3283f6987a82d34b78e921 (diff)
Merge branch 'sandbox/knimitz/layer_with_pm_tmp' into sandbox/knimitz/layer_with_pm
Fix build error Change-Id: I951b531440aee655c8be77d82971f1c1bffe81a8
-rw-r--r--layers_setting.json2
-rw-r--r--src/request.hpp5
-rw-r--r--src/window_manager.cpp19
-rw-r--r--src/wm_layer_control.cpp106
-rw-r--r--src/wm_layer_control.hpp7
5 files changed, 127 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..95b8c82 100644
--- a/src/request.hpp
+++ b/src/request.hpp
@@ -19,10 +19,13 @@
#include <string>
#include <vector>
+#include <memory>
namespace wm
{
+class WMClient;
+
enum Task
{
TASK_ALLOCATE,
@@ -52,6 +55,8 @@ struct WMAction
std::string area;
TaskVisible visible;
bool end_draw_finished;
+ std::shared_ptr<WMClient> 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..9ac1ffc 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"
@@ -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<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)
+ {
+ 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 shared_ptr<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..e2c4b18 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 std::shared_ptr<WMClient> client);
+ WMError makeInvisible(const std::shared_ptr<WMClient> client);
WMError loadLayerSetting(const std::string& path);
WMError loadAreaDb(const std::string& path);