X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fwm_layer.cpp;h=cd381c2557b3ea61cb806adcca8330005efdb378;hb=16b18c596468f0ac0eef9c8df2b67786b3fb00ab;hp=1948b61c469e76b9af0e4fd47a325865bd464b3b;hpb=f5001e404097c3e55ed9fad207036c55d11f5c8d;p=apps%2Fagl-service-windowmanager.git diff --git a/src/wm_layer.cpp b/src/wm_layer.cpp index 1948b61..cd381c2 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"); @@ -127,8 +127,8 @@ unsigned WMLayer::getNewLayerID(const string& role) return ret; } - auto id_found = std::find(id_list.begin(), id_list.end(), ret); - if( (ret > this->idEnd()) || (id_found != id_list.cend()) ) + size_t count = std::count(id_list.begin(), id_list.end(), ret); + if( (ret > this->idEnd()) || (count > 1)) { HMI_NOTICE("id %d is not available then generate new id", ret); ret = 0; // reset @@ -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; }