aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKazumasa Mitsunari <knimitz@witz-inc.co.jp>2018-09-08 15:28:36 +0900
committerKazumasa Mitsunari <knimitz@witz-inc.co.jp>2018-09-08 15:29:08 +0900
commit2f2639950dec4b97984fd6776a850e5d4703ef52 (patch)
tree83a61ec7fa6fc729974d116feddbd03b4e1909e4 /src
parentf5001e404097c3e55ed9fad207036c55d11f5c8d (diff)
Update wm_layer
* add getUuid * add getWMLayer Signed-off-by: Kazumasa Mitsunari <knimitz@witz-inc.co.jp>
Diffstat (limited to 'src')
-rw-r--r--src/wm_layer.cpp12
-rw-r--r--src/wm_layer.hpp11
-rw-r--r--src/wm_layer_control.cpp18
-rw-r--r--src/wm_layer_control.hpp4
4 files changed, 39 insertions, 6 deletions
diff --git a/src/wm_layer.cpp b/src/wm_layer.cpp
index 1948b61..01e8950 100644
--- a/src/wm_layer.cpp
+++ b/src/wm_layer.cpp
@@ -82,7 +82,7 @@ void LayerState::setArea(const string& app, const string& area)
this->area2appid[area] = app;
}
-WMLayer::WMLayer(json_object* j) : tmp_state(), state()
+WMLayer::WMLayer(json_object* j, unsigned uuid) : tmp_state(), state(), uuid(uuid)
{
this->name = jh::getStringFromJson(j, "name");
this->role_list = jh::getStringFromJson(j, "role");
@@ -166,6 +166,11 @@ WMError WMLayer::setLayerState(const LayerState& l)
return WMError::SUCCESS;
}
+void WMLayer::addLayer(unsigned layer)
+{
+ this->tmp_state.addLayer(layer);
+}
+
void WMLayer::appendArea(const string& area)
{
this->area_list.push_back(area);
@@ -203,12 +208,13 @@ bool WMLayer::hasRole(const string& role)
return false;
}
-/* WMError WMLayer::commitChange()
+WMError WMLayer::commitChange()
{
this->state = this->tmp_state;
+ return WMError::SUCCESS;
}
-void WMLayer::undo()
+/* void WMLayer::undo()
{
this->tmp_state = this->state;
}
diff --git a/src/wm_layer.hpp b/src/wm_layer.hpp
index b14be46..4002c4b 100644
--- a/src/wm_layer.hpp
+++ b/src/wm_layer.hpp
@@ -56,11 +56,14 @@ class WMLayer
STACK
};
- explicit WMLayer(json_object* j);
+ explicit WMLayer(json_object* j, unsigned uuid);
~WMLayer() = default;
+
+ // Status & Setting API
unsigned getNewLayerID(const std::string& role);
unsigned idBegin() { return this->id_begin; }
unsigned idEnd() { return this->id_end; }
+ unsigned getUuid() { return this->uuid; }
const std::string& layerName();
MANAGEMENT_TYPE layerType() { return this->type; }
void appendArea(const std::string& area);
@@ -69,9 +72,15 @@ class WMLayer
WMError setLayerState(const LayerState& l);
bool hasLayerID(unsigned id);
bool hasRole(const std::string& role);
+
+ // Manipulation
+ void addLayer(unsigned layer);
+ WMError commitChange();
+
private:
LayerState tmp_state;
LayerState state;
+ unsigned uuid;
std::string name = ""; // Layer name
MANAGEMENT_TYPE type;
std::string role_list;
diff --git a/src/wm_layer_control.cpp b/src/wm_layer_control.cpp
index e0800f8..1d591f0 100644
--- a/src/wm_layer_control.cpp
+++ b/src/wm_layer_control.cpp
@@ -125,8 +125,11 @@ void LayerControl::createNewLayer(unsigned id)
ilm_layerSetSourceRectangle(id, rct.x, rct.y, rct.w, rct.h);
//ilm_layerSetDestinationRectangle(id, rct.x, rct.y, rct.w, rct.h);
ilm_layerSetOpacity(id, 1.0);
- ilm_layerSetVisibility(id, ILM_TRUE);
+ ilm_layerSetVisibility(id, ILM_FALSE);
ilm_commitChanges();
+ auto wm_layer = getWMLayer(id);
+ wm_layer->addLayer(id);
+ this->commitChange();
}
unsigned LayerControl::getNewLayerID(const string& role, string* layer_name)
@@ -138,12 +141,20 @@ unsigned LayerControl::getNewLayerID(const string& role, string* layer_name)
if(ret != 0)
{
*layer_name = l->layerName();
+ unsigned uid = l->getUuid();
+ this->lid2wmlid[ret] = uid;
break;
}
}
return ret;
}
+shared_ptr<WMLayer> LayerControl::getWMLayer(unsigned layer)
+{
+ unsigned uuid = this->lid2wmlid[layer];
+ return this->wm_layers[uuid];
+}
+
struct rect LayerControl::getAreaSize(const std::string& area)
{
return area2size[area];
@@ -219,6 +230,7 @@ WMError LayerControl::commitChange()
this->undoUpdate();
rc = WMError::FAIL;
}
+ ilm_commitChanges();
delete id_array;
return rc;
}
@@ -252,8 +264,9 @@ WMError LayerControl::loadLayerSetting(const string &path)
json_object *json_tmp = json_object_array_get_idx(json_cfg, i);
HMI_DEBUG("> json_tmp dump:%s", json_object_get_string(json_tmp));
- this->wm_layers.emplace_back(std::make_shared<WMLayer>(json_tmp));
+ this->wm_layers.emplace_back(std::make_shared<WMLayer>(json_tmp, i));
}
+ json_object_put(json_obj);
return WMError::SUCCESS;
}
@@ -394,6 +407,7 @@ void LayerControl::dispatchCreateEvent(ilmObjectType object, unsigned id, bool c
this->cb.surfaceCreated(sp.creatorPid, id);
ilm_surfaceAddNotification(id, surfaceCallback_static);
ilm_surfaceSetSourceRectangle(id, 0, 0, sp.origSourceWidth, sp.origSourceHeight);
+ ilm_surfaceSetVisibility(id, ILM_TRUE);
}
else
{
diff --git a/src/wm_layer_control.hpp b/src/wm_layer_control.hpp
index 0be06c2..df6c863 100644
--- a/src/wm_layer_control.hpp
+++ b/src/wm_layer_control.hpp
@@ -63,6 +63,8 @@ class LayerControl
WMError init(const LayerControlCallbacks& cb);
void createNewLayer(unsigned id);
unsigned getNewLayerID(const std::string& role, std::string* layer_name);
+ std::shared_ptr<WMLayer> getWMLayer(unsigned layer);
+ // std::shared_ptr<WMLayer> getWMLayer(std::string layer_name);
struct rect getAreaSize(const std::string& area);
void setupArea(double scaling);
Screen getScreenInfo();
@@ -73,6 +75,7 @@ class LayerControl
// std::vector<unsigned> getRenderOrder(const std::string& layer_name);
WMError updateLayer(LayerState& layer_state);
WMError commitChange();
+ // WMError renderWMLayers();
void undoUpdate();
WMError layoutChange(const WMAction& action);
WMError visibilityChange(const WMAction &action);
@@ -88,6 +91,7 @@ class LayerControl
WMError loadAreaDb(const std::string& path);
std::vector<std::shared_ptr<WMLayer>> wm_layers;
+ std::unordered_map<unsigned, unsigned> lid2wmlid;
std::unordered_map<std::string, struct rect> area2size;
unsigned screenID;
struct ilmScreenProperties screen_prop;