aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKazumasa Mitsunari <knimitz@witz-inc.co.jp>2018-09-12 13:37:18 +0900
committerKazumasa Mitsunari <knimitz@witz-inc.co.jp>2018-09-12 13:37:18 +0900
commit9f619f18ff68f2e75aa2ec0cdd7c289ff4ab75b7 (patch)
tree1f9048835c30a72cc96ad6d8ea8f66d5e12b8d8d /src
parent380bf1289c2dc9df91044cfc1dfb5554211b58fa (diff)
Fix the manipulation of surface/layer
* Set offset when creating new layer * Set surface size not layer when layoutChange Change-Id: I335e8afa83d2874076d9138d473ce07399aa2e4b Signed-off-by: Kazumasa Mitsunari <knimitz@witz-inc.co.jp>
Diffstat (limited to 'src')
-rw-r--r--src/wm_layer_control.cpp29
-rw-r--r--src/wm_layer_control.hpp2
2 files changed, 12 insertions, 19 deletions
diff --git a/src/wm_layer_control.cpp b/src/wm_layer_control.cpp
index 31f6c4f..bb3bfc2 100644
--- a/src/wm_layer_control.cpp
+++ b/src/wm_layer_control.cpp
@@ -63,7 +63,7 @@ LayerControl::LayerControl(const std::string& root)
// load layers.setting.json
WMError ret = this->loadLayerSetting(layer_path);
assert(ret == WMError::SUCCESS);
- // load area.db
+ // load areas.json
ret = this->loadAreaDb(area_path);
assert(ret == WMError::SUCCESS);
}
@@ -106,7 +106,7 @@ WMError LayerControl::init(const LayerControlCallbacks& cb)
if(rc != ILM_SUCCESS) goto lc_init_error;
- // Register Callback from ILM
+ // Register Callback to Window Manager and from ILM
this->cb = cb;
ilm_registerNotification(createCallback_static, this);
@@ -124,7 +124,7 @@ void LayerControl::createNewLayer(unsigned id)
struct rect rct = this->area2size[LC_DEFAULT_AREA];
ilm_layerCreateWithDimension(&id, rct.w, rct.h);
//ilm_layerSetSourceRectangle(id, rct.x, rct.y, rct.w, rct.h);
- //ilm_layerSetDestinationRectangle(id, rct.x, rct.y, rct.w, rct.h);
+ ilm_layerSetDestinationRectangle(id, this->offset_x, this->offset_y, rct.w, rct.h);
ilm_layerSetOpacity(id, 1.0);
ilm_layerSetVisibility(id, ILM_FALSE);
ilm_commitChanges();
@@ -175,17 +175,14 @@ struct rect LayerControl::getAreaSize(const std::string& area)
void LayerControl::setupArea(const rectangle& base_rct, double scaling)
{
- struct rect rct;
this->scaling = scaling;
-
- rct = this->area2size["normal.full"];
- this->area2size["normalfull"] = rct;
- this->area2size["normal"] = rct;
+ this->offset_x = base_rct.left();
+ this->offset_y = base_rct.top();
for (auto &i : this->area2size)
{
- i.second.x = base_rct.left() + static_cast<int>(scaling * i.second.x + 0.5);
- i.second.y = base_rct.top() + static_cast<int>(scaling * i.second.y + 0.5);
+ i.second.x = static_cast<int>(scaling * i.second.x + 0.5);
+ i.second.y = static_cast<int>(scaling * i.second.y + 0.5);
i.second.w = static_cast<int>(scaling * i.second.w + 0.5);
i.second.h = static_cast<int>(scaling * i.second.h + 0.5);
@@ -384,17 +381,16 @@ WMError LayerControl::layoutChange(const WMAction& action)
return WMError::NOT_REGISTERED;
}
unsigned layer = action.client->layerID();
+ unsigned surface = action.client->surfaceID();
- // Layout Manager
- // WMError ret = this->setLayerSize(layer, action.area);
auto rect = this->getAreaSize(action.area);
HMI_DEBUG("Set layout %d, %d, %d, %d",rect.x, rect.y, rect.w, rect.h);
- ilm_layerSetSourceRectangle(layer, 0, 0, rect.w, rect.h);
ilm_commitChanges();
- ilm_layerSetDestinationRectangle(layer, rect.x, rect.y, rect.w, rect.h);
+ ilm_surfaceSetDestinationRectangle(surface, rect.x, rect.y, rect.w, rect.h);
ilm_commitChanges();
for(auto &wm_layer: this->wm_layers)
{
+ // Store the state who is assigned to the area
if(wm_layer->hasLayerID(layer))
{
wm_layer->setAreaToState(action.client->appID(), action.area);
@@ -503,7 +499,6 @@ void LayerControl::dispatchPropertyChangeEvent(unsigned id,
HMI_DEBUG("surface %d size %d, %d, %d, %d", id,
sprop->sourceX, sprop->sourceY, sprop->origSourceWidth, sprop->origSourceHeight);
ilm_surfaceSetSourceRectangle(id, 0, 0, sprop->origSourceWidth, sprop->origSourceHeight);
- ilm_surfaceSetDestinationRectangle(id, 0, 0, sprop->origSourceWidth, sprop->origSourceHeight);
}
}
@@ -511,10 +506,6 @@ void LayerControl::dispatchPropertyChangeEvent(unsigned id,
struct ilmLayerProperties* lprop,
t_ilm_notification_mask mask)
{
- /*
- ILM_NOTIFICATION_CONTENT_AVAILABLE & ILM_NOTIFICATION_CONTENT_REMOVED
- are not handled here, handled in create/destroy event
- */
if (ILM_NOTIFICATION_VISIBILITY & mask)
{
HMI_DEBUG("layer %d turns visibility %d", id, lprop->visibility);
diff --git a/src/wm_layer_control.hpp b/src/wm_layer_control.hpp
index 7cccfa0..a458f2f 100644
--- a/src/wm_layer_control.hpp
+++ b/src/wm_layer_control.hpp
@@ -100,6 +100,8 @@ class LayerControl
unsigned screenID;
struct ilmScreenProperties screen_prop;
double scaling;
+ int offset_x;
+ int offset_y;
LayerControlCallbacks cb;
};