Fix output debug message
[apps/agl-service-windowmanager.git] / src / window_manager.cpp
index 6b2ecf9..dec7752 100644 (file)
@@ -172,6 +172,9 @@ int WindowManager::init()
     lmcb.surfaceCreated = [&](unsigned pid, unsigned surface){
         this->surface_created(surface);
         };
+    lmcb.surfaceDestroyed = [&](unsigned surface){
+        this->surface_removed(surface);
+    };
     this->lc->init(lmcb);
     this->loadOldRoleDb();
 
@@ -201,7 +204,7 @@ int WindowManager::init()
               css_bg.w, css_bg.h, dp_bg.left(), dp_bg.top(), dp_bg.width(), dp_bg.height());
 
     double scale = static_cast<double>(dp_bg.height()) / css_bg.h;
-    this->lc->setupArea(scale);
+    this->lc->setupArea(dp_bg, scale);
 
     /* this->display->add_global_handler(
         "wl_output", [this](wl_registry *r, uint32_t name, uint32_t v) {
@@ -261,7 +264,7 @@ result<int> WindowManager::api_request_surface(char const *appid, char const *dr
     const char *role = this->convertRoleOldToNew(drawing_name);
     string l_name;
     string s_appid = appid;
-    string s_role = drawing_name;
+    string s_role = role;
 
     if(!g_app_list.contains(s_appid))
     {
@@ -733,18 +736,25 @@ void WindowManager::send_event(char const *evname, char const *label, char const
  */
 void WindowManager::surface_created(uint32_t surface_id)
 {
-    HMI_DEBUG("current : %d", surface_id);
     if(this->tmp_surface2app.count(surface_id) != 0)
     {
         string appid = this->tmp_surface2app[surface_id];
         this->tmp_surface2app.erase(surface_id);
-        auto client = g_app_list.lookUpClient(appid);
-        bool ret = client->addSurface(surface_id);
-        if(!ret)
+        if(g_app_list.contains(appid))
         {
-            HMI_ERROR("Failed to add surface to client %s", client->appID().c_str());
+            auto client = g_app_list.lookUpClient(appid);
+            WMError ret = client->addSurface(surface_id);
+            HMI_INFO("Add surface %d to \"%s\"", surface_id, appid.c_str());
+            if(ret != WMError::SUCCESS)
+            {
+                HMI_ERROR("Failed to add surface to client %s", client->appID().c_str());
+            }
         }
     }
+    else
+    {
+        HMI_NOTICE("Unknown surface %d", surface_id);
+    }
     /* this->controller->get_surface_properties(surface_id, IVI_WM_PARAM_SIZE);
 
     auto layer_id = this->layers.get_layer_id(surface_id);
@@ -1317,7 +1327,7 @@ WMError WindowManager::startTransition(unsigned req_num)
                 //this->deactivate(client->surfaceID(x.role));
             } */
         }
-        this->lc->commitChange();
+        this->lc->renderLayers();
         ret = WMError::NO_LAYOUT_CHANGE;
     }
     return ret;
@@ -1361,7 +1371,7 @@ WMError WindowManager::doEndDraw(unsigned req_num)
             //this->lc_enddraw(act.role.c_str());
         }
     }
-    this->lc->commitChange();
+    this->lc->renderLayers();
 
     HMI_SEQ_INFO(req_num, "emit flushDraw");