aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--layers.json104
-rw-r--r--package/root/config.xml4
-rw-r--r--src/CMakeLists.txt4
-rw-r--r--src/applist.cpp83
-rw-r--r--src/applist.hpp17
-rw-r--r--src/main.cpp137
-rw-r--r--src/util.hpp2
-rw-r--r--src/window_manager.cpp193
-rw-r--r--src/window_manager.hpp52
-rw-r--r--src/wm_layer.cpp15
-rw-r--r--src/wm_layer.hpp22
-rw-r--r--src/wm_layer_control.cpp68
-rw-r--r--src/wm_layer_control.hpp14
13 files changed, 237 insertions, 478 deletions
diff --git a/layers.json b/layers.json
index fddd258..d82d2ea 100644
--- a/layers.json
+++ b/layers.json
@@ -1,47 +1,61 @@
{
- "comment": "Surface ID to Layer ID mapping",
-
- "main_surface": {
- "surface_role": "HomeScreen",
- "comment": "This surface should never be made invisible (The HomeScreen)"
- },
-
- "mappings": [
- {
- "role": "BackGroundLayer",
- "name": "BackGroundLayer",
- "layer_id": 999,
- "comment": "Single BackGround layer map for the map, radio, music and video"
- },
- {
- "role": "homescreen",
- "name": "FarHomeScreen",
- "layer_id": 1000,
- "comment": "FarHomeScreen is the part of HomeScreen. The z order of this layer is lower than NearHomeScreen"
- },
- {
- "role": "music|video|browser|radio|phone|map|hvac|settings|dashboard|poi|mixer|sdl|launcher|fallback",
- "name": "Apps",
- "layer_id": 1001,
- "comment": "Range of IDs that will always be placed on layer 1001"
- },
- {
- "role": "software_keyboard",
- "name": "NearHomeScreen",
- "layer_id": 1002,
- "comment": "NearHomeScreen is the part of HomeScreen. The z order of this layer is upper than FarHomeScreen"
- },
- {
- "role": "restriction",
- "name": "Restriction",
- "layer_id": 1003,
- "comment": "This layer is for restriction notification. This is used by restriction role"
- },
- {
- "role": "^on_screen.*",
- "name": "OnScreen",
- "layer_id": 9999,
- "comment": "Range of IDs that will always be placed on the OnScreen layer, that gets a very high 'dummy' id of 9999"
- }
- ]
+ "description": "Layer mapping",
+ "mappings": [
+ {
+ "name": "BackGroundLayer",
+ "role" : "map|radio|music|video",
+ "id_range_begin": 0,
+ "id_range_end": 0,
+ "comment": "Work Around: This is evacuation layer that not stopping event loop"
+ },
+ {
+ "name": "FarHomeScreen",
+ "role": "homescreen",
+ "id_range_begin": 100,
+ "id_range_end": 199,
+ "comment": "FarHomeScreen is the part of HomeScreen. The z order of this layer is lower than NearHomeScreen"
+ },
+ {
+ "name": "Apps",
+ "role": "music|video|browser|radio|phone|map|navigation|hvac|settings|dashboard|poi|mixer|sdl|launcher|receiver|tachometer|fallback",
+ "id_range_begin": 1000,
+ "id_range_end": 2999,
+ "comment": "Range of IDs that will always be placed on layer 1001"
+ },
+ {
+ "name": "NearHomeScreen",
+ "role": "",
+ "id_range_begin": 3000,
+ "id_range_end": 3000,
+ "comment": "TOYOTA special software keyboard"
+ },
+ {
+ "name": "Application Popup Layer",
+ "role": "popup*",
+ "id_range_begin": 4000,
+ "id_range_end": 4999,
+ "comment": "[T.B.D]This layer is for application popup layer"
+ },
+ {
+ "name": "Restriction",
+ "role": "restriction",
+ "id_range_begin": 5000,
+ "id_range_end": 5999,
+ "comment": "This layer is for restriction notification. This is used by restriction role"
+ },
+ {
+ "name": "OnScreen",
+ "role": "^on_screen*",
+ "id_range_begin": 6000,
+ "id_range_end": 6999,
+ "comment": "Range of IDs that will always be placed on the OnScreen layer, that gets a very high 'dummy' id of 9999"
+ },
+ {
+ "name": "Remote",
+ "role": "tbtnavi",
+ "id_range_begin": 9000,
+ "id_range_end": 9999,
+ "comment": "Range of IDs that will always be placed on the OnScreen layer, that gets a very high 'dummy' id of 9999"
+ }
+ ]
}
diff --git a/package/root/config.xml b/package/root/config.xml
index e297b28..e11ef63 100644
--- a/package/root/config.xml
+++ b/package/root/config.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
-<widget xmlns="http://www.w3.org/ns/widgets" id="windowmanager-service-2017" version="0.1">
- <name>windowmanager-service-2017</name>
+<widget xmlns="http://www.w3.org/ns/widgets" id="windowmanager-service" version="0.1">
+ <name>windowmanager-service</name>
<content src="config.xml" type="application/vnd.agl.service"/>
<description>Window Manager</description>
<author>TOYOTA</author>
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 9fa4b73..4b67d38 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -113,12 +113,12 @@ add_custom_command(TARGET ${TARGETS_WM} POST_BUILD
COMMAND mkdir -p ${PROJECT_BINARY_DIR}/package/root/lib
COMMAND cp -rf ${PROJECT_BINARY_DIR}/src/${TARGETS_WM}.so ${PROJECT_BINARY_DIR}/package/root/lib
COMMAND mkdir -p ${PROJECT_BINARY_DIR}/package/root/etc
- COMMAND cp -f ${PROJECT_SOURCE_DIR}/layers_setting.json ${PROJECT_BINARY_DIR}/package/root/etc
+ COMMAND cp -f ${PROJECT_SOURCE_DIR}/layers.json ${PROJECT_BINARY_DIR}/package/root/etc
COMMAND cp -f ${PROJECT_SOURCE_DIR}/src/config/old_roles.json ${PROJECT_BINARY_DIR}/package/root/etc
COMMAND cp -f ${PROJECT_SOURCE_DIR}/src/config/areas.json ${PROJECT_BINARY_DIR}/package/root/etc
COMMAND cp -f ${PROJECT_SOURCE_DIR}/src/config/connection.json ${PROJECT_BINARY_DIR}/package/root/etc
)
add_custom_target(package DEPENDS ${PROJECT_BINARY_DIR}/package/root
- COMMAND wgtpkg-pack -f -o ${PROJECT_BINARY_DIR}/package/${TARGETS_WM}-2017.wgt ${PROJECT_BINARY_DIR}/package/root
+ COMMAND wgtpkg-pack -f -o ${PROJECT_BINARY_DIR}/package/${TARGETS_WM}.wgt ${PROJECT_BINARY_DIR}/package/root
)
diff --git a/src/applist.cpp b/src/applist.cpp
index 44865f6..be5fe57 100644
--- a/src/applist.cpp
+++ b/src/applist.cpp
@@ -169,24 +169,10 @@ int AppList::countClient() const
* Returns AppID if found.
*
* @param unsigned[in] surfaceID
- * @param string[in] role
* @param bool[in,out] AppID is found or not
* @return AppID
* @attention If AppID is not found, param found will be false.
*/
-/* string AppList::getAppID(unsigned surface, const string& role, bool* found) const
-{
- *found = false;
- for (const auto &x : this->app2client)
- {
- if(x.second->surfaceID(role) == surface){
- *found = true;
- return x.second->appID();
- }
- }
- return string("");
-} */
-
string AppList::getAppID(unsigned surface, bool* found) const
{
*found = false;
@@ -200,64 +186,6 @@ string AppList::getAppID(unsigned surface, bool* found) const
return string("");
}
-WMError AppList::popFloatingSurface(unsigned pid, unsigned *surface)
-{
- WMError ret = WMError::NO_ENTRY;
-
- auto fwd_itr = std::remove_if(this->floating_surfaces.begin(), this->floating_surfaces.end(),
- [pid, surface, &ret](FloatingSurface x) {
- if(pid == x.pid){
- *surface = x.surface_id;
- ret = WMError::SUCCESS;
- return true;
- }
- else{
- return false;
- }
- });
- if (fwd_itr != this->floating_surfaces.cend())
- {
- HMI_INFO("pop floating surface: %d", *surface);
- }
- this->floating_surfaces.erase(fwd_itr, this->floating_surfaces.end());
- return ret;
-}
-
-// =================== Floating(Temporary) surface/client API ===================
-
-// TODO: After testing setRole, remove these API
-
-WMError AppList::popFloatingSurface(const string &appid, unsigned *surface)
-{
- HMI_ERROR("This function is not implemented");
- return WMError::SUCCESS;
-}
-
-void AppList::addFloatingClient(const string &appid, unsigned layer, const string &role)
-{
-}
-
-void AppList::addFloatingSurface(const string &appid, unsigned surface, unsigned pid)
-{
- struct FloatingSurface fsurface{appid, surface, pid};
- this->floating_surfaces.push_back(fsurface);
- this->dumpFloatingSurfaces();
-}
-
-void AppList::removeFloatingSurface(unsigned surface)
-{
- this->dumpFloatingSurfaces();
- auto fwd_itr = std::remove_if(
- this->floating_surfaces.begin(), this->floating_surfaces.end(),
- [surface](FloatingSurface x) {
- return x.surface_id == surface;
- });
- if(fwd_itr != this->floating_surfaces.cend()){
- HMI_INFO("remove floating surface: %d", surface);
- }
- this->floating_surfaces.erase(fwd_itr, this->floating_surfaces.end());
-}
-
// =================== Request Date container API ===================
/**
@@ -621,15 +549,4 @@ void AppList::reqDump()
}
DUMP("======= req dump end =====");
}
-
-void AppList::dumpFloatingSurfaces()
-{
- DUMP("======= floating surface dump =====");
- for (const auto &x : this->floating_surfaces)
- {
- DUMP("surface : %d, pid : %d", x.surface_id, x.pid);
- }
- DUMP("======= floating surface dump end =====\n");
-}
-
} // namespace wm
diff --git a/src/applist.hpp b/src/applist.hpp
index 36e0524..085504a 100644
--- a/src/applist.hpp
+++ b/src/applist.hpp
@@ -31,13 +31,6 @@ namespace wm
/* using std::experimental::nullopt;
using std::experimental::optional; */
-struct FloatingSurface
-{
- std::string appid;
- unsigned surface_id;
- unsigned pid;
-};
-
class AppList
{
public:
@@ -59,14 +52,6 @@ class AppList
void removeSurface(unsigned surface);
std::string getAppID(unsigned surface, bool* found) const; // TODO: remove
-
- // Floating surface
- void addFloatingClient(const std::string &appid, unsigned layer, const std::string &role);
- void addFloatingSurface(const std::string &appid, unsigned surface, unsigned pid);
- WMError popFloatingSurface(unsigned pid, unsigned *surface);
- WMError popFloatingSurface(const std::string &appid, unsigned *surface);
- void removeFloatingSurface(unsigned surface);
-
// Request Interface
unsigned currentRequestNumber() const;
unsigned getRequestNumber(const std::string &appid) const;
@@ -85,14 +70,12 @@ class AppList
void clientDump();
void reqDump();
- void dumpFloatingSurfaces();
private:
std::vector<WMRequest> req_list;
std::unordered_map<std::string, std::shared_ptr<WMClient>> app2client;
unsigned current_req;
std::mutex mtx;
- std::vector<struct FloatingSurface> floating_surfaces;
};
} // namespace wm
diff --git a/src/main.cpp b/src/main.cpp
index 3766152..b62bb58 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -104,7 +104,7 @@ static void cbRemoveClientCtxt(void *data)
// Policy Manager does not know this app was killed,
// so notify it by deactivate request.
- g_afb_instance->wmgr.api_deactivate_surface(
+ g_afb_instance->wmgr.api_deactivate_window(
ctxt->name.c_str(), ctxt->role.c_str(),
[](const char *) {});
@@ -129,7 +129,6 @@ static void createSecurityContext(afb_req req, const char* appid, const char* ro
void windowmanager_requestsurface(afb_req req) noexcept
{
std::lock_guard<std::mutex> guard(binding_m);
-
if (g_afb_instance == nullptr)
{
afb_req_fail(req, "failed", "Binding not initialized, did the compositor die?");
@@ -150,7 +149,6 @@ void windowmanager_requestsurface(afb_req req) noexcept
{
auto ret = g_afb_instance->wmgr.api_request_surface(
appid, a_drawing_name);
-
if (ret.is_err())
{
afb_req_fail(req, "failed", ret.unwrap_err());
@@ -177,7 +175,6 @@ void windowmanager_requestsurface(afb_req req) noexcept
void windowmanager_requestsurfacexdg(afb_req req) noexcept
{
std::lock_guard<std::mutex> guard(binding_m);
-
if (g_afb_instance == nullptr)
{
afb_req_fail(req, "failed", "Binding not initialized, did the compositor die?");
@@ -208,6 +205,7 @@ void windowmanager_requestsurfacexdg(afb_req req) noexcept
{
auto ret = g_afb_instance->wmgr.api_request_surface(
appid, a_drawing_name, a_ivi_id);
+
if (ret != nullptr)
{
afb_req_fail(req, "failed", ret);
@@ -273,7 +271,6 @@ void windowmanager_setrole(afb_req req) noexcept
void windowmanager_activatewindow(afb_req req) noexcept
{
std::lock_guard<std::mutex> guard(binding_m);
-
if (g_afb_instance == nullptr)
{
afb_req_fail(req, "failed", "Binding not initialized, did the compositor die?");
@@ -312,7 +309,7 @@ void windowmanager_activatewindow(afb_req req) noexcept
if (g_afb_instance->wmgr.wmcon.isMasterMode() ||
!g_afb_instance->wmgr.wmcon.isMasterArea(a_drawing_area))
{
- g_afb_instance->wmgr.api_activate_surface(
+ g_afb_instance->wmgr.api_activate_window(
appid, a_drawing_name, a_drawing_area, reply);
}
else
@@ -342,7 +339,6 @@ void windowmanager_activatewindow(afb_req req) noexcept
void windowmanager_deactivatewindow(afb_req req) noexcept
{
std::lock_guard<std::mutex> guard(binding_m);
-
if (g_afb_instance == nullptr)
{
afb_req_fail(req, "failed", "Binding not initialized, did the compositor die?");
@@ -375,7 +371,7 @@ void windowmanager_deactivatewindow(afb_req req) noexcept
if (g_afb_instance->wmgr.wmcon.isMasterMode() ||
("tbtnavi" != std::string(a_drawing_name)))
{
- g_afb_instance->wmgr.api_deactivate_surface(
+ g_afb_instance->wmgr.api_deactivate_window(
appid, a_drawing_name, reply);
}
else
@@ -399,7 +395,6 @@ void windowmanager_deactivatewindow(afb_req req) noexcept
void windowmanager_enddraw(afb_req req) noexcept
{
std::lock_guard<std::mutex> guard(binding_m);
-
if (g_afb_instance == nullptr)
{
afb_req_fail(req, "failed", "Binding not initialized, did the compositor die?");
@@ -444,7 +439,6 @@ void windowmanager_enddraw(afb_req req) noexcept
void windowmanager_getdisplayinfo_thunk(afb_req req) noexcept
{
std::lock_guard<std::mutex> guard(binding_m);
-
if (g_afb_instance == nullptr)
{
afb_req_fail(req, "failed", "Binding not initialized, did the compositor die?");
@@ -472,7 +466,6 @@ void windowmanager_getdisplayinfo_thunk(afb_req req) noexcept
void windowmanager_getareainfo_thunk(afb_req req) noexcept
{
std::lock_guard<std::mutex> guard(binding_m);
-
if (g_afb_instance == nullptr)
{
afb_req_fail(req, "failed", "Binding not initialized, did the compositor die?");
@@ -628,7 +621,6 @@ void windowmanager_attach_app(afb_req req) noexcept
void windowmanager_wm_subscribe(afb_req req) noexcept
{
std::lock_guard<std::mutex> guard(binding_m);
-
if (g_afb_instance == nullptr)
{
afb_req_fail(req, "failed", "Binding not initialized, did the compositor die?");
@@ -644,10 +636,9 @@ void windowmanager_wm_subscribe(afb_req req) noexcept
afb_req_fail(req, "failed", "Need char const* argument event");
return;
}
- int event_type = json_object_get_int(j);
- const char *event_name = g_afb_instance->wmgr.kListEventName[event_type];
- struct afb_event event = g_afb_instance->wmgr.map_afb_event[event_name];
- int ret = afb_req_subscribe(req, event);
+ int event_id = json_object_get_int(j);
+ int ret = g_afb_instance->wmgr.api_subscribe(req, event_id);
+
if (ret)
{
afb_req_fail(req, "failed", "Error: afb_req_subscribe()");
@@ -662,36 +653,6 @@ void windowmanager_wm_subscribe(afb_req req) noexcept
}
}
-void windowmanager_list_drawing_names(afb_req req) noexcept
-{
- std::lock_guard<std::mutex> guard(binding_m);
-
- /* if (g_afb_instance == nullptr)
- {
- afb_req_fail(req, "failed", "Binding not initialized, did the compositor die?");
- return;
- }
-
- try
- {
-
- nlohmann::json j = g_afb_instance->wmgr.id_alloc.name2id;
- auto ret = wm::Ok(json_tokener_parse(j.dump().c_str()));
- if (ret.is_err())
- {
- afb_req_fail(req, "failed", ret.unwrap_err());
- return;
- }
-
- afb_req_success(req, ret.unwrap(), "success");
- }
- catch (std::exception &e)
- {
- afb_req_fail_f(req, "failed", "Uncaught exception while calling list_drawing_names: %s", e.what());
- return;
- } */
-}
-
void windowmanager_ping(afb_req req) noexcept
{
std::lock_guard<std::mutex> guard(binding_m);
@@ -707,89 +668,9 @@ void windowmanager_ping(afb_req req) noexcept
}
}
-void windowmanager_debug_status(afb_req req) noexcept
-{
- std::lock_guard<std::mutex> guard(binding_m);
-
- /* if (g_afb_instance == nullptr)
- {
- afb_req_fail(req, "failed", "Binding not initialized, did the compositor die?");
- return;
- }
-
- try
- {
-
- json_object *jr = json_object_new_object();
- json_object_object_add(jr, "surfaces",
- to_json(g_afb_instance->wmgr.controller->sprops));
- json_object_object_add(jr, "layers", to_json(g_afb_instance->wmgr.controller->lprops));
-
- afb_req_success(req, jr, "success");
- }
- catch (std::exception &e)
- {
- afb_req_fail_f(req, "failed", "Uncaught exception while calling debug_status: %s", e.what());
- return;
- } */
-}
-
-void windowmanager_debug_layers(afb_req req) noexcept
-{
- std::lock_guard<std::mutex> guard(binding_m);
-
- /* if (g_afb_instance == nullptr)
- {
- afb_req_fail(req, "failed", "Binding not initialized, did the compositor die?");
- return;
- }
-
- try
- {
- auto ret = wm::Ok(json_tokener_parse(g_afb_instance->wmgr.layers.to_json().dump().c_str()));
-
- afb_req_success(req, ret, "success");
- }
- catch (std::exception &e)
- {
- afb_req_fail_f(req, "failed", "Uncaught exception while calling debug_layers: %s", e.what());
- return;
- } */
-}
-
-void windowmanager_debug_surfaces(afb_req req) noexcept
-{
- std::lock_guard<std::mutex> guard(binding_m);
-
- /* if (g_afb_instance == nullptr)
- {
- afb_req_fail(req, "failed", "Binding not initialized, did the compositor die?");
- return;
- }
-
- try
- {
-
- auto ret = wm::Ok(to_json(g_afb_instance->wmgr.controller->sprops));
- if (ret.is_err())
- {
- afb_req_fail(req, "failed", ret.unwrap_err());
- return;
- }
-
- afb_req_success(req, ret.unwrap(), "success");
- }
- catch (std::exception &e)
- {
- afb_req_fail_f(req, "failed", "Uncaught exception while calling debug_surfaces: %s", e.what());
- return;
- } */
-}
-
void windowmanager_debug_terminate(afb_req req) noexcept
{
std::lock_guard<std::mutex> guard(binding_m);
-
if (g_afb_instance == nullptr)
{
afb_req_fail(req, "failed", "Binding not initialized, did the compositor die?");
@@ -832,11 +713,7 @@ const struct afb_verb_v2 windowmanager_verbs[] = {
{"setRenderOrder", windowmanager_set_render_order, nullptr, nullptr, AFB_SESSION_NONE},
{"attachApp", windowmanager_attach_app, nullptr, nullptr, AFB_SESSION_NONE},
{"wm_subscribe", windowmanager_wm_subscribe, nullptr, nullptr, AFB_SESSION_NONE},
- {"list_drawing_names", windowmanager_list_drawing_names, nullptr, nullptr, AFB_SESSION_NONE},
{"ping", windowmanager_ping, nullptr, nullptr, AFB_SESSION_NONE},
- {"debug_status", windowmanager_debug_status, nullptr, nullptr, AFB_SESSION_NONE},
- {"debug_layers", windowmanager_debug_layers, nullptr, nullptr, AFB_SESSION_NONE},
- {"debug_surfaces", windowmanager_debug_surfaces, nullptr, nullptr, AFB_SESSION_NONE},
{"debug_terminate", windowmanager_debug_terminate, nullptr, nullptr, AFB_SESSION_NONE},
{}};
diff --git a/src/util.hpp b/src/util.hpp
index d049fff..57eaf81 100644
--- a/src/util.hpp
+++ b/src/util.hpp
@@ -38,7 +38,7 @@
#define HMI_SEQ_INFO(seq_num, args,...) _HMI_SEQ_LOG(LOG_LEVEL_INFO, __FILENAME__, __FUNCTION__, __LINE__, seq_num, args, ##__VA_ARGS__)
#define HMI_SEQ_DEBUG(seq_num, args,...) _HMI_SEQ_LOG(LOG_LEVEL_DEBUG, __FILENAME__, __FUNCTION__, __LINE__, seq_num, args, ##__VA_ARGS__)
-#define DUMP(args, ...) _DUMP(LOG_LEVEL_DEBUG, args, ##__VA_ARGS__)
+#define DUMP(args, ...) _DUMP(LOG_LEVEL_INFO, args, ##__VA_ARGS__)
enum LOG_LEVEL{
LOG_LEVEL_NONE = 0,
diff --git a/src/window_manager.cpp b/src/window_manager.cpp
index f209f12..cdf57c2 100644
--- a/src/window_manager.cpp
+++ b/src/window_manager.cpp
@@ -57,8 +57,25 @@ const char kKeyHeightMm[] = "height_mm";
const char kKeyScale[] = "scale";
const char kKeyIds[] = "ids";
-static const char kPathOldRolesConfigFile[] = "/etc/old_roles.json";
+static const vector<string> kListEventName{
+ "active",
+ "inactive",
+ "visible",
+ "invisible",
+ "syncDraw",
+ "flushDraw",
+ "screenUpdated",
+ "headlampOff",
+ "headlampOn",
+ "parkingBrakeOff",
+ "parkingBrakeOn",
+ "lightstatusBrakeOff",
+ "lightstatusBrakeOn",
+ "carStop",
+ "carRun",
+ "error"};
+static const char kPathOldRolesConfigFile[] = "/etc/old_roles.json";
static sd_event_source *g_timer_ev_src = nullptr;
static AppList g_app_list;
static WindowManager *g_context;
@@ -159,7 +176,7 @@ int WindowManager::init()
// Make afb event
for (int i = Event_Val_Min; i <= Event_Val_Max; i++)
{
- map_afb_event[kListEventName[i]] = afb_daemon_make_event(kListEventName[i]);
+ map_afb_event[kListEventName[i]] = afb_daemon_make_event(kListEventName[i].c_str());
}
const struct rect css_bg = this->lc->getAreaSize("fullscreen");
@@ -189,13 +206,10 @@ result<int> WindowManager::api_request_surface(char const *appid, char const *dr
if(!g_app_list.contains(s_appid))
{
- // auto lid = this->layers.get_layer_id(string(role));
unsigned l_id = this->lc->getNewLayerID(s_role, &l_name);
if (l_id == 0)
{
- /**
- * register drawing_name as fallback and make it displayed.
- */
+ // register drawing_name as fallback and make it displayed.
l_id = this->lc->getNewLayerID("fallback", &l_name);
HMI_DEBUG("%s is not registered in layers.json, then fallback as normal app", role);
if (l_id == 0)
@@ -415,7 +429,7 @@ bool WindowManager::api_set_role(char const *appid, char const *drawing_name)
return true;
}
-void WindowManager::api_activate_surface(char const *appid, char const *drawing_name,
+void WindowManager::api_activate_window(char const *appid, char const *drawing_name,
char const *drawing_area, const reply_func &reply)
{
// TODO: application requests by old role,
@@ -608,7 +622,7 @@ void WindowManager::api_activate_surface_to_master(
this->setTimer();
}
-void WindowManager::api_deactivate_surface(char const *appid, char const *drawing_name,
+void WindowManager::api_deactivate_window(char const *appid, char const *drawing_name,
const reply_func &reply)
{
// TODO: application requests by old role,
@@ -799,6 +813,12 @@ void WindowManager::api_enddraw(char const *appid, char const *drawing_name)
}
}
+int WindowManager::api_subscribe(afb_req req, int event_id)
+{
+ struct afb_event event = this->map_afb_event[kListEventName[event_id]];
+ return afb_req_subscribe(req, event);
+}
+
void WindowManager::api_enddraw_for_remote(char const *appid, char const *drawing_name)
{
int ret = this->wmcon.sendRequest("endDraw", appid, drawing_name, "");
@@ -870,7 +890,7 @@ result<json_object *> WindowManager::api_get_area_info(char const *drawing_name)
const char *role = this->convertRoleOldToNew(drawing_name);
// Check drawing name, surface/layer id
- auto const &surface_id = this->id_alloc.lookup(string(role));
+ auto const &surface_id = this->id_alloc.lookup(role);
if (!surface_id)
{
return Err<json_object *>("Surface does not exist");
@@ -927,9 +947,9 @@ result<json_object *> WindowManager::api_get_car_info(char const *label)
return Ok<json_object *>(j_out);
}
-void WindowManager::send_event(char const *evname)
+void WindowManager::send_event(const string& evname)
{
- HMI_DEBUG("%s: %s", __func__, evname);
+ HMI_DEBUG("%s: %s", __func__, evname.c_str());
int ret = afb_event_push(this->map_afb_event[evname], nullptr);
if (ret != 0)
@@ -938,12 +958,12 @@ void WindowManager::send_event(char const *evname)
}
}
-void WindowManager::send_event(char const *evname, char const *label)
+void WindowManager::send_event(const string& evname, const string& role)
{
- HMI_DEBUG("%s: %s(%s)", __func__, evname, label);
+ HMI_DEBUG("%s: %s(%s)", __func__, evname.c_str(), role.c_str());
json_object *j = json_object_new_object();
- json_object_object_add(j, kKeyDrawingName, json_object_new_string(label));
+ json_object_object_add(j, kKeyDrawingName, json_object_new_string(role.c_str()));
int ret = afb_event_push(this->map_afb_event[evname], j);
if (ret != 0)
@@ -952,11 +972,11 @@ void WindowManager::send_event(char const *evname, char const *label)
}
}
-void WindowManager::send_event(char const *evname, char const *label, char const *area,
+void WindowManager::send_event(const string& evname, const string& role, const string& area,
int x, int y, int w, int h)
{
HMI_DEBUG("%s: %s(%s, %s) x:%d y:%d w:%d h:%d",
- __func__, evname, label, area, x, y, w, h);
+ __func__, evname.c_str(), role.c_str(), area.c_str(), x, y, w, h);
json_object *j_rect = json_object_new_object();
json_object_object_add(j_rect, kKeyX, json_object_new_int(x));
@@ -965,8 +985,8 @@ void WindowManager::send_event(char const *evname, char const *label, char const
json_object_object_add(j_rect, kKeyHeight, json_object_new_int(h));
json_object *j = json_object_new_object();
- json_object_object_add(j, kKeyDrawingName, json_object_new_string(label));
- json_object_object_add(j, kKeyDrawingArea, json_object_new_string(area));
+ json_object_object_add(j, kKeyDrawingName, json_object_new_string(role.c_str()));
+ json_object_object_add(j, kKeyDrawingArea, json_object_new_string(area.c_str()));
json_object_object_add(j, kKeyDrawingRect, j_rect);
int ret = afb_event_push(this->map_afb_event[evname], j);
@@ -1116,7 +1136,6 @@ void WindowManager::surface_removed(unsigned surface_id)
{
HMI_DEBUG("Delete surface_id %u", surface_id);
this->id_alloc.remove_id(surface_id);
- // this->layers.remove_surface(surface_id);
g_app_list.removeSurface(surface_id);
}
@@ -1124,7 +1143,7 @@ void WindowManager::removeClient(const string &appid)
{
HMI_DEBUG("Remove clinet %s from list", appid.c_str());
auto client = g_app_list.lookUpClient(appid);
- this->lc->terminateApp(client);
+ this->lc->appTerminated(client);
g_app_list.removeClient(appid);
}
@@ -1227,7 +1246,7 @@ void WindowManager::startTransitionWrapper(vector<WMAction> &actions)
continue;
}
- std::string appid = g_app_list.getAppID(*surface_id, &found);
+ string appid = g_app_list.getAppID(*surface_id, &found);
if (!found)
{
if (TaskVisible::INVISIBLE == act.visible)
@@ -1316,6 +1335,9 @@ void WindowManager::processForRemoteRequest(json_object *data)
const char *appid = jh::getStringFromJson(data, "appid");
const char *drawing_name = jh::getStringFromJson(data, "drawing_name");
const char *drawing_area = jh::getStringFromJson(data, "drawing_area");
+ string request = req;
+ string role = drawing_name;
+ string area = drawing_area;
if (!req || !drawing_name)
{
@@ -1339,7 +1361,7 @@ void WindowManager::processForRemoteRequest(json_object *data)
}
};
- if ("activateWindow" == std::string(req))
+ if ("activateWindow" == request)
{
if (!drawing_area)
{
@@ -1350,19 +1372,19 @@ void WindowManager::processForRemoteRequest(json_object *data)
this->api_activate_surface_for_slave(
appid, drawing_name, drawing_area, reply);
}
- else if ("deactivateWindow" == std::string(req))
+ else if ("deactivateWindow" == request)
{
this->api_deactivate_surface_for_slave(
appid, drawing_name, reply);
}
- else if ("endDraw" == std::string(req))
+ else if ("endDraw" == request)
{
this->api_enddraw(appid, drawing_name);
}
}
else
{
- if ("syncDraw" == std::string(req))
+ if ("syncDraw" == request)
{
this->stopTimer();
@@ -1386,7 +1408,7 @@ void WindowManager::processForRemoteRequest(json_object *data)
req_num,
client,
string(c_role),
- string(drawing_area),
+ area,
TaskVisible::REMOTE_VISIBLE,
end_draw_finished,
TaskCarState::NO_TASK
@@ -1400,16 +1422,16 @@ void WindowManager::processForRemoteRequest(json_object *data)
return;
}
- this->emit_syncdraw(string(drawing_name), string(drawing_area));
+ this->emit_syncdraw(role, area);
this->wmcon.startSyncDrawForRemote(appid);
this->setTimer();
}
- else if ("activated" == std::string(req))
+ else if ("activated" == request)
{
- this->emit_visible(drawing_name);
- this->emit_activated(drawing_name);
+ this->emit_visible(role);
+ this->emit_activated(area);
}
- else if ("deactivated" == std::string(req))
+ else if ("deactivated" == request)
{
this->stopTimer();
@@ -1443,16 +1465,16 @@ void WindowManager::processForRemoteRequest(json_object *data)
this->lc->renderLayers();
this->lc->renderLayersRemote();
- this->emit_invisible(drawing_name);
- this->emit_deactivated(drawing_name);
+ this->emit_invisible(role);
+ this->emit_deactivated(role);
this->emitScreenUpdated(req_num);
g_app_list.removeRequest(req_num);
this->processNextRequest();
}
- else if ("flushDraw" == std::string(req))
+ else if ("flushDraw" == request)
{
- this->emit_flushdraw(drawing_name);
+ this->emit_flushdraw(role);
}
}
}
@@ -1461,44 +1483,44 @@ void WindowManager::processForRemoteRequest(json_object *data)
******* Private Functions *******
*/
-void WindowManager::emit_activated(char const *label)
+void WindowManager::emit_activated(const string& role)
{
- this->send_event(kListEventName[Event_Active], label);
+ this->send_event(kListEventName[Event_Active], role);
}
-void WindowManager::emit_deactivated(char const *label)
+void WindowManager::emit_deactivated(const string& role)
{
- this->send_event(kListEventName[Event_Inactive], label);
+ this->send_event(kListEventName[Event_Inactive], role);
}
-void WindowManager::emit_syncdraw(char const *label, char const *area, int x, int y, int w, int h)
+void WindowManager::emit_syncdraw(const string& role, char const *area, int x, int y, int w, int h)
{
- this->send_event(kListEventName[Event_SyncDraw], label, area, x, y, w, h);
+ this->send_event(kListEventName[Event_SyncDraw], role, area, x, y, w, h);
}
void WindowManager::emit_syncdraw(const string &role, const string &area)
{
- rect rect = this->lc->getAreaSize(area);
+ struct rect rect = this->lc->getAreaSize(area);
this->send_event(kListEventName[Event_SyncDraw],
- role.c_str(), area.c_str(), rect.x, rect.y, rect.w, rect.h);
+ role.c_str(), area.c_str(), rect.x, rect.y, rect.w, rect.h);
}
-void WindowManager::emit_flushdraw(char const *label)
+void WindowManager::emit_flushdraw(const string& role)
{
- this->send_event(kListEventName[Event_FlushDraw], label);
+ this->send_event(kListEventName[Event_FlushDraw], role);
}
-void WindowManager::emit_visible(char const *label, bool is_visible)
+void WindowManager::emit_visible(const string& role, bool is_visible)
{
- this->send_event(is_visible ? kListEventName[Event_Visible] : kListEventName[Event_Invisible], label);
+ this->send_event(is_visible ? kListEventName[Event_Visible] : kListEventName[Event_Invisible], role);
}
-void WindowManager::emit_invisible(char const *label)
+void WindowManager::emit_invisible(const string& role)
{
- return emit_visible(label, false);
+ return emit_visible(role, false);
}
-void WindowManager::emit_visible(char const *label) { return emit_visible(label, true); }
+void WindowManager::emit_visible(const string& role) { return emit_visible(role, true); }
void WindowManager::emitHeadlampOff()
{
@@ -1764,7 +1786,7 @@ WMError WindowManager::startTransition(unsigned req_num)
if (x.visible == TaskVisible::INVISIBLE)
{
- emit_deactivated(old_role.c_str());
+ emit_deactivated(old_role);
}
else if (x.visible == TaskVisible::REQ_REMOTE_INVISIBLE)
{
@@ -1846,6 +1868,7 @@ WMError WindowManager::doEndDraw(unsigned req_num)
{
// get actions
bool found;
+ bool trigger_homescreen = false;
auto actions = g_app_list.getActions(req_num, &found);
WMError ret = WMError::SUCCESS;
if (!found)
@@ -1853,6 +1876,13 @@ WMError WindowManager::doEndDraw(unsigned req_num)
ret = WMError::NO_ENTRY;
return ret;
}
+ auto trigger = g_app_list.getRequest(req_num, &found);
+ HMI_SEQ_INFO(req_num, "trigger.role = %s", trigger.role.c_str());
+
+ if(trigger.role == "homescreen")
+ {
+ trigger_homescreen = true;
+ }
HMI_SEQ_INFO(req_num, "do endDraw");
@@ -1869,42 +1899,45 @@ WMError WindowManager::doEndDraw(unsigned req_num)
"Failed to manipulate surfaces while state change : %s", errorDescription(ret));
return ret;
}
- ret = this->lc->visibilityChange(act);
- // Emit active/deactive event
- string old_role = this->rolenew2old[act.role];
- if(act.visible == TaskVisible::VISIBLE)
+ if(trigger_homescreen && (act.visible == TaskVisible::INVISIBLE))
{
- emit_visible(old_role.c_str());
- emit_activated(old_role.c_str());
+ HMI_SEQ_NOTICE(req_num, "don't change visible if homescreen role is trigger");
}
- else if(act.visible == TaskVisible::REQ_REMOTE_VISIBLE)
+ else
{
- // If this action is for slave, send to slave
- int i_ret = this->wmcon.sendRequest("activated", "", old_role.c_str(), "");
- if (0 > i_ret)
- {
- ret = WMError::FAIL;
- }
+ ret = this->lc->visibilityChange(act);
}
- else if(act.visible == TaskVisible::REQ_REMOTE_INVISIBLE)
+
+ // Emit active/deactive event
+ string old_role = this->rolenew2old[act.role];
+ switch(act.visible)
{
- // If this action is for slave, send to slave
- int i_ret = this->wmcon.sendRequest("deactivated", "", old_role.c_str(), "");
- if (0 > i_ret)
+ case TaskVisible::VISIBLE :
+ emit_visible(old_role);
+ emit_activated(old_role);
+ break;
+ case TaskVisible::REQ_REMOTE_VISIBLE :
{
- ret = WMError::FAIL;
+ // If this action is for slave, send to slave
+ int i_ret = this->wmcon.sendRequest("activated", "", old_role.c_str(), "");
+ if (0 > i_ret)
+ {
+ ret = WMError::FAIL;
+ }
+ break;
}
- }
- else if((act.visible == TaskVisible::REMOTE_VISIBLE) ||
- (act.visible == TaskVisible::REMOTE_INVISIBLE))
- {
- // nop because emit active/deactive by event from remote
- }
- else
- {
- emit_invisible(old_role.c_str());
- emit_deactivated(old_role.c_str());
+ case TaskVisible::INVISIBLE :
+ if(!trigger_homescreen)
+ {
+ emit_invisible(old_role);
+ emit_deactivated(old_role);
+ }
+ break;
+ default :
+ // TaskVisible::REMOTE_VISIBLE, TaskVisible::REMOTE_INVISIBLE is this case
+ // If this action is for slave, send to slave
+ break;
}
if (ret != WMError::SUCCESS)
@@ -1929,7 +1962,7 @@ WMError WindowManager::doEndDraw(unsigned req_num)
if(act_flush.visible == TaskVisible::VISIBLE)
{
- this->emit_flushdraw(old_role.c_str());
+ this->emit_flushdraw(old_role);
}
else if(act_flush.visible == TaskVisible::REQ_REMOTE_VISIBLE)
{
diff --git a/src/window_manager.hpp b/src/window_manager.hpp
index c4ad0f5..18182b2 100644
--- a/src/window_manager.hpp
+++ b/src/window_manager.hpp
@@ -66,7 +66,6 @@ extern const char kKeyIds[];
struct id_allocator
{
unsigned next = 1;
-
// Surfaces that where requested but not yet created
std::unordered_map<unsigned, std::string> id2name;
std::unordered_map<std::string, unsigned> name2id;
@@ -218,26 +217,27 @@ class WindowManager
result<int> api_request_surface(char const *appid, char const *role);
char const *api_request_surface(char const *appid, char const *role, char const *ivi_id);
bool api_set_role(char const *appid, char const *role);
- void api_activate_surface(char const *appid, char const *role, char const *drawing_area, const reply_func &reply);
+ void api_activate_window(char const *appid, char const *role, char const *drawing_area, const reply_func &reply);
void api_activate_surface_for_slave(char const *appid, char const *drawing_name,
char const *drawing_area, const reply_func &reply);
void api_activate_surface_to_master(char const *appid, char const *drawing_name,
char const *drawing_area, const reply_func &reply);
- void api_deactivate_surface(char const *appid, char const *role, const reply_func &reply);
+ void api_deactivate_window(char const *appid, char const *role, const reply_func &reply);
void api_deactivate_surface_for_slave(char const *appid, char const *drawing_name,
const reply_func &reply);
void api_deactivate_surface_to_master(char const *appid, char const *drawing_name,
const reply_func &reply);
void api_enddraw(char const *appid, char const *role);
+ int api_subscribe(afb_req req, int event_id);
void api_enddraw_for_remote(char const *appid, char const *drawing_name);
bool api_client_set_render_order(const char *appid, const std::vector<std::string> &render_order);
std::string api_client_attach_service_surface(const char* appid, const char* dest, const char* service_surface);
result<json_object *> api_get_display_info();
result<json_object *> api_get_area_info(char const *role);
result<json_object *> api_get_car_info(char const *label);
- void send_event(char const *evname);
- void send_event(char const *evname, char const *label);
- void send_event(char const *evname, char const *label, char const *area, int x, int y, int w, int h);
+ void send_event(const std::string& evname);
+ void send_event(const std::string& evname, const std::string& role);
+ void send_event(const std::string& evname, const std::string& role, const std::string& area, int x, int y, int w, int h);
// Events from the compositor we are interested in
void surface_created(unsigned pid, unsigned surface_id);
@@ -257,37 +257,18 @@ class WindowManager
std::string searchApp(unsigned pid, unsigned ppid, unsigned surface, json_object* resp);
void storeSurface(const std::string& appid, unsigned ppid, unsigned surface);
- const std::vector<const char *> kListEventName{
- "active",
- "inactive",
- "visible",
- "invisible",
- "syncDraw",
- "flushDraw",
- "screenUpdated",
- "headlampOff",
- "headlampOn",
- "parkingBrakeOff",
- "parkingBrakeOn",
- "lightstatusBrakeOff",
- "lightstatusBrakeOn",
- "carStop",
- "carRun",
- "error"};
- std::map<const char *, struct afb_event> map_afb_event;
-
WMConnection wmcon;
private:
// WM Events to clients
- void emit_activated(char const *label);
- void emit_deactivated(char const *label);
- void emit_syncdraw(char const *label, char const *area, int x, int y, int w, int h);
+ void emit_activated(const std::string& role);
+ void emit_deactivated(const std::string& role);
+ void emit_syncdraw(const std::string& role, char const *area, int x, int y, int w, int h);
void emit_syncdraw(const std::string &role, const std::string &area);
- void emit_flushdraw(char const *label);
- void emit_visible(char const *label, bool is_visible);
- void emit_invisible(char const *label);
- void emit_visible(char const *label);
+ void emit_flushdraw(const std::string& role);
+ void emit_visible(const std::string& role, bool is_visible);
+ void emit_invisible(const std::string& role);
+ void emit_visible(const std::string& role);
void emitHeadlampOff();
void emitHeadlampOn();
void emitParkingBrakeOff();
@@ -322,6 +303,7 @@ class WindowManager
const char *check_surface_exist(const char *role);
private:
+ std::map<std::string, struct afb_event> map_afb_event;
std::unordered_map<std::string, std::string> roleold2new;
std::unordered_map<std::string, std::string> rolenew2old;
std::shared_ptr<LayerControl> lc;
@@ -330,12 +312,10 @@ class WindowManager
CarInfo crr_car_info;
PMWrapper pmw;
+ rect_map area_info;
+ struct id_allocator id_alloc;
// ID allocation and proxy methods for lookup
- struct id_allocator id_alloc;
- // Surface are info (x, y, w, h)
- rect_map area_info;
- // FOR CES DEMO
std::unordered_map<unsigned, struct TmpClient> tmp_surface2app;
std::vector<struct TmpService> tmp_services;
static const char* kDefaultOldRolesConfig;
diff --git a/src/wm_layer.cpp b/src/wm_layer.cpp
index d3e7073..2e30069 100644
--- a/src/wm_layer.cpp
+++ b/src/wm_layer.cpp
@@ -81,7 +81,7 @@ void LayerState::removeLayer(unsigned layer)
this->render_order.erase(fwd_itr, this->render_order.end());
}
-void LayerState::setArea(const string& app, const string& area)
+void LayerState::attachAppToArea(const string& app, const string& area)
{
this->area2appid[area] = app;
}
@@ -105,15 +105,14 @@ void LayerState::dump()
DUMP(" area, app : %s", apps.c_str());
}
-WMLayer::WMLayer(json_object* j, unsigned uuid) : tmp_state(), state(), uuid(uuid)
+WMLayer::WMLayer(json_object* j, unsigned wm_layer_id) : tmp_state(), state(), wm_layer_id(wm_layer_id)
{
this->name = jh::getStringFromJson(j, "name");
this->role_list = jh::getStringFromJson(j, "role");
- const char* type = jh::getStringFromJson(j, "type");
this->id_begin = static_cast<unsigned>(jh::getIntFromJson(j, "id_range_begin"));
this->id_end = static_cast<unsigned>(jh::getIntFromJson(j, "id_range_end"));
- if (name.size() == 0 || !type)
+ if (name.empty())
{
HMI_ERROR("Parse Error!!");
exit(1);
@@ -123,8 +122,6 @@ WMLayer::WMLayer(json_object* j, unsigned uuid) : tmp_state(), state(), uuid(uui
HMI_ERROR("INVALID");
exit(1);
}
- string str_type = type;
- this->type = (str_type == "tile") ? MANAGEMENT_TYPE::TILE : MANAGEMENT_TYPE::STACK;
}
unsigned WMLayer::getNewLayerID(const string& role)
@@ -201,9 +198,9 @@ void WMLayer::removeLayerFromState(unsigned layer)
this->tmp_state.removeLayer(layer);
}
-void WMLayer::setAreaToState(const string& app, const string& area)
+void WMLayer::attachAppToArea(const string& app, const string& area)
{
- this->tmp_state.setArea(app, area);
+ this->tmp_state.attachAppToArea(app, area);
}
void WMLayer::appendArea(const string& area)
@@ -211,7 +208,7 @@ void WMLayer::appendArea(const string& area)
this->area_list.push_back(area);
}
-void WMLayer::terminateApp(unsigned id)
+void WMLayer::appTerminated(unsigned id)
{
auto fwd_itr = std::remove_if(this->id_list.begin(), this->id_list.end(),
[id](unsigned elm) {
diff --git a/src/wm_layer.hpp b/src/wm_layer.hpp
index a6a359e..70826d4 100644
--- a/src/wm_layer.hpp
+++ b/src/wm_layer.hpp
@@ -40,7 +40,7 @@ class LayerState
const std::vector<unsigned> getIviIdList();
void addLayer(unsigned layer);
void removeLayer(unsigned layer);
- void setArea(const std::string& app, const std::string& area);
+ void attachAppToArea(const std::string& app, const std::string& area);
// Debug
void dump();
@@ -53,22 +53,15 @@ class LayerState
class WMLayer
{
public:
- enum MANAGEMENT_TYPE
- {
- TILE,
- STACK
- };
-
- explicit WMLayer(json_object* j, unsigned uuid);
+ explicit WMLayer(json_object* j, unsigned wm_layer_id);
~WMLayer() = default;
// Status & Setting API
unsigned getNewLayerID(const std::string& role);
unsigned idBegin() { return this->id_begin; }
unsigned idEnd() { return this->id_end; }
- unsigned getUuid() { return this->uuid; }
+ unsigned getWMLayerID() { return this->wm_layer_id; }
const std::string& layerName();
- MANAGEMENT_TYPE layerType() { return this->type; }
void appendArea(const std::string& area);
LayerState& getLayerState() { return tmp_state; }
WMError setLayerState(const LayerState& l);
@@ -78,20 +71,21 @@ class WMLayer
// Manipulation
void addLayerToState(unsigned layer);
void removeLayerFromState(unsigned layer);
- void setAreaToState(const std::string& app, const std::string& area);
- void terminateApp(unsigned layer);
+ void attachAppToArea(const std::string& app, const std::string& area);
void update();
void undo();
+ // Event
+ void appTerminated(unsigned layer);
+
// Debug
void dump();
private:
LayerState tmp_state;
LayerState state;
- unsigned uuid;
+ unsigned wm_layer_id;
std::string name = ""; // Layer name
- MANAGEMENT_TYPE type;
std::string role_list;
std::vector<std::string> area_list;
std::vector<unsigned> id_list;
diff --git a/src/wm_layer_control.cpp b/src/wm_layer_control.cpp
index 80dc0c9..75c35da 100644
--- a/src/wm_layer_control.cpp
+++ b/src/wm_layer_control.cpp
@@ -22,7 +22,7 @@
#include "json_helper.hpp"
#define LC_AREA_PATH "/etc/areas.json"
-#define LC_LAYER_SETTING_PATH "/etc/layers_setting.json"
+#define LC_LAYER_SETTING_PATH "/etc/layers.json"
#define LC_DEFAULT_AREA "fullscreen"
#define BACK_GROUND_LAYER "BackGroundLayer"
@@ -171,8 +171,8 @@ unsigned LayerControl::getNewLayerID(const string& role, string* layer_name)
if(ret != 0)
{
*layer_name = l->layerName();
- unsigned uid = l->getUuid();
- this->lid2wmlid[ret] = uid;
+ unsigned wmlid = l->getWMLayerID();
+ this->lid2wmlid[ret] = wmlid;
break;
}
}
@@ -181,8 +181,8 @@ unsigned LayerControl::getNewLayerID(const string& role, string* layer_name)
shared_ptr<WMLayer> LayerControl::getWMLayer(unsigned layer)
{
- unsigned uuid = this->lid2wmlid[layer];
- return this->wm_layers[uuid];
+ unsigned wm_lid = this->lid2wmlid[layer];
+ return this->wm_layers[wm_lid];
}
std::shared_ptr<WMLayer> LayerControl::getWMLayer(std::string layer_name)
@@ -574,11 +574,11 @@ WMError LayerControl::layoutChange(const WMAction& action)
// Store the state who is assigned to the area
if(wm_layer->hasLayerID(layer))
{
- wm_layer->setAreaToState(action.client->appID(), action.area);
+ wm_layer->attachAppToArea(action.client->appID(), action.area);
/* TODO: manipulate state directly
- LayerState ls = wm_layer->getLayerState();
- ls.setArea(action.client->appID(), action.area);
- wm_layer->dump(); */
+ LayerState ls = wm_layer->getLayerState();
+ ls.seattachAppToAreatArea(action.client->appID(), action.area);
+ wm_layer->dump(); */
}
}
@@ -619,11 +619,14 @@ WMError LayerControl::visibilityChange(const WMAction& action)
return ret;
}
-void LayerControl::terminateApp(const shared_ptr<WMClient> client)
+void LayerControl::appTerminated(const shared_ptr<WMClient> client)
{
for(auto& l : this->wm_layers)
{
- l->terminateApp(client->layerID());
+ if(l->hasLayerID(client->layerID()))
+ {
+ l->appTerminated(client->layerID());
+ }
}
}
@@ -724,43 +727,21 @@ void LayerControl::dispatchLayerPropChangeEvent(unsigned id,
WMError LayerControl::makeVisible(const shared_ptr<WMClient> client)
{
WMError ret = WMError::SUCCESS;
- // Don't check here the client is not nullptr
+ // Don't check here wheher client is nullptr or not
unsigned layer = client->layerID();
this->moveForeGround(client);
ilm_layerSetVisibility(layer, ILM_TRUE);
- /* for(auto& wm_layer : this->wm_layers)
- {
- if(wm_layer->hasLayerID(layer))
- {
- LayerState ls = wm_layer->getLayerState();
- ls.addLayer(layer);;
- }
- } */
-
- // Move foreground from back ground layer
- /* for(auto& wm_layer : this->wm_layers)
- {
- if(wm_layer->layerName() == "BackGroundLayer")
- {
- if(wm_layer->hasRole(client->role()))
- {
- LayerState ls = wm_layer->getLayerState();
- ls.removeLayer(layer);
- }
- break;
- }
- } */
-
return ret;
}
WMError LayerControl::makeInvisible(const shared_ptr<WMClient> client)
{
WMError ret = WMError::SUCCESS;
- unsigned layer = client->layerID(); // Don't check here the client is not nullptr
+ // Don't check here the client is not nullptr
+ unsigned layer = client->layerID();
bool mv_ok = this->moveBackGround(client);
@@ -770,19 +751,6 @@ WMError LayerControl::makeInvisible(const shared_ptr<WMClient> client)
ilm_layerSetVisibility(layer, ILM_FALSE);
}
- //ilm_layerSetDestinationRectangle(layer, 0, 0, 0, 0);
-
- /* for(auto& wm_layer : this->wm_layers)
- {
- if(wm_layer->hasLayerID(layer))
- {
- LayerState ls = wm_layer->getLayerState();
- ls.removeLayer(layer);;
- }
- } */
-
-
-
return ret;
}
@@ -908,4 +876,4 @@ bool LayerControl::moveForeGround(const shared_ptr<WMClient> client)
return ret;
}
-} // namespace wm
+} // namespace wm \ No newline at end of file
diff --git a/src/wm_layer_control.hpp b/src/wm_layer_control.hpp
index fa7c7cb..fef71ff 100644
--- a/src/wm_layer_control.hpp
+++ b/src/wm_layer_control.hpp
@@ -46,9 +46,10 @@ class LayerControlCallbacks {
// callback functions
std::function<void(unsigned, unsigned)> surfaceCreated;
std::function<void(unsigned)> surfaceDestroyed;
- /* std::function<void(unsigned)> surfaceDestroyed;
+ /*
std::function<void(unsigned)> layerCreated;
- std::function<void(unsigned)> layerDestroyed; */
+ std::function<void(unsigned)> layerDestroyed;
+ */
};
class WMLayer;
@@ -71,19 +72,14 @@ class LayerControl
void setupArea(const rectangle& base_rct, double scaling);
Screen getScreenInfo();
double scale();
- // void setRenderOrder(const std::vector<unsigned> layer_render_order);
- // std::vector<unsigned> getAllRenderOrder();
- // std::vector<std::shared_ptr<WMLayer>>& getAllLayers();
- // std::vector<unsigned> getRenderOrder(const std::string& layer_name);
WMError updateLayer(LayerState& layer_state);
WMError renderLayers();
WMError renderLayersRemote();
WMError setXDGSurfaceOriginSize(unsigned surface);
- // WMError renderWMLayers();
void undoUpdate();
WMError layoutChange(const WMAction& action);
WMError visibilityChange(const WMAction &action);
- void terminateApp(const std::shared_ptr<WMClient> client);
+ void appTerminated(const std::shared_ptr<WMClient> client);
// Don't use this function.
void dispatchCreateEvent(ilmObjectType object, unsigned id, bool created);
@@ -115,4 +111,4 @@ class LayerControl
LayerControlCallbacks cb;
};
-} // namespace wm
+} // namespace wm \ No newline at end of file