diff options
Diffstat (limited to 'src/layers.cpp')
-rw-r--r-- | src/layers.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/layers.cpp b/src/layers.cpp index f475556..0d01080 100644 --- a/src/layers.cpp +++ b/src/layers.cpp @@ -30,10 +30,16 @@ struct result<struct surface_id_to_layer_map> to_surface_id_to_layer_map( try { surface_id_to_layer_map stl{}; auto m = j["mappings"]; + stl.layers.reserve(m.size()); std::transform( std::cbegin(m), std::cend(m), std::inserter(stl.mapping, stl.mapping.end()), - [](nlohmann::json const &j) { return surface_id_to_layer(j); }); + [&stl](nlohmann::json const &j) { + auto k = surface_id_to_layer(j); + stl.layers.push_back(unsigned(k.layer_id)); + return k; + }); + // XXX need to sort layers? for (auto i : stl.mapping) { if (i.name.empty()) { return Err<struct surface_id_to_layer_map>( |