Remove unnecesarry member variable: role2surfaceid_
[apps/agl-service-windowmanager.git] / src / app.cpp
index d5fa3b4..c611501 100644 (file)
@@ -813,9 +813,6 @@ result<int> App::api_request_surface(char const *drawing_name) {
          HMI_DEBUG("wm", "Set main_surface id to %u", id);
       }
 
-      // Set map of (role, surface_id)
-      this->role2surfaceid_[role] = id;
-
       // Set map of (role, drawing_name)
       this->role2drawingname_[role] = std::string(drawing_name);
 
@@ -1047,22 +1044,21 @@ void App::setSurfaceSize(const char* role, const char* area) {
     compositor::rect size = this->lm_.getAreaSize(area);
 
     // Set destination to the display rectangle
-    int surface_id = this->role2surfaceid_[role];
-
-    if (!this->controller->surface_exists(surface_id)) {
+    auto const &surface_id = this->lookup_id(role);
+    if (!this->controller->surface_exists(*surface_id)) {
         // Block until all pending request are processed by wayland display server
         // because waiting for the surface of new app is created
         this->display->roundtrip();
     }
-    auto &s = this->controller->surfaces[surface_id];
+    auto &s = this->controller->surfaces[*surface_id];
     s->set_destination_rectangle(size.x, size.y, size.w, size.h);
     this->layout_commit();
 
     // Update area information
-    this->area_info[surface_id].x = size.x;
-    this->area_info[surface_id].y = size.y;
-    this->area_info[surface_id].w = size.w;
-    this->area_info[surface_id].h = size.h;
+    this->area_info[*surface_id].x = size.x;
+    this->area_info[*surface_id].y = size.y;
+    this->area_info[*surface_id].w = size.w;
+    this->area_info[*surface_id].h = size.h;
     HMI_DEBUG("wm", "Surface rect { %d, %d, %d, %d }",
               size.x, size.y, size.w, size.h);
 
@@ -1072,7 +1068,7 @@ void App::setSurfaceSize(const char* role, const char* area) {
                         size.x, size.y, size.w, size.h);
 
     // Enqueue flushDraw event
-    this->enqueue_flushdraw(surface_id);
+    this->enqueue_flushdraw(*surface_id);
 }
 
 void App::setAccelPedalPos(double val) {