diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/window_manager.cpp | 41 | ||||
-rw-r--r-- | src/window_manager.hpp | 4 | ||||
-rw-r--r-- | src/wm_layer_control.cpp (renamed from src/layout_manager.cpp) | 16 | ||||
-rw-r--r-- | src/wm_layer_control.hpp (renamed from src/layout_manager.hpp) | 6 |
5 files changed, 41 insertions, 28 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b1597b7..192e2b2 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -40,7 +40,7 @@ add_library(${TARGETS_WM} MODULE request.cpp pm_wrapper.cpp wm_layer.cpp - layout_manager.cpp) + wm_layer_control.cpp) target_include_directories(${TARGETS_WM} PRIVATE diff --git a/src/window_manager.cpp b/src/window_manager.cpp index bb8b073..22f411a 100644 --- a/src/window_manager.cpp +++ b/src/window_manager.cpp @@ -136,7 +136,7 @@ WindowManager::WindowManager(wl::display *d) { lm_setting_path += "/etc/layers_setting.json"; } - this->lm = std::make_shared<LayoutManager>(lm_setting_path); + this->lm = std::make_shared<LayerControl>(lm_setting_path); /* try { @@ -249,12 +249,14 @@ result<int> WindowManager::api_request_surface(char const *appid, char const *dr const char *role = this->convertRoleOldToNew(drawing_name); auto lid = this->layers.get_layer_id(string(role)); - if (!lid) + unsigned l_id = this->lm->getNewLayerID(role); + if (l_id != 0) { /** * register drawing_name as fallback and make it displayed. */ lid = this->layers.get_layer_id(string("fallback")); + l_id = this->lm->getNewLayerID("fallback"); HMI_DEBUG("wm", "%s is not registered in layers.json, then fallback as normal app", role); if (!lid) { @@ -262,30 +264,41 @@ result<int> WindowManager::api_request_surface(char const *appid, char const *dr } } - auto rname = this->lookup_id(role); - if (!rname) - { + // generate surface ID for ivi-shell application + + // auto rname = this->lookup_id(role); + // if (!rname) + // { // name does not exist yet, allocate surface id... auto id = int(this->id_alloc.generate_id(role)); - this->layers.add_surface(id, *lid); + // this->layers.add_surface(id, *lid); // set the main_surface[_name] here and now - if (!this->layers.main_surface_name.empty() && - this->layers.main_surface_name == drawing_name) - { - this->layers.main_surface = id; - HMI_DEBUG("wm", "Set main_surface id to %u", id); - } + // if (!this->layers.main_surface_name.empty() && + // this->layers.main_surface_name == drawing_name) + // { + // this->layers.main_surface = id; + // HMI_DEBUG("wm", "Set main_surface id to %u", id); + // } // add client into the db string appid_str(appid); - g_app_list.addClient(appid_str, *lid, id, string(role)); + if(g_app_list.contains(appid_str)) + { + // add surface into app + auto client = g_app_list.lookUpClient(appid_str); + // client.addSurface(id); + } + else + { + g_app_list.addClient(appid_str, l_id, id, string(role)); + } // Set role map of (new, old) this->rolenew2old[role] = string(drawing_name); return Ok<int>(id); - } + // } // Check currently registered drawing names if it is already there. return Err<int>("Surface already present"); diff --git a/src/window_manager.hpp b/src/window_manager.hpp index d77d23a..3088111 100644 --- a/src/window_manager.hpp +++ b/src/window_manager.hpp @@ -29,7 +29,7 @@ #include "hmi-debug.h" #include "request.hpp" #include "wm_error.hpp" -#include "layout_manager.hpp" +#include "wm_layer_control.hpp" struct json_object; @@ -281,7 +281,7 @@ class WindowManager std::unordered_map<std::string, struct compositor::rect> area2size; std::unordered_map<std::string, std::string> roleold2new; std::unordered_map<std::string, std::string> rolenew2old; - std::shared_ptr<LayoutManager> lm; + std::shared_ptr<LayerControl> lm; PMWrapper pmw; static const char* kDefaultOldRoleDb; diff --git a/src/layout_manager.cpp b/src/wm_layer_control.cpp index 66de5c3..0d8c924 100644 --- a/src/layout_manager.cpp +++ b/src/wm_layer_control.cpp @@ -16,22 +16,22 @@ #include <assert.h>
#include "layers.hpp"
-#include "layout_manager.hpp"
+#include "wm_layer_control.hpp"
using std::string;
namespace wm {
-LayoutManager::LayoutManager(const string& path) : wm_layers()
+LayerControl::LayerControl(const string& path) : wm_layers()
{
WMError ret = this->load(path);
assert(ret == WMError::SUCCESS);
}
-LayoutManager::~LayoutManager()
+LayerControl::~LayerControl()
{}
-unsigned LayoutManager::getNewLayerID(const string& role)
+unsigned LayerControl::getNewLayerID(const string& role)
{
unsigned ret = 0;
for(const auto& l: this->wm_layers)
@@ -45,16 +45,16 @@ unsigned LayoutManager::getNewLayerID(const string& role) return ret;
}
-WMError LayoutManager::updateLayer(WMLayer& wm_layer)
+WMError LayerControl::updateLayer(WMLayer& wm_layer)
{
return WMError::SUCCESS;
}
-void LayoutManager::commitChange() {}
+void LayerControl::commitChange() {}
-void LayoutManager::undoUpdate() {}
+void LayerControl::undoUpdate() {}
-WMError LayoutManager::load(const string &path)
+WMError LayerControl::load(const string &path)
{
return WMError::SUCCESS;
}
diff --git a/src/layout_manager.hpp b/src/wm_layer_control.hpp index 34e8e59..dacb557 100644 --- a/src/layout_manager.hpp +++ b/src/wm_layer_control.hpp @@ -23,11 +23,11 @@ namespace wm {
-class LayoutManager
+class LayerControl
{
public:
- explicit LayoutManager(const std::string& path);
- ~LayoutManager();
+ explicit LayerControl(const std::string& path);
+ ~LayerControl();
unsigned getNewLayerID(const std::string& role);
// void setRenderOrder(const std::vector<unsigned> layer_render_order);
// std::vector<unsigned> getAllRenderOrder();
|