X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fwm_layer.cpp;h=cd381c2557b3ea61cb806adcca8330005efdb378;hb=a4584342e35332223e9fb16a346b2316a6507343;hp=7f8dbd9f23edb108c73b41b593e0e051f2da704d;hpb=915faae5e2901f2112a680586582a282c44dc401;p=apps%2Fagl-service-windowmanager.git diff --git a/src/wm_layer.cpp b/src/wm_layer.cpp index 7f8dbd9..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) : before_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 @@ -162,10 +162,15 @@ const string& WMLayer::layerName() WMError WMLayer::setLayerState(const LayerState& l) { - this->before_state = l; + this->tmp_state = 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,14 +208,15 @@ bool WMLayer::hasRole(const string& role) return false; } -/* WMError WMLayer::commitChange() +WMError WMLayer::commitChange() { - this->state = this->before_state; + this->state = this->tmp_state; + return WMError::SUCCESS; } -void WMLayer::undo() +/* void WMLayer::undo() { - this->before_state = this->state; + this->tmp_state = this->state; } */ } // namespace wm