X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Flayers.cpp;h=27fc53ec48126afc53ea731d4a5adf0a4a498eac;hb=cf05c2b5c92b9a79635aa2277a9d55449e14fab6;hp=92c19bf5a2901395d82226a95eaabf64880dfec8;hpb=be9cbe2c4d0bc0f65cbe08de2bad3eb6e7f248c0;p=apps%2Fagl-service-windowmanager.git diff --git a/src/layers.cpp b/src/layers.cpp index 92c19bf..27fc53e 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 = "on_screen"; + 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