summaryrefslogtreecommitdiffstats
path: root/src/window_manager.cpp
diff options
context:
space:
mode:
authorKazumasa Mitsunari <knimitz@witz-inc.co.jp>2018-07-07 17:22:46 +0900
committerKazumasa Mitsunari <knimitz@witz-inc.co.jp>2018-07-11 17:26:55 +0900
commit8ab10aaafc6fb3dc7bbad755dce9b4bdaa41f287 (patch)
treee766e0b4b1bb894c5511ed6d1e71a4ac389415d6 /src/window_manager.cpp
parent6e8ca74a266a224d2754a5f2ed0e228fec2e5c96 (diff)
Enable scaling to fit various screen resolutions
Since the AGL HomeScreen of CES2018 assumes that the screen resolution is 1080x1920px, the graphics of it partially corrupted with others. To fix this issue, now the AGL window manager automatically scales size according to "scaling" value in setting.json By default(even if "scaling" is not set), this scaling keeps 'fullscreen' aspect rate in area.db("aspect_fit") User can select 3 options. - "aspect_fit" : Scale aspect rate of 'fullscreen' in area.db.(default) - "display_fit": Force to scale to display size. - "none" or others : Set size just as area.db Bug-AGL: SPEC-1568 Bug-AGL: SPEC-1569 Change-Id: Ia08c0ebb2d71ae8f89a90088e181381c3ba3562d Signed-off-by: Kazumasa Mitsunari <knimitz@witz-inc.co.jp>
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;
}