#define LC_AREA_PATH "/etc/areas.db"
#define LC_LAYER_SETTING_PATH "/etc/layers_setting.json"
-#define LC_DEFAULT_AREA "normal.full"
+#define LC_DEFAULT_AREA "fullscreen"
using std::string;
using std::vector;
WMError LayerControl::init(const LayerControlCallbacks& cb)
{
- ilmErrorTypes rc = ilm_init();
+ HMI_DEBUG("Initialize of ilm library and display");
t_ilm_uint num = 0;
t_ilm_uint *ids;
int cnt = 0;
+ ilmErrorTypes rc = ilm_init();
while (rc != ILM_SUCCESS)
{
}
HMI_ERROR("Wait to start weston ...");
sleep(1);
- ilm_init();
+ rc = ilm_init();
}
if(rc != ILM_SUCCESS) goto lc_init_error;
HMI_INFO("create new ID :%d", 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_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)
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];
i.second.w = static_cast<int>(scaling * i.second.w + 0.5);
i.second.h = static_cast<int>(scaling * i.second.h + 0.5);
- HMI_DEBUG("wm:lm", "area:%s size(after) : x:%d y:%d w:%d h:%d",
+ HMI_DEBUG("area:%s size(after) : x:%d y:%d w:%d h:%d",
i.first.c_str(), i.second.x, i.second.y, i.second.w, i.second.h);
}
}
WMError LayerControl::commitChange()
{
+ HMI_INFO("Commit change");
WMError rc = WMError::SUCCESS;
vector<unsigned> ivi_l_ids;
- for(const auto& l : this->wm_layers)
+ for(auto& l : this->wm_layers)
{
auto state = l->getLayerState();
for(const auto& id : state.getIviIdList())
for(const auto& i : ivi_l_ids)
{
id_array[count] = i;
+ HMI_DEBUG("check render order %d", i);
++count;
}
this->undoUpdate();
rc = WMError::FAIL;
}
+ ilm_commitChanges();
delete id_array;
return rc;
}
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;
}
void LayerControl::dispatchCreateEvent(ilmObjectType object, unsigned id, bool created)
{
- this->cb.test(id);
if (ILM_SURFACE == object)
{
if (created)
rc = ilm_getPropertiesOfSurface(id, &sp);
if(rc != ILM_SUCCESS)
return;
- // this->cb->surfaceCreated(pid, id);
+ 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
{
}
if (ILM_NOTIFICATION_CONFIGURED & mask)
{
+ HMI_DEBUG("surface %d available", id);
+ ilm_surfaceSetSourceRectangle(id, 0, 0, sprop->origSourceWidth, sprop->origSourceHeight);
+ ilm_surfaceSetDestinationRectangle(id, 0, 0, sprop->origSourceWidth, sprop->origSourceHeight);
/* qDebug("ILM_NOTIFICATION_CONFIGURED");
qDebug(" surfaceProperties %d", surface);
qDebug(" surfaceProperties.origSourceWidth: %d", surfaceProperties->origSourceWidth);
// Don't check here the client is not nullptr
unsigned layer = client->layerID();
- for(auto& wm_layer : this->wm_layers)
+ ilm_layerSetVisibility(layer, ILM_TRUE);
+
+ /* for(auto& wm_layer : this->wm_layers)
{
if(wm_layer->hasLayerID(layer))
{
LayerState ls = wm_layer->getLayerState();
ls.addLayer(layer);;
}
- }
+ } */
// Move foreground from back ground layer
- for(auto& wm_layer : this->wm_layers)
+ /* for(auto& wm_layer : this->wm_layers)
{
if(wm_layer->layerName() == "BackGroundLayer")
{
}
break;
}
- }
+ } */
return ret;
}
WMError LayerControl::makeInvisible(const shared_ptr<WMClient> client)
{
WMError ret = WMError::SUCCESS;
- // Don't check here the client is not nullptr
- unsigned layer = client->layerID();
+ unsigned layer = client->layerID(); // Don't check here the client is not nullptr
+
+ /* bool mv_ok = this->mvBackGround(client);
+
+ if(!mv_ok)
+ {
+ ilm_layerSetVisibility(layer, ILM_FALSE);
+ } */
+
+ ilm_layerSetDestinationRectangle(layer, 0, 0, 0, 0);
- for(auto& wm_layer : this->wm_layers)
+ /* for(auto& wm_layer : this->wm_layers)
{
if(wm_layer->hasLayerID(layer))
{
LayerState ls = wm_layer->getLayerState();
ls.removeLayer(layer);;
}
- }
+ } */
- // Move foreground from back ground layer
- for(auto& wm_layer : this->wm_layers)
+
+
+ return ret;
+}
+
+/* bool LayerControl::mvBackGround(const shared_ptr<WMClient> client)
+{
+ bool ret = false;
+
+ // Move background from foreground layer
+ auto bg = this->getWMLayer("BackGroundLayer");
+ if(bg != nullptr)
{
- if(wm_layer->layerName() == "BackGroundLayer")
+ unsigned layer = client->layerID();
+ if(bg->hasRole(client->role()))
{
- if(wm_layer->hasRole(client->role()))
- {
- LayerState ls = wm_layer->getLayerState();
- ls.addLayer(layer);
- }
- break;
+ LayerState bg_ls = bg->getLayerState();
+ bg_ls.addLayer(layer);
+ auto wm_layer = this->getWMLayer(layer);
+ LayerState ls = wm_layer->getLayerState();
+ ls.removeLayer(layer);
}
+ ret = true;
}
+ return ret;
+}
+
+bool LayerControl::mvForeGround(const shared_ptr<WMClient> client)
+{
+ bool ret = false;
+ // Move foreground from foreground layer
+ auto bg = this->getWMLayer("BackGroundLayer");
+ if(bg != nullptr)
+ {
+ unsigned layer = client->layerID();
+ if(bg->hasRole(client->role()))
+ {
+ LayerState bg_ls = bg->getLayerState();
+ bg_ls.removeLayer(layer);
+ auto wm_layer = this->getWMLayer(layer);
+ LayerState ls = wm_layer->getLayerState();
+ ls.addLayer(layer);
+ }
+ ret = true;
+ }
return ret;
}
+
+*/
+
} // namespace wm
\ No newline at end of file