Bind surface properties to adding floating surface
authorKazumasa Mitsunari <knimitz@witz-inc.co.jp>
Sun, 10 Jun 2018 10:09:19 +0000 (19:09 +0900)
committerKazumasa Mitsunari <knimitz@witz-inc.co.jp>
Mon, 11 Jun 2018 00:01:10 +0000 (09:01 +0900)
Change-Id: Ib582d4d40ccaebf24c2990a4a0d04bcc1a266f72
Signed-off-by: Kazumasa Mitsunari <knimitz@witz-inc.co.jp>
src/app.cpp
src/app.hpp
src/applist.cpp
src/applist.hpp
src/controller_hooks.hpp
src/wayland_ivi_wm.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*/) {}
 
index e53824c..0816732 100644 (file)
@@ -235,6 +235,7 @@ struct App
     // 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);
 
     // Do not use this function
     //static int processTimerHandler(sd_event_source *s, uint64_t usec, void *userdata);
index 99f7fe4..5d7dce4 100644 (file)
@@ -91,7 +91,7 @@ unsigned AppList::currentRequestNumber() const
     return this->current_req;
 }
 
-WMError AppList::lookUpFloatingSurface(unsigned pid, unsigned *surface)
+WMError AppList::popFloatingSurface(unsigned pid, unsigned *surface)
 {
     WMError ret = WMError::NO_ENTRY;
 
@@ -108,7 +108,7 @@ WMError AppList::lookUpFloatingSurface(unsigned pid, unsigned *surface)
     return ret;
 }
 
-WMError AppList::lookUpFloatingSurface(const std::string &appid, unsigned *surface)
+WMError AppList::popFloatingSurface(const std::string &appid, unsigned *surface)
 {
     HMI_ERROR("wm", "This function is not implemented");
     return WMError::SUCCESS;
index 90fd6bd..b25ca19 100644 (file)
@@ -51,8 +51,8 @@ class AppList
     int  countClient() const;
     std::shared_ptr<WMClient> lookUpClient(const std::string &appid);
     void removeSurface(unsigned surface);
-    WMError lookUpFloatingSurface(unsigned pid, unsigned *surface);
-    WMError lookUpFloatingSurface(const std::string &appid, unsigned *surface);
+    WMError popFloatingSurface(unsigned pid, unsigned *surface);
+    WMError popFloatingSurface(const std::string &appid, unsigned *surface);
     WMError appendRole(const std::string &appid, const std::string &role, unsigned surface);
     void addFloatingClient(const std::string &appid, unsigned layer, const std::string &role);
     void addFloatingSurface(unsigned surface, unsigned pid);
index b8c142c..a7d8068 100644 (file)
@@ -35,6 +35,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 b26ce7e..7e94208 100644 (file)
@@ -617,6 +617,7 @@ void controller::surface_stats_received(struct surface *s, uint32_t surface_id,
     HMI_DEBUG("wm", "compositor::surface %s @ %d f %u pid %u",
               __func__, surface_id, frame_count, pid);
     this->sprops[s->id].id = pid;
+    this->chooks->surface_properties(surface_id, pid);
 }
 
 void controller::surface_created(uint32_t id)