2 // Created by m on 7/27/17.
5 #ifndef TMCAGLWM_LAYERS_H
6 #define TMCAGLWM_LAYERS_H
13 #include "wayland.hpp"
17 struct surface_id_to_layer {
18 // Min and max surface ID mapped to this layer
21 // A more or less descriptive name?
22 std::string name = "";
23 // The actual layer ID
25 // The rectangular region surfaces are allowed to draw on
26 // this layer, note however, width and hieght of the rect
27 // can be negative, in which case they specify that
28 // the actual value is computed using MAX + 1 - w
29 // That is; allow us to specify dimensions dependent on
30 // e.g. screen dimension, w/o knowing the actual screen size.
32 // XXX perhaps a zorder is needed here?
34 explicit surface_id_to_layer(nlohmann::json const &j);
36 bool operator<(struct surface_id_to_layer const &rhs) const {
37 return this->id_max < rhs.id_max;
41 // Actually, we shouldn't need a struct here ... but let's just keep it at that
42 // for now, to contain its mapping type and the _single_ useful method.
43 struct surface_id_to_layer_map {
44 typedef std::set<struct surface_id_to_layer> surface_to_layer_map_type;
45 typedef std::vector<unsigned int> layers_type;
47 surface_to_layer_map_type mapping;
50 optional<int> get_layer_for_surface(int surface_id);
51 optional<genivi::rect> get_rect_for_surface(int surface_id);
52 layers_type::size_type get_layers_count() const {
53 return this->layers.size();
57 struct result<struct surface_id_to_layer_map> to_surface_id_to_layer_map(
58 nlohmann::json const &j);
62 #endif // TMCAGLWM_LAYERS_H