get callback of surface_stats_received
authorKazumasa Mitsunari <knimitz@witz-inc.co.jp>
Mon, 20 Aug 2018 05:24:54 +0000 (14:24 +0900)
committerKazumasa Mitsunari <knimitz@witz-inc.co.jp>
Mon, 20 Aug 2018 05:26:05 +0000 (14:26 +0900)
Change-Id: I2318752ba00f58c197ba42166c2ab91ea4c15bce
Signed-off-by: Kazumasa Mitsunari <knimitz@witz-inc.co.jp>
src/controller_hooks.hpp
src/wayland_ivi_wm.cpp
src/wayland_ivi_wm.hpp
src/window_manager.cpp
src/window_manager.hpp

index dd0a3aa..ae88187 100644 (file)
@@ -34,6 +34,7 @@ struct controller_hooks
     void surface_removed(uint32_t surface_id);
     void surface_visibility(uint32_t surface_id, uint32_t v);
     void surface_destination_rectangle(uint32_t surface_id, uint32_t x, uint32_t y, uint32_t w, uint32_t h);
+    void surface_properties(uint32_t surface_id, uint32_t pid);
 };
 
 } // namespace wm
index 8b04c64..48d7bb4 100644 (file)
@@ -610,6 +610,7 @@ void controller::surface_stats_received(uint32_t surface_id,
 {
     HMI_DEBUG("wm", "compositor::surface %s @ %d f %u pid %u",
               __func__, surface_id, frame_count, pid);
+    this->sprops[surface_id].pid = pid;
 }
 
 void controller::surface_created(uint32_t id)
index b515a06..d8915a1 100644 (file)
@@ -166,6 +166,7 @@ struct surface_properties
     int32_t orientation;
     int32_t visibility;
     float opacity;
+    uint32_t pid;
 };
 
 /**
index 24b6f30..2f8e3e9 100644 (file)
@@ -608,6 +608,45 @@ void WindowManager::surface_removed(uint32_t surface_id)
     g_app_list.removeSurface(surface_id);
 }
 
+void WindowManager::surface_properties(unsigned surface_id, unsigned pid)
+{
+    HMI_DEBUG("wm", "get surface properties");
+
+    // search pid from surfaceID
+    /*json_object *response;
+    afb_service_call_sync("afm-main", "runners", nullptr, &response);
+
+    // retrieve appid from pid from application manager
+    std::string appid = "";
+    if(response == nullptr)
+    {
+        HMI_ERROR("wm", "No runners");
+    }
+    else
+    {
+        // check appid then add it to the client
+        HMI_INFO("wm", "Runners:%s", json_object_get_string(response));
+        int size = json_object_array_length(response);
+        for(int i = 0; i < size; i++)
+        {
+            json_object *j = json_object_array_get_idx(response, i);
+            const char* id = jh::getStringFromJson(j, "id");
+            int runid      = jh::getIntFromJson(j, "runid");
+            if(id && (runid > 0))
+            {
+                if(runid == pid)
+                {
+                    appid = id;
+                    break;
+                }
+            }
+        }
+    }
+    json_object_put(response);
+
+    g_app_list.addFloatingSurface(appid, surface_id, pid);*/
+}
+
 void WindowManager::removeClient(const std::string &appid)
 {
     HMI_DEBUG("wm", "Remove clinet %s from list", appid.c_str());
@@ -1553,4 +1592,9 @@ void controller_hooks::surface_destination_rectangle(uint32_t /*surface_id*/,
                                                      uint32_t /*w*/,
                                                      uint32_t /*h*/) {}
 
+void controller_hooks::surface_properties(uint32_t surface_id, uint32_t pid)
+{
+    this->wmgr->surface_properties(surface_id, pid);
+}
+
 } // namespace wm
index 6cbd355..3ad9cc7 100644 (file)
@@ -14,8 +14,8 @@
  * limitations under the License.
  */
 
-#ifndef TMCAGLWM_APP_HPP
-#define TMCAGLWM_APP_HPP
+#ifndef WINDOW_MANAGER_HPP
+#define WINDOW_MANAGER_HPP
 
 #include <atomic>
 #include <memory>
@@ -224,6 +224,7 @@ class WindowManager
     // Events from the compositor we are interested in
     void surface_created(uint32_t surface_id);
     void surface_removed(uint32_t surface_id);
+    void surface_properties(uint32_t surface_id, uint32_t pid);
 
     void removeClient(const std::string &appid);
     void exceptionProcessForTransition();
@@ -286,4 +287,4 @@ class WindowManager
 
 } // namespace wm
 
-#endif // TMCAGLWM_APP_HPP
+#endif // WINDOW_MANAGER_HPP