diff options
author | Kazumasa Mitsunari <knimitz@witz-inc.co.jp> | 2018-06-25 09:44:07 +0900 |
---|---|---|
committer | Kazumasa Mitsunari <knimitz@witz-inc.co.jp> | 2018-06-25 01:33:51 +0000 |
commit | 714b578b8961b218841160e06df976863a2010d8 (patch) | |
tree | dd02040d17b8761c0f2c0bfa6407e158d77544dc /src | |
parent | be9cbe2c4d0bc0f65cbe08de2bad3eb6e7f248c0 (diff) |
Clean: remove small files
*policy.hpp
No affect to Window Manager decision, so remove it.
*config.hpp, config.cpp
Small function to hold the path information to config file,
but no need to hold until the death of process.
So move it to stack variable, then remove files.
Change-Id: I6c210acc586c7cc048e0b158df5e3a511f927b9d
Signed-off-by: Kazumasa Mitsunari <knimitz@witz-inc.co.jp>
Diffstat (limited to 'src')
-rw-r--r-- | src/CMakeLists.txt | 3 | ||||
-rw-r--r-- | src/app.cpp | 24 | ||||
-rw-r--r-- | src/app.hpp | 6 | ||||
-rw-r--r-- | src/config.cpp | 38 | ||||
-rw-r--r-- | src/config.hpp | 53 | ||||
-rw-r--r-- | src/policy.hpp | 39 |
6 files changed, 16 insertions, 147 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 47d4bf8..f727500 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -33,8 +33,7 @@ add_library(${TARGETS_WM} MODULE ${IVI_CON_PROTO} json_helper.cpp app.cpp - layers.cpp - config.cpp) + layers.cpp) target_include_directories(${TARGETS_WM} PRIVATE diff --git a/src/app.cpp b/src/app.cpp index e7048c4..f83e3e7 100644 --- a/src/app.cpp +++ b/src/app.cpp @@ -89,17 +89,26 @@ App::App(wl::display *d) display{d}, controller{}, outputs(), - config(), layers(), id_alloc{}, - pending_events(false), - policy{} + pending_events(false) { + char const *path_layers_json = getenv("AFM_APP_INSTALL_DIR"); + std::string path; + if (!path_layers_json) + { + HMI_ERROR("wm", "AFM_APP_INSTALL_DIR is not defined"); + path = std::string(path_layers_json); + } + else + { + path = std::string(path_layers_json) + std::string("/etc/layers.json"); + } + try { { - auto l = load_layer_map( - this->config.get_string("layers.json").value().c_str()); + auto l = load_layer_map(path.c_str()); if (l.is_ok()) { this->layers = l.unwrap(); @@ -1072,10 +1081,7 @@ void App::try_layout(struct LayoutState & /*state*/, struct LayoutState const &new_layout, std::function<void(LayoutState const &nl)> apply) { - if (this->policy.layout_is_valid(new_layout)) - { - apply(new_layout); - } + apply(new_layout); } /** diff --git a/src/app.hpp b/src/app.hpp index 0db2e06..fc532d1 100644 --- a/src/app.hpp +++ b/src/app.hpp @@ -22,11 +22,9 @@ #include <memory> #include <unordered_map> #include <experimental/optional> -#include "config.hpp" #include "controller_hooks.hpp" #include "layers.hpp" #include "layout.hpp" -#include "policy.hpp" #include "wayland_ivi_wm.hpp" #include "hmi-debug.h" @@ -173,8 +171,6 @@ struct App std::unique_ptr<struct compositor::controller> controller; std::vector<std::unique_ptr<struct wl::output>> outputs; - struct config config; - // track current layouts separately layer_map layers; @@ -186,8 +182,6 @@ struct App std::vector<int> pending_end_draw; - Policy policy; - std::map<const char *, struct afb_event> map_afb_event; // Surface are info (x, y, w, h) diff --git a/src/config.cpp b/src/config.cpp deleted file mode 100644 index 7b18224..0000000 --- a/src/config.cpp +++ /dev/null @@ -1,38 +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 "config.hpp" -#include "hmi-debug.h" - -namespace wm -{ - -config::config() : cfg() -{ - // Supply default values for these... - char const *path_layers_json = getenv("AFM_APP_INSTALL_DIR"); - - if (!path_layers_json) - { - HMI_ERROR("wm", "AFM_APP_INSTALL_DIR is not defined"); - } - else - { - this->cfg["layers.json"] = std::string(path_layers_json) + std::string("/etc/layers.json"); - } -} - -} // namespace wm diff --git a/src/config.hpp b/src/config.hpp deleted file mode 100644 index 43fb67e..0000000 --- a/src/config.hpp +++ /dev/null @@ -1,53 +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 TMCAGLWM_CONFIG_HPP -#define TMCAGLWM_CONFIG_HPP - -#include <experimental/optional> -#include <map> - -namespace wm -{ - -using std::experimental::nullopt; -using std::experimental::optional; - -struct config -{ - typedef std::map<std::string, std::string> map; - - map cfg; - - config(); - - optional<std::string> get_string(char const *s) - { - auto i = this->cfg.find(s); - return i != this->cfg.end() ? optional<std::string>(i->second) : nullopt; - } - - optional<int> get_int(char const *s) - { - auto i = this->cfg.find(s); - return i != this->cfg.end() ? optional<int>(std::stoi(i->second)) - : nullopt; - } -}; - -} // namespace wm - -#endif // TMCAGLWM_CONFIG_HPP diff --git a/src/policy.hpp b/src/policy.hpp deleted file mode 100644 index b87f94d..0000000 --- a/src/policy.hpp +++ /dev/null @@ -1,39 +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 TMCAGLWM_POLICY_HPP -#define TMCAGLWM_POLICY_HPP - -#include "layout.hpp" -#include "hmi-debug.h" - -namespace wm -{ - -class Policy -{ - public: - bool layout_is_valid(LayoutState const & /* layout */) - { - // We do not check for policy currently - HMI_DEBUG("wm", "Policy check returns positive"); - return true; - } -}; - -} // namespace wm - -#endif //TMCAGLWM_POLICY_HPP |