Remove unnecesarry member variable: role2surfaceid_
[apps/agl-service-windowmanager.git] / src / app.cpp
index 712ec3b..c611501 100644 (file)
@@ -582,7 +582,11 @@ void App::allocateWindowResource(char const *event, char const *drawing_name,
         json_object_object_add(json_in, "area", json_object_new_string(new_area));
     }
 
-    this->pm_.inputEvent(json_in);
+    // Set input event data
+    this->pm_.setInputEventData(json_in);
+
+    // Execute state transition
+    this->pm_.executeStateTransition();
 
     // Release json_object
     json_object_put(json_in);
@@ -809,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);
 
@@ -1043,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);
 
@@ -1068,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) {