aboutsummaryrefslogtreecommitdiffstats
path: root/src/app.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/app.cpp')
-rw-r--r--src/app.cpp21
1 files changed, 7 insertions, 14 deletions
diff --git a/src/app.cpp b/src/app.cpp
index afd690f..b9338a9 100644
--- a/src/app.cpp
+++ b/src/app.cpp
@@ -673,6 +673,11 @@ result<int> App::api_request_surface(char const *drawing_name) {
std::string role = this->app2role_[std::string(drawing_name)];
this->role2surfaceid_[role] = id;
+ // Set map of (role, app)
+ // If the new app which has the same role which is had by existing app is requested,
+ // the role is given to the new app.
+ this->role2app_[role] = std::string(drawing_name);
+
return Ok<int>(id);
}
@@ -853,7 +858,7 @@ void App::deactivate(int id) {
}
void App::deactivate(std::string role) {
- std::string app = this->roleToApp(role);
+ std::string app = this->role2app_[role];
auto const &id = this->lookup_id(app.c_str());
if (!id) {
HMI_ERROR("wm", "Surface does not exist");
@@ -1036,7 +1041,7 @@ void App::setSurfaceSize(const char* role, const char* area) {
size.x, size.y, size.w, size.h);
// Emit syncDraw event
- const char* app = this->roleToApp(role).c_str();
+ const char* app = this->role2app_[role].c_str();
this->emit_syncdraw(app, area,
size.x, size.y, size.w, size.h);
@@ -1044,18 +1049,6 @@ void App::setSurfaceSize(const char* role, const char* area) {
this->enqueue_flushdraw(surface_id);
}
-std::string App::roleToApp(std::string role) {
- HMI_DEBUG("wm", "Call");
-
- for (auto itr = this->app2role_.begin();
- itr != this->app2role_.end(); itr++) {
- if (role == itr->second) {
- return itr->first;
- }
- }
- return std::string("none");
-}
-
extern const char* kDefaultAppDb;
int App::loadAppDb() {
HMI_DEBUG("wm", "Call");