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){
{
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));
}
namespace wm
{
+struct FloatingSurface{
+ unsigned surface_id;
+ unsigned pid;
+};
+
AppList::AppList()
: req_list(0),
app2client(0),
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)
/* using std::experimental::nullopt;
using std::experimental::optional; */
+struct FloatingSurface;
+
class AppList
{
public:
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;
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