diff options
author | Tadao Tanikawa <tanikawa.tadao@jp.panasonic.com> | 2018-08-02 07:24:38 +0000 |
---|---|---|
committer | Tadao Tanikawa <tanikawa.tadao@jp.panasonic.com> | 2018-08-02 07:25:22 +0000 |
commit | 6bc7a273350721be300423b1509527f336dce50e (patch) | |
tree | cf48715616b36b76b38a07e1df9e74e2dd30c2d0 | |
parent | 3d1703f9a5c9d6a356b561ea7528c70a1dc4fe2d (diff) |
Revert "Enable scaling to fit various screen resolutions"
Abandon scaling support by AGL window manager 2017
Bug-AGL: SPEC-1611
This reverts commit 8ab10aaafc6fb3dc7bbad755dce9b4bdaa41f287.
Change-Id: Id6afb263a6dc30929b922e469d906e2e5190f7b0
-rw-r--r-- | conf/setting.json | 8 | ||||
-rw-r--r-- | src/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/layers.cpp | 60 | ||||
-rw-r--r-- | src/layers.hpp | 2 | ||||
-rw-r--r-- | src/wayland_ivi_wm.cpp | 5 | ||||
-rw-r--r-- | src/wayland_ivi_wm.hpp | 1 | ||||
-rw-r--r-- | src/window_manager.cpp | 24 | ||||
-rw-r--r-- | src/window_manager.hpp | 6 | ||||
-rw-r--r-- | src/wm_config.cpp | 91 | ||||
-rw-r--r-- | src/wm_config.hpp | 43 |
10 files changed, 22 insertions, 220 deletions
diff --git a/conf/setting.json b/conf/setting.json deleted file mode 100644 index cfeb718..0000000 --- a/conf/setting.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "description": "Settings for window manager", - "settings" : - { - "scaling" : "aspect_fit", - "options@scaling" : "aspect_fit|display_fit|none" - } -}
\ No newline at end of file diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index ee398e0..42b81b7 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -36,7 +36,6 @@ add_library(${TARGETS_WM} MODULE layers.cpp wm_client.cpp wm_error.cpp - wm_config.cpp applist.cpp request.cpp) @@ -113,7 +112,6 @@ add_custom_command(TARGET ${TARGETS_WM} POST_BUILD COMMAND cp -f ${PROJECT_SOURCE_DIR}/layers.json ${PROJECT_BINARY_DIR}/package/root/etc COMMAND cp -f ${PROJECT_SOURCE_DIR}/src/db/old_roles.db ${PROJECT_BINARY_DIR}/package/root/etc COMMAND cp -f ${PROJECT_SOURCE_DIR}/src/db/areas.db ${PROJECT_BINARY_DIR}/package/root/etc - COMMAND cp -f ${PROJECT_SOURCE_DIR}/conf/setting.json ${PROJECT_BINARY_DIR}/package/root/etc ) add_custom_target(package DEPENDS ${PROJECT_BINARY_DIR}/package/root diff --git a/src/layers.cpp b/src/layers.cpp index b961157..f73daf2 100644 --- a/src/layers.cpp +++ b/src/layers.cpp @@ -181,60 +181,24 @@ json layer_map::to_json() const return j; } -compositor::rect layer_map::getAreaSize(const std::string &area) -{ - return area2size[area]; -} - -const compositor::rect layer_map::getScaleDestRect( - int to_w, int to_h, const std::string &aspect_setting) +void layer_map::setupArea(int output_w, int output_h) { compositor::rect rct; - rct.x = 0; - rct.y = 0; - rct.w = to_w; - rct.h = to_h; - HMI_NOTICE("wm:lm", - "Scaling:'%s'. Check 'fullscreen' is set.", aspect_setting.c_str()); - // Base is "fullscreen". Crash me if "fullscreen" is not set - compositor::rect base = this->area2size.at("fullscreen"); - HMI_DEBUG("wm:lm", "Output size, width: %d, height: %d / fullscreen width: %d, height: %d", - to_w, to_h, base.w, base.h); - // If full_rct.w or full_rct.h == 0, crash me on purpose - double scale_rate_w = double(to_w) / double(base.w); - double scale_rate_h = double(to_h) / double(base.h); - double scale; - if (scale_rate_h < scale_rate_w) - { - scale = scale_rate_h; - } - else - { - scale = scale_rate_w; - } - HMI_DEBUG("wm", "set scale: %5.2f", scale); - // Scaling - if (aspect_setting == "aspect_fit") - { - // offset - rct.x = (to_w - scale * base.w) / 2; - rct.y = (to_h - scale * base.h) / 2; + rct = this->area2size["normal.full"]; + this->area2size["normalfull"] = rct; + this->area2size["normal"] = rct; - // scaling - rct.w = base.w * scale; - rct.h = base.h * scale; - } - else if (aspect_setting == "display_fit") + for (auto &i : this->area2size) { - // offset is none - // scaling - rct.w = base.w * scale_rate_w; - rct.h = base.h * scale_rate_h; + HMI_DEBUG("wm:lm", "area:%s size(after) : x:%d y:%d w:%d h:%d", + i.first.c_str(), i.second.x, i.second.y, i.second.w, i.second.h); } - HMI_DEBUG("wm:lm", "offset x: %d, y: %d", rct.x, rct.y); - HMI_DEBUG("wm:lm", "after scaling w: %d, h: %d", rct.w, rct.h); - return rct; +} + +compositor::rect layer_map::getAreaSize(const std::string &area) +{ + return area2size[area]; } int layer_map::loadAreaDb() diff --git a/src/layers.hpp b/src/layers.hpp index adfd733..b6dd67f 100644 --- a/src/layers.hpp +++ b/src/layers.hpp @@ -114,8 +114,8 @@ struct layer_map } json to_json() const; + void setupArea(int output_w, int output_h); compositor::rect getAreaSize(const std::string &area); - const compositor::rect getScaleDestRect(int output_w, int output_h, const std::string &aspect_setting); int loadAreaDb(); private: diff --git a/src/wayland_ivi_wm.cpp b/src/wayland_ivi_wm.cpp index 522295d..f64ec03 100644 --- a/src/wayland_ivi_wm.cpp +++ b/src/wayland_ivi_wm.cpp @@ -435,11 +435,6 @@ void layer::set_visibility(uint32_t visibility) ivi_wm_set_layer_visibility(this->parent->proxy.get(), this->id, visibility); } -void layer::set_source_rectangle(int32_t x, int32_t y, int32_t width, int32_t height) -{ - ivi_wm_set_layer_source_rectangle(this->parent->proxy.get(), this->id, x, y, width, height); -} - void layer::set_destination_rectangle(int32_t x, int32_t y, int32_t width, int32_t height) { diff --git a/src/wayland_ivi_wm.hpp b/src/wayland_ivi_wm.hpp index d6b47af..9d0c7a7 100644 --- a/src/wayland_ivi_wm.hpp +++ b/src/wayland_ivi_wm.hpp @@ -197,7 +197,6 @@ struct layer : public controller_child // Requests void set_visibility(uint32_t visibility); - void set_source_rectangle(int32_t x, int32_t y, int32_t width, int32_t height); void set_destination_rectangle(int32_t x, int32_t y, int32_t width, int32_t height); void add_surface(uint32_t surface_id); diff --git a/src/window_manager.cpp b/src/window_manager.cpp index 98ebcf1..862341a 100644 --- a/src/window_manager.cpp +++ b/src/window_manager.cpp @@ -19,7 +19,6 @@ #include "window_manager.hpp" #include "json_helper.hpp" -#include "wm_config.hpp" #include "applist.hpp" extern "C" @@ -147,7 +146,6 @@ WindowManager::WindowManager(wl::display *d) int WindowManager::init() { - int ret; if (!this->display->ok()) { return -1; @@ -203,8 +201,7 @@ int WindowManager::init() // Third level objects this->display->roundtrip(); - ret = init_layers(); - return ret; + return init_layers(); } int WindowManager::dispatch_pending_events() @@ -657,22 +654,12 @@ 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), @@ -687,11 +674,9 @@ int WindowManager::init_layers() // Quick and dirty setup of layers for (auto const &i : this->layers.mapping) { - c->layer_create(i.second.layer_id, scale_rect.w, scale_rect.h); + c->layer_create(i.second.layer_id, o->width, o->height); auto &l = layers[i.second.layer_id]; - 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_destination_rectangle(0, 0, o->width, o->height); 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()); @@ -702,6 +687,9 @@ int WindowManager::init_layers() this->layout_commit(); + this->layers.loadAreaDb(); + this->layers.setupArea(o->width, o->height); + return 0; } diff --git a/src/window_manager.hpp b/src/window_manager.hpp index 7f9a3b8..ebdf495 100644 --- a/src/window_manager.hpp +++ b/src/window_manager.hpp @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef WINDOW_MANAGER_HPP -#define WINDOW_MANAGER_HPP +#ifndef TMCAGLWM_APP_HPP +#define TMCAGLWM_APP_HPP #include <atomic> #include <memory> @@ -283,4 +283,4 @@ class WindowManager } // namespace wm -#endif // WINDOW_MANAGER_HPP +#endif // TMCAGLWM_APP_HPP diff --git a/src/wm_config.cpp b/src/wm_config.cpp deleted file mode 100644 index f91fedd..0000000 --- a/src/wm_config.cpp +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (c) 2017 TOYOTA MOTOR CORPORATION - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "../include/hmi-debug.h" -#include "json_helper.hpp" -#include "wm_config.hpp" - -using std::string; - -namespace wm -{ - -WMConfig::WMConfig(){} - -WMConfig::~WMConfig() -{ - json_object_put(j_setting_conf); -} - -WMError WMConfig::loadConfigs() -{ - WMError ret; - char const *pRoot = getenv("AFM_APP_INSTALL_DIR"); - string root_path = pRoot; - if (root_path.length() == 0) - { - HMI_ERROR("wm", "AFM_APP_INSTALL_DIR is not defined"); - } - ret = this->loadSetting(root_path); - - return ret; -} - -const string WMConfig::getConfigAspect() -{ - json_object *j; - string ret; - if (!json_object_object_get_ex(this->j_setting_conf, "settings", &j)) - { - ret = "aspect_fit"; - } - else - { - const char* scaling = jh::getStringFromJson(j, "scaling"); - if(scaling == nullptr) - { - ret = "aspect_fit"; - } - else - { - ret = scaling; - } - } - return ret; -} - -/* - ***** Private Functions ***** - */ - -WMError WMConfig::loadSetting(const string &path) -{ - string setting_path = path; - int iret = -1; - WMError ret = SUCCESS; - - if (setting_path.length() != 0) - { - setting_path = path + string("/etc/setting.json"); - iret = jh::inputJsonFilie(setting_path.c_str(), &this->j_setting_conf); - if (iret < 0) - ret = FAIL; - } - - return ret; -} - -} // namespace wm diff --git a/src/wm_config.hpp b/src/wm_config.hpp deleted file mode 100644 index 68051b4..0000000 --- a/src/wm_config.hpp +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2017 TOYOTA MOTOR CORPORATION - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef WM_CONFIG_HPP -#define WM_CONFIG_HPP -#include <string> -#include "wm_error.hpp" - -struct json_object; - -namespace wm -{ - -class WMConfig { -public: - WMConfig(); - ~WMConfig(); - WMConfig(const WMConfig &) = delete; - WMConfig &operator=(const WMConfig &) = delete; - WMError loadConfigs(); - const std::string getConfigAspect(); - - private: - WMError loadSetting(const std::string &path); - // private variable - json_object *j_setting_conf; -}; - -} // namespace wm -#endif // WM_CONFIG_HPP
\ No newline at end of file |