aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKazumasa Mitsunari <knimitz@witz-inc.co.jp>2018-06-17 18:23:32 +0900
committerKazumasa Mitsunari <knimitz@witz-inc.co.jp>2018-06-17 18:36:20 +0900
commit4f1421c4f252b9ffaa59e7b0f534d6d559b2ae99 (patch)
tree515063c56eb7f11ee14b2a0c91c0a82aa489622b
parent6d805fcec8891d85c92936881f962af3deee324e (diff)
Enable to get area size from area name
Change-Id: I79b45c5abd4d0ef9bf74d03fb99536108ea3ea40 Signed-off-by: Kazumasa Mitsunari <knimitz@witz-inc.co.jp>
-rw-r--r--src/app.cpp6
-rw-r--r--src/layers.cpp53
-rw-r--r--src/layers.hpp5
3 files changed, 62 insertions, 2 deletions
diff --git a/src/app.cpp b/src/app.cpp
index 2482d37..2d82e95 100644
--- a/src/app.cpp
+++ b/src/app.cpp
@@ -314,6 +314,8 @@ int App::init_layers()
this->layout_commit();
+ this->layers.setupArea(o->width, o->height);
+
return 0;
}
@@ -1255,10 +1257,10 @@ void App::emit_syncdraw(char const *label, char const *area, int x, int y, int w
void App::emit_syncdraw(const std::string &role, const std::string &area)
{
- int x = 0, y = 0, w = 0, h = 0;
+ compositor::rect rect = this->layers.getAreaSize(area);
//this->lm_get_area_info(area, &x, &y, &w, &h);
this->send_event(kListEventName[Event_SyncDraw],
- role.c_str(), area.c_str(), x, y, w, h);
+ role.c_str(), area.c_str(), rect.x, rect.y, rect.w, rect.h);
}
void App::emit_flushdraw(char const *label)
diff --git a/src/layers.cpp b/src/layers.cpp
index af8d89e..0431fee 100644
--- a/src/layers.cpp
+++ b/src/layers.cpp
@@ -194,4 +194,57 @@ 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;
+
+ // 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;
+ if (rct.h <= 0)
+ rct.h = output_h + rct.h;
+ this->area2size[area] = rct;
+
+ // setup onscreen
+ area = "onscreen";
+ 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 5479c3a..c01d45e 100644
--- a/src/layers.hpp
+++ b/src/layers.hpp
@@ -117,6 +117,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);