X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fwindow_manager.cpp;h=eadf7ff912206664dc091c370ee1a3ee403e714e;hb=8ab10aaafc6fb3dc7bbad755dce9b4bdaa41f287;hp=481a5fb0440d10fc1111d9f30535de719eb0bc31;hpb=cf05c2b5c92b9a79635aa2277a9d55449e14fab6;p=apps%2Fagl-service-windowmanager.git diff --git a/src/window_manager.cpp b/src/window_manager.cpp index 481a5fb..eadf7ff 100644 --- a/src/window_manager.cpp +++ b/src/window_manager.cpp @@ -19,6 +19,7 @@ #include "window_manager.hpp" #include "json_helper.hpp" +#include "wm_config.hpp" #include "applist.hpp" extern "C" @@ -146,6 +147,7 @@ WindowManager::WindowManager(wl::display *d) int WindowManager::init() { + int ret; if (!this->display->ok()) { return -1; @@ -201,7 +203,8 @@ int WindowManager::init() // Third level objects this->display->roundtrip(); - return init_layers(); + ret = init_layers(); + return ret; } int WindowManager::dispatch_pending_events() @@ -654,12 +657,22 @@ int WindowManager::init_layers() return -1; } + WMConfig wm_config; + wm_config.loadConfigs(); + auto &c = this->controller; auto &o = this->outputs.front(); auto &s = c->screens.begin()->second; auto &layers = c->layers; + this->layers.loadAreaDb(); + const compositor::rect base = this->layers.getAreaSize("fullscreen"); + + const std::string aspect_setting = wm_config.getConfigAspect(); + const compositor::rect scale_rect = + this->layers.getScaleDestRect(o->width, o->height, aspect_setting); + // Write output dimensions to ivi controller... c->output_size = compositor::size{uint32_t(o->width), uint32_t(o->height)}; c->physical_size = compositor::size{uint32_t(o->physical_width), @@ -674,9 +687,11 @@ int WindowManager::init_layers() // Quick and dirty setup of layers for (auto const &i : this->layers.mapping) { - c->layer_create(i.second.layer_id, o->width, o->height); + c->layer_create(i.second.layer_id, scale_rect.w, scale_rect.h); auto &l = layers[i.second.layer_id]; - l->set_destination_rectangle(0, 0, o->width, o->height); + l->set_source_rectangle(0, 0, base.w, base.h); + l->set_destination_rectangle( + scale_rect.x, scale_rect.y, scale_rect.w, scale_rect.h); l->set_visibility(1); HMI_DEBUG("wm", "Setting up layer %s (%d) for surface role match \"%s\"", i.second.name.c_str(), i.second.layer_id, i.second.role.c_str()); @@ -687,8 +702,6 @@ int WindowManager::init_layers() this->layout_commit(); - this->layers.setupArea(o->width, o->height); - return 0; } @@ -721,17 +734,6 @@ void WindowManager::surface_set_layout(int surface_id, const std::string& area) int w = rect.w; int h = rect.h; - // less-than-0 values refer to MAX + 1 - $VALUE - // e.g. MAX is either screen width or height - if (w < 0) - { - w = this->controller->output_size.w + 1 + w; - } - if (h < 0) - { - h = this->controller->output_size.h + 1 + h; - } - HMI_DEBUG("wm", "surface_set_layout for surface %u on layer %u", surface_id, layer_id);