change API addFloatingSurface to put into appid
authorKazumasa Mitsunari <knimitz@witz-inc.co.jp>
Fri, 13 Jul 2018 05:02:42 +0000 (14:02 +0900)
committerKazumasa Mitsunari <knimitz@witz-inc.co.jp>
Fri, 13 Jul 2018 05:08:58 +0000 (14:08 +0900)
Change-Id: Iffc1d319e4d26005e3726f9e40c99a2d3548ddfe
Signed-off-by: Kazumasa Mitsunari <knimitz@witz-inc.co.jp>
src/applist.cpp
src/applist.hpp
src/window_manager.cpp

index c083c20..b06dee8 100644 (file)
@@ -65,7 +65,7 @@ AppList::~AppList() {}
  * @attention This function should be called once for the app
  *            Caller should take care not to be called more than once.
  */
-void AppList::addClient(const std::string &appid, unsigned layer, unsigned surface, const std::string &role)
+void AppList::addClient(const string &appid, unsigned layer, unsigned surface, const string &role)
 {
     std::lock_guard<std::mutex> lock(this->mtx);
     shared_ptr<WMClient> client = std::make_shared<WMClient>(appid, layer, surface, role);
@@ -197,19 +197,19 @@ WMError AppList::popFloatingSurface(unsigned pid, unsigned *surface)
 
 // =================== Floating(Temporary) surface/client API ===================
 
-WMError AppList::popFloatingSurface(const std::string &appid, unsigned *surface)
+WMError AppList::popFloatingSurface(const string &appid, unsigned *surface)
 {
     HMI_ERROR("wm", "This function is not implemented");
     return WMError::SUCCESS;
 }
 
-void AppList::addFloatingClient(const std::string &appid, unsigned layer, const std::string &role)
+void AppList::addFloatingClient(const string &appid, unsigned layer, const string &role)
 {
 }
 
-void AppList::addFloatingSurface(unsigned surface, unsigned pid)
+void AppList::addFloatingSurface(const string &appid, unsigned surface, unsigned pid)
 {
-    struct FloatingSurface fsurface{surface, pid};
+    struct FloatingSurface fsurface{appid, surface, pid};
     this->floating_surfaces.push_back(fsurface);
     this->dumpFloatingSurfaces();
 }
@@ -217,17 +217,18 @@ void AppList::addFloatingSurface(unsigned surface, unsigned pid)
 void AppList::removeFloatingSurface(unsigned surface)
 {
     this->dumpFloatingSurfaces();
-    auto fwd_itr = std::remove_if(this->floating_surfaces.begin(), this->floating_surfaces.end(),
-                                       [surface](FloatingSurface x) {
-                                           return x.surface_id == surface;
-                                       });
+    auto fwd_itr = std::remove_if(
+        this->floating_surfaces.begin(), this->floating_surfaces.end(),
+        [surface](FloatingSurface x) {
+            return x.surface_id == surface;
+        });
     if(fwd_itr != this->floating_surfaces.cend()){
         HMI_INFO("wm", "remove floating surface: %d", surface);
     }
     this->floating_surfaces.erase(fwd_itr, this->floating_surfaces.end());
 }
 
-WMError AppList::appendRole(const std::string &id, const std::string &role, unsigned surface)
+WMError AppList::appendRole(const string &id, const string &role, unsigned surface)
 {
     WMError wm_err = WMError::NO_ENTRY;
     if (this->contains(id))
index 8c82e7a..4e493b1 100644 (file)
@@ -33,6 +33,7 @@ using std::experimental::optional; */
 
 struct FloatingSurface
 {
+    std::string appid;
     unsigned surface_id;
     unsigned pid;
 };
@@ -60,7 +61,7 @@ class AppList
 
     // Floating surface
     void addFloatingClient(const std::string &appid, unsigned layer, const std::string &role);
-    void addFloatingSurface(unsigned surface, unsigned pid);
+    void addFloatingSurface(const std::string &appid, unsigned surface, unsigned pid);
     WMError popFloatingSurface(unsigned pid, unsigned *surface);
     WMError popFloatingSurface(const std::string &appid, unsigned *surface);
     void removeFloatingSurface(unsigned surface);
index 8a75f4b..654d4b5 100644 (file)
@@ -678,6 +678,10 @@ void WindowManager::send_event(char const *evname, char const *label, char const
  */
 void WindowManager::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)
     {
@@ -690,6 +694,12 @@ void WindowManager::surface_created(uint32_t surface_id)
 
     this->controller->layers[*layer_id]->add_surface(surface_id);
     this->layout_commit();
+
+    // search pid from surfaceID
+
+    // pick up appid from pid from application manager
+
+    // check appid then add it to the client
 }
 
 void WindowManager::surface_removed(uint32_t surface_id)