minor clang-format
[staging/windowmanager.git] / src / layers.hpp
1 //
2 // Created by m on 7/27/17.
3 //
4
5 #ifndef TMCAGLWM_LAYERS_H
6 #define TMCAGLWM_LAYERS_H
7
8 #include <json.hpp>
9 #include <set>
10 #include <string>
11
12 #include "result.hpp"
13 #include "wayland.hpp"
14
15 namespace wm {
16
17 struct surface_id_to_layer {
18    int id_min = -1;
19    int id_max = -1;
20    std::string name = "";
21    int layer_id = -1;
22    genivi::rect rect;
23
24    explicit surface_id_to_layer(nlohmann::json const &j);
25
26    bool operator<(struct surface_id_to_layer const &rhs) const {
27       return this->id_max < rhs.id_max;
28    }
29 };
30
31 // Actually, we shouldn't need a struct here ... but let's just keep it at that
32 // for now, to contain its mapping type and the _single_ useful method.
33 struct surface_id_to_layer_map {
34    typedef std::set<struct surface_id_to_layer> surface_to_layer_map_type;
35    typedef std::vector<unsigned int> layers_type;
36
37    surface_to_layer_map_type mapping;
38    layers_type layers;
39
40    optional<int> get_layer_for_surface(int surface_id);
41    optional<genivi::rect> get_rect_for_surface(int surface_id);
42    layers_type::size_type get_layers_count() const {
43       return this->layers.size();
44    }
45 };
46
47 struct result<struct surface_id_to_layer_map> to_surface_id_to_layer_map(
48    nlohmann::json const &j);
49
50 }  // namespace wm
51
52 #endif  // TMCAGLWM_LAYERS_H