aboutsummaryrefslogtreecommitdiffstats
path: root/src/window_manager.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/window_manager.cpp')
-rw-r--r--src/window_manager.cpp24
1 files changed, 18 insertions, 6 deletions
diff --git a/src/window_manager.cpp b/src/window_manager.cpp
index de322df..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,9 +702,6 @@ int WindowManager::init_layers()
this->layout_commit();
- this->layers.loadAreaDb();
- this->layers.setupArea(o->width, o->height);
-
return 0;
}