#include <systemd/sd-event.h>
}
+using std::string;
+using std::vector;
+
namespace wm
{
return 0;
}
-static void onStateTransitioned(std::vector<WMAction> actions)
+static void onStateTransitioned(vector<WMAction> actions)
{
g_context->startTransitionWrapper(actions);
}
pending_events(false)
{
char const *path_layers_json = getenv("AFM_APP_INSTALL_DIR");
- std::string path;
+ string path;
if (!path_layers_json)
{
HMI_ERROR("AFM_APP_INSTALL_DIR is not defined");
- path = std::string(path_layers_json);
+ path = string(path_layers_json);
}
else
{
- path = std::string(path_layers_json) + std::string("/etc/layers.json");
+ path = string(path_layers_json) + string("/etc/layers.json");
}
try
// so convert role old to new
const char *role = this->convertRoleOldToNew(drawing_name);
- auto lid = this->layers.get_layer_id(std::string(role));
+ auto lid = this->layers.get_layer_id(string(role));
if (!lid)
{
/**
* register drawing_name as fallback and make it displayed.
*/
- lid = this->layers.get_layer_id(std::string("fallback"));
+ lid = this->layers.get_layer_id(string("fallback"));
HMI_DEBUG("%s is not registered in layers.json, then fallback as normal app", role);
if (!lid)
{
}
// add client into the db
- std::string appid_str(appid);
- g_app_list.addClient(appid_str, *lid, id, std::string(role));
+ string appid_str(appid);
+ g_app_list.addClient(appid_str, *lid, id, string(role));
// Set role map of (new, old)
- this->rolenew2old[role] = std::string(drawing_name);
+ this->rolenew2old[role] = string(drawing_name);
return Ok<int>(id);
}
// so convert role old to new
const char *role = this->convertRoleOldToNew(drawing_name);
- auto lid = this->layers.get_layer_id(std::string(role));
+ auto lid = this->layers.get_layer_id(string(role));
unsigned sid = std::stol(ivi_id);
if (!lid)
/**
* register drawing_name as fallback and make it displayed.
*/
- lid = this->layers.get_layer_id(std::string("fallback"));
+ lid = this->layers.get_layer_id(string("fallback"));
HMI_DEBUG("%s is not registered in layers.json, then fallback as normal app", role);
if (!lid)
{
this->layout_commit();
// add client into the db
- std::string appid_str(appid);
- g_app_list.addClient(appid_str, *lid, sid, std::string(role));
+ string appid_str(appid);
+ g_app_list.addClient(appid_str, *lid, sid, string(role));
// Set role map of (new, old)
- this->rolenew2old[role] = std::string(drawing_name);
+ this->rolenew2old[role] = string(drawing_name);
return nullptr;
}
// so convert role old to new
const char *c_role = this->convertRoleOldToNew(drawing_name);
- std::string id = appid;
- std::string role = c_role;
- std::string area = drawing_area;
+ string id = appid;
+ string role = c_role;
+ string area = drawing_area;
Task task = Task::TASK_ALLOCATE;
unsigned req_num = 0;
WMError ret = WMError::UNKNOWN;
/*
* Check Phase
*/
- std::string id = appid;
- std::string role = c_role;
- std::string area = ""; //drawing_area;
+ string id = appid;
+ string role = c_role;
+ string area = ""; //drawing_area;
Task task = Task::TASK_RELEASE;
unsigned req_num = 0;
WMError ret = WMError::UNKNOWN;
// so convert role old to new
const char *c_role = this->convertRoleOldToNew(drawing_name);
- std::string id = appid;
- std::string role = c_role;
+ string id = appid;
+ string role = c_role;
unsigned current_req = g_app_list.currentRequestNumber();
bool result = g_app_list.setEndDrawFinished(current_req, id, role);
g_app_list.removeSurface(surface_id);
}
-void WindowManager::removeClient(const std::string &appid)
+void WindowManager::removeClient(const string &appid)
{
HMI_DEBUG("Remove clinet %s from list", appid.c_str());
g_app_list.removeClient(appid);
this->processNextRequest();
}
-void WindowManager::startTransitionWrapper(std::vector<WMAction> &actions)
+void WindowManager::startTransitionWrapper(vector<WMAction> &actions)
{
WMError ret;
unsigned req_num = g_app_list.currentRequestNumber();
{
goto proc_remove_request;
}
- std::string appid = g_app_list.getAppID(*surface_id, act.role, &found);
+ string appid = g_app_list.getAppID(*surface_id, act.role, &found);
if (!found)
{
if (TaskVisible::INVISIBLE == act.visible)
goto error;
}
}
- act.appid = appid;
+ auto client = g_app_list.lookUpClient(appid);
+ act.req_num = req_num;
+ act.client = client;
}
ret = g_app_list.setAction(req_num, act);
optional<int> WindowManager::lookup_id(char const *name)
{
- return this->id_alloc.lookup(std::string(name));
+ return this->id_alloc.lookup(string(name));
}
-optional<std::string> WindowManager::lookup_name(int id)
+optional<string> WindowManager::lookup_name(int id)
{
return this->id_alloc.lookup(id);
}
return 0;
}
-void WindowManager::surface_set_layout(int surface_id, const std::string& area)
+void WindowManager::surface_set_layout(int surface_id, const string& area)
{
if (!this->controller->surface_exists(surface_id))
{
this->send_event(kListEventName[Event_SyncDraw], label, area, x, y, w, h);
}
-void WindowManager::emit_syncdraw(const std::string &role, const std::string &area)
+void WindowManager::emit_syncdraw(const string &role, const string &area)
{
compositor::rect rect = this->layers.getAreaSize(area);
this->send_event(kListEventName[Event_SyncDraw],
}
}
-WMError WindowManager::setRequest(const std::string& appid, const std::string &role, const std::string &area,
+WMError WindowManager::setRequest(const string& appid, const string &role, const string &area,
Task task, unsigned* req_num)
{
if (!g_app_list.contains(appid))
ret = WMError::NO_ENTRY;
return ret;
}
- std::string req_area = trigger.area;
+ string req_area = trigger.area;
if (trigger.task == Task::TASK_ALLOCATE)
{
// TODO: application requests by old role,
// so convert role new to old for emitting event
- std::string old_role = this->rolenew2old[action.role];
+ string old_role = this->rolenew2old[action.role];
this->emit_syncdraw(old_role, action.area);
/* TODO: emit event for app not subscriber
// Make it deactivate here
for (const auto &x : actions)
{
- if (g_app_list.contains(x.appid))
+ if (g_app_list.contains(x.client->appID()))
{
- auto client = g_app_list.lookUpClient(x.appid);
+ auto client = g_app_list.lookUpClient(x.client->appID());
this->deactivate(client->surfaceID(x.role));
}
}
if(act.visible != TaskVisible::NO_CHANGE)
{
// layout change
- if(!g_app_list.contains(act.appid)){
+ if(!g_app_list.contains(act.client->appID())){
ret = WMError::NOT_REGISTERED;
}
ret = this->layoutChange(act);
{
// TODO: application requests by old role,
// so convert role new to old for emitting event
- std::string old_role = this->rolenew2old[act_flush.role];
+ string old_role = this->rolenew2old[act_flush.role];
this->emit_flushdraw(old_role.c_str());
}
// Visibility is not change -> no redraw is required
return WMError::SUCCESS;
}
- auto client = g_app_list.lookUpClient(action.appid);
+ auto client = g_app_list.lookUpClient(action.client->appID());
unsigned surface = client->surfaceID(action.role);
if (surface == 0)
{
WMError WindowManager::visibilityChange(const WMAction &action)
{
HMI_SEQ_DEBUG(g_app_list.currentRequestNumber(), "Change visibility");
- if(!g_app_list.contains(action.appid)){
+ if(!g_app_list.contains(action.client->appID()))
+ {
return WMError::NOT_REGISTERED;
}
- auto client = g_app_list.lookUpClient(action.appid);
+ auto client = g_app_list.lookUpClient(action.client->appID());
unsigned surface = client->surfaceID(action.role);
if(surface == 0)
{
return WMError::SUCCESS;
}
-WMError WindowManager::setSurfaceSize(unsigned surface, const std::string &area)
+WMError WindowManager::setSurfaceSize(unsigned surface, const string &area)
{
this->surface_set_layout(surface, area);
{
if(action.visible != TaskVisible::INVISIBLE)
{
- json_object_array_add(jarray, json_object_new_string(action.appid.c_str()));
+ json_object_array_add(jarray, json_object_new_string(action.client->appID().c_str()));
}
}
json_object_object_add(j, kKeyIds, jarray);
char const *afm_app_install_dir = getenv("AFM_APP_INSTALL_DIR");
HMI_DEBUG("afm_app_install_dir:%s", afm_app_install_dir);
- std::string file_name;
+ string file_name;
if (!afm_app_install_dir)
{
HMI_ERROR("AFM_APP_INSTALL_DIR is not defined");
}
else
{
- file_name = std::string(afm_app_install_dir) + std::string("/etc/old_roles.db");
+ file_name = string(afm_app_install_dir) + string("/etc/old_roles.db");
}
// Load old_role.db
return -1;
}
- this->roleold2new[old_role] = std::string(new_role);
+ this->roleold2new[old_role] = string(new_role);
}
// Check