aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/app.cpp6
-rw-r--r--src/applist.cpp40
-rw-r--r--src/applist.hpp8
3 files changed, 50 insertions, 4 deletions
diff --git a/src/app.cpp b/src/app.cpp
index 4d9e969..7f19572 100644
--- a/src/app.cpp
+++ b/src/app.cpp
@@ -1303,11 +1303,11 @@ 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 = g_app_list.lookUpFloatingSurface(pid, &surface);
+ wm_err = g_app_list.lookUpFloatingSurface(pid, &surface);
}
else{
// get floating surface with appid. If WM queries appid from pid,
- // WM can bind appid and role to surface (not implemented yet)
+ // WM can bind surface and role with appid(not implemented yet)
//wm_err = g_app_list.lookUpFloatingSurface(id);
}
if(wm_err != WMError::SUCCESS){
@@ -1322,7 +1322,7 @@ bool App::api_set_role(char const *appid, char const *drawing_name, unsigned pid
{
HMI_INFO("wm", "Add role: %s with surface: %d. Client %s has multi surfaces.",
role.c_str(), surface, id.c_str());
- //wm_err = g_app_list.appendRole(id, surface, role);
+ wm_err = g_app_list.appendRole(id, role, surface);
if(wm_err != WMError::SUCCESS){
HMI_INFO("wm", errorDescription(wm_err));
}
diff --git a/src/applist.cpp b/src/applist.cpp
index 9b06c84..64f5f64 100644
--- a/src/applist.cpp
+++ b/src/applist.cpp
@@ -25,6 +25,11 @@ using std::vector;
namespace wm
{
+struct FloatingSurface{
+ unsigned surface_id;
+ unsigned pid;
+};
+
AppList::AppList()
: req_list(0),
app2client(0),
@@ -93,7 +98,40 @@ unsigned AppList::currentRequestNumber() const
return this->current_req;
}
-// Is this function necessary ?
+WMError AppList::lookUpFloatingSurface(unsigned pid, unsigned *surface)
+{
+ WMError ret = WMError::NO_ENTRY;
+
+ for (auto itr = this->floating_surfaces.begin(); itr != this->floating_surfaces.end(); ++itr)
+ {
+ if(pid == itr->pid){
+ *surface = itr->surface_id;
+ itr = this->floating_surfaces.erase(itr);
+ ret = WMError::SUCCESS;
+ HMI_DEBUG("wm", "Erase surface %d", *surface);
+ break;
+ }
+ }
+ return ret;
+}
+
+WMError AppList::lookUpFloatingSurface(const std::string &appid, unsigned *surface)
+{
+ return WMError::SUCCESS;
+}
+
+WMError AppList::appendRole(const std::string &id, const std::string &role, unsigned surface)
+{
+ WMError wm_err = WMError::NO_ENTRY;
+ if (this->contains(id))
+ {
+ auto x = this->lookUpClient(id);
+ x->addSurface(role, surface);
+ wm_err = WMError::SUCCESS;
+ }
+ return wm_err;
+}
+
unsigned AppList::getRequestNumber(const string &appid) const
{
for (const auto &x : this->req_list)
diff --git a/src/applist.hpp b/src/applist.hpp
index 0f2285b..92310fd 100644
--- a/src/applist.hpp
+++ b/src/applist.hpp
@@ -30,6 +30,8 @@ namespace wm
/* using std::experimental::nullopt;
using std::experimental::optional; */
+struct FloatingSurface;
+
class AppList
{
public:
@@ -45,6 +47,9 @@ 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 appendRole(const std::string &id, const std::string &role, unsigned surface);
// Request Interface
unsigned currentRequestNumber() const;
@@ -71,6 +76,9 @@ class AppList
std::vector<WMRequest> req_list;
std::unordered_map<std::string, std::shared_ptr<WMClient>> app2client;
unsigned current_req;
+
+ std::vector<struct FloatingSurface> floating_surfaces;
+ //std::vector<FloatingSurface> floating_clients;
};
} // namespace wm