2 // Created by mfritzsc on 6/27/17.
5 #ifndef TMCAGLWM_LAYOUT_HPP
6 #define TMCAGLWM_LAYOUT_HPP
9 #include <experimental/optional>
16 #include "wayland.hpp"
20 // Areas and layouts are defined to have a name, let's just keep it this way,
21 // we will not copy them around anyway.
25 uint32_t layer; // i.e. zorder?
29 static constexpr unsigned MAX_N_AREAS = 2;
33 struct area areas[MAX_N_AREAS];
36 typedef std::vector<struct layout> layouts_type;
38 struct surface_id_to_layer {
41 std::string name = "";
44 explicit surface_id_to_layer(nlohmann::json const &j);
46 bool operator<(struct surface_id_to_layer const &rhs) const {
47 return this->id_max < rhs.id_max;
51 inline bool operator<(struct surface_id_to_layer const &a, int b) {
55 struct surface_id_to_layer_map {
56 typedef std::set<struct surface_id_to_layer> map_type;
60 std::experimental::optional<int> get_layer_for_surface(int surface_id) {
61 auto i = std::lower_bound(std::cbegin(this->mapping),
62 std::cend(this->mapping), surface_id);
64 if (i != this->mapping.end()) {
65 if (i->id_min <= surface_id) {
66 return std::experimental::optional<int>(i->layer_id);
70 return std::experimental::nullopt;
74 struct result<struct surface_id_to_layer_map> to_surface_id_to_layer_map(
75 nlohmann::json const &j);
79 #endif // TMCAGLWM_LAYOUT_HPP