jr["width"], jr["height"], jr["x"], jr["y"],
};
}
+ auto split_layouts = j.find("split_layouts");
+ if (split_layouts != j.end()) {
+ auto &sls = j["split_layouts"];
+ // this->layouts.reserve(sls.size());
+ std::transform(std::cbegin(sls), std::cend(sls),
+ std::back_inserter(this->layouts), [this](json const &sl) {
+ struct split_layout l {
+ sl["name"], sl["main_match"], sl["sub_match"],
+ sl.value<int>("priority", 0)
+ };
+ logdebug(
+ "layer %d add split_layout \"%s\" (main: \"%s\") (sub: "
+ "\"%s\") (prio: %d)", this->layer_id,
+ l.name.c_str(), l.main_match.c_str(),
+ l.sub_match.c_str(), l.prio);
+ return l;
+ });
+ //std::sort(std::begin(this->layouts), std::end(this->layouts),
+ // [](struct split_layout const &a, struct split_layout const &b) {
+ // return a.prio < b.prio;
+ // });
+ }
}
struct result<struct layer_map> to_layer_map(nlohmann::json const &j) {
return unsigned(k.layer_id);
});
- // XXX need to sort layers?
+ std::sort(stl.layers.begin(), stl.layers.end());
+
for (auto i : stl.mapping) {
if (i.name.empty()) {
return Err<struct layer_map>("Found mapping w/o name");
}
return {
- {"id_min", this->id_min},
- {"id_max", this->id_max},
- {"name", this->name},
- {"layer_id", this->layer_id},
- {"area", r},
+ {"id_min", this->id_min}, {"id_max", this->id_max},
+ {"name", this->name}, {"role", this->role},
+ {"layer_id", this->layer_id}, {"area", r},
};
}