Bind surface properties to adding floating surface
[apps/agl-service-windowmanager.git] / src / app.cpp
index 69930a2..936a8bc 100644 (file)
@@ -1117,6 +1117,10 @@ void App::send_event(char const *evname, char const *label, char const *area,
  */
 void App::surface_created(uint32_t surface_id)
 {
+    // For set role function
+    HMI_DEBUG("wm", "Get surface pid");
+    this->controller->get_surface_properties(surface_id);
+
     auto layer_id = this->layers.get_layer_id(surface_id);
     if (!layer_id)
     {
@@ -1151,6 +1155,12 @@ void App::surface_removed(uint32_t surface_id)
     app_list->removeSurface(surface_id);
 }
 
+void App::surface_properties(unsigned surface_id, unsigned pid)
+{
+    HMI_DEBUG("wm", "get surface properties");
+    this->app_list->addFloatingSurface(surface_id, pid);
+}
+
 void App::emit_activated(char const *label)
 {
     this->send_event(kListEventName[Event_Active], label);
@@ -1305,12 +1315,12 @@ bool App::api_set_role(char const *appid, char const *drawing_name, unsigned pid
     if(0 != pid){
         // search floating surfaceID from pid if pid is designated.
         // It is not good that application request with its pid
-        wm_err = app_list->lookUpFloatingSurface(pid, &surface);
+        wm_err = app_list->popFloatingSurface(pid, &surface);
     }
     else{
         // get floating surface with appid. If WM queries appid from pid,
         // WM can bind surface and role with appid(not implemented yet)
-        //wm_err = app_list->lookUpFloatingSurface(id);
+        //wm_err = app_list->popFloatingSurface(id);
     }
     if(wm_err != WMError::SUCCESS){
         HMI_ERROR("wm", "No floating surface for app: %s", id.c_str());
@@ -1561,6 +1571,11 @@ void controller_hooks::surface_removed(uint32_t surface_id)
     this->app->surface_removed(surface_id);
 }
 
+void controller_hooks::surface_properties(uint32_t surface_id, uint32_t pid)
+{
+    this->app->surface_properties(surface_id, pid);
+}
+
 void controller_hooks::surface_visibility(uint32_t /*surface_id*/,
                                           uint32_t /*v*/) {}