summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKazumasa Mitsunari <knimitz@witz-inc.co.jp>2018-06-25 19:52:00 +0900
committerKazumasa Mitsunari <knimitz@witz-inc.co.jp>2018-06-27 16:15:15 +0900
commitd1127dd62c25e9c4c7d545de2456c6f4c4d7309f (patch)
treefc6082cc05a890573f97168de77b737b09949c58
parent2a352777521301937b0d1d4cdcf0e24a1aa2d84e (diff)
Add Get/Set area size functions
Add internal functions to get/set area size. Change-Id: I9fef787863bed81fe6e4761c6f387886d7df1455 Signed-off-by: Kazumasa Mitsunari <knimitz@witz-inc.co.jp>
-rw-r--r--src/app.cpp2
-rw-r--r--src/layers.cpp55
-rw-r--r--src/layers.hpp5
3 files changed, 62 insertions, 0 deletions
diff --git a/src/app.cpp b/src/app.cpp
index f09f6f5..8b2229c 100644
--- a/src/app.cpp
+++ b/src/app.cpp
@@ -261,6 +261,8 @@ int App::init_layers()
this->layout_commit();
+ this->layers.setupArea(o->width, o->height);
+
return 0;
}
diff --git a/src/layers.cpp b/src/layers.cpp
index 92c19bf..e3ff30c 100644
--- a/src/layers.cpp
+++ b/src/layers.cpp
@@ -191,4 +191,59 @@ json layer_map::to_json() const
return j;
}
+void layer_map::setupArea(int output_w, int output_h)
+{
+ compositor::rect rct;
+ // setup normal.full
+ std::string area = "normal.full";
+ std::string role = "Fallback";
+ auto l_id = this->get_layer_id(role);
+ auto l = this->get_layer(*l_id);
+ rct = l->rect;
+ if(rct.w < 0)
+ rct.w = output_w + 1 + rct.w;
+ if(rct.h < 0)
+ rct.h = output_h + 1 + rct.h;
+ this->area2size[area] = rct;
+ this->area2size["normalfull"] = rct;
+ this->area2size["normal"] = rct;
+
+ // setup split.main
+ area = "split.main";
+ rct.h = rct.h / 2;
+ this->area2size[area] = rct;
+
+ // setup split.sub
+ area = "split.sub";
+ rct.y = rct.y + rct.h;
+ this->area2size[area] = rct;
+
+ // setup homescreen
+ area = "fullscreen";
+ role = "HomeScreen";
+ rct = compositor::full_rect;
+ if (rct.w <= 0)
+ rct.w = output_w + rct.w + 1;
+ if (rct.h <= 0)
+ rct.h = output_h + rct.h + 1;
+ this->area2size[area] = rct;
+
+ // setup onscreen
+ area = "on_screen";
+ role = "OnScreen";
+ auto ons_id = this->get_layer_id(role);
+ auto l_ons = this->get_layer(*ons_id);
+ rct = l_ons->rect;
+ if (rct.w < 0)
+ rct.w = output_w + 1 + rct.w;
+ if (rct.h < 0)
+ rct.h = output_h + 1 + rct.h;
+ this->area2size[area] = rct;
+}
+
+compositor::rect layer_map::getAreaSize(const std::string &area)
+{
+ return area2size[area];
+}
+
} // namespace wm
diff --git a/src/layers.hpp b/src/layers.hpp
index e4160a5..a8ab2cc 100644
--- a/src/layers.hpp
+++ b/src/layers.hpp
@@ -114,6 +114,11 @@ struct layer_map
}
json to_json() const;
+ void setupArea(int output_w, int output_h);
+ compositor::rect getAreaSize(const std::string &area);
+
+ private:
+ std::unordered_map<std::string, compositor::rect> area2size;
};
struct result<struct layer_map> to_layer_map(nlohmann::json const &j);