using std::vector;
using std::unordered_map;
+#define BG_LAYER_NAME "BackGroundLayer"
+
namespace wm
{
this->id_begin = static_cast<unsigned>(jh::getIntFromJson(j, "id_range_begin"));
this->id_end = static_cast<unsigned>(jh::getIntFromJson(j, "id_range_end"));
- if (name.size() == 0 || type || this->id_begin == 0 || this->id_end == 0)
+ if (name.size() == 0 || !type)
{
HMI_ERROR("Parse Error!!");
exit(1);
// generate new layer id;
if(this->hasRole(role))
{
- ret = this->id_list.back() + 1;
+ if(this->id_list.size() == 0)
+ {
+ ret = this->idBegin();
+ this->id_list.push_back(ret);
+ }
+ else
+ {
+ ret = this->id_list.back() + 1;
+ }
HMI_INFO("Generate new id: %d", ret);
}
else
bool WMLayer::hasRole(const string& role)
{
+ // TODO : use virtual to avoid compare
+ if(this->name == BG_LAYER_NAME)
+ return false;
auto re = std::regex(this->role_list);
if (std::regex_match(role, re))
{
- HMI_DEBUG("role %s matches layer %d", role.c_str(), this->name.c_str());
+ HMI_DEBUG("role %s matches layer %s", role.c_str(), this->name.c_str());
return true;
}
return false;
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;
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);
}
}
class LayerControlCallbacks {\r
public:\r
LayerControlCallbacks() {};\r
- virtual ~LayerControlCallbacks() = default;\r
+ ~LayerControlCallbacks() = default;\r
LayerControlCallbacks(const LayerControlCallbacks &obj) = default;\r
\r
// callback functions\r
- virtual void test(unsigned i) { HMI_DEBUG("test %d", i); }\r
+ void test(unsigned i) { HMI_DEBUG("test %d", i); }\r
std::function<void(unsigned)> surfaceCreated;\r
/* std::function<void(unsigned)> surfaceDestroyed;\r
std::function<void(unsigned)> layerCreated;\r