From bc95ea7e991f78c4753a845b0daa6687a5abbb98 Mon Sep 17 00:00:00 2001 From: Kazumasa Mitsunari Date: Sun, 10 Jun 2018 19:09:19 +0900 Subject: [PATCH] Bind surface properties to adding floating surface Change-Id: Ib582d4d40ccaebf24c2990a4a0d04bcc1a266f72 Signed-off-by: Kazumasa Mitsunari --- src/app.cpp | 19 +++++++++++++++++-- src/app.hpp | 1 + src/applist.cpp | 4 ++-- src/applist.hpp | 4 ++-- src/controller_hooks.hpp | 1 + src/wayland_ivi_wm.cpp | 1 + 6 files changed, 24 insertions(+), 6 deletions(-) diff --git a/src/app.cpp b/src/app.cpp index 69930a2..936a8bc 100644 --- a/src/app.cpp +++ b/src/app.cpp @@ -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*/) {} diff --git a/src/app.hpp b/src/app.hpp index e53824c..0816732 100644 --- a/src/app.hpp +++ b/src/app.hpp @@ -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); diff --git a/src/applist.cpp b/src/applist.cpp index 99f7fe4..5d7dce4 100644 --- a/src/applist.cpp +++ b/src/applist.cpp @@ -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; diff --git a/src/applist.hpp b/src/applist.hpp index 90fd6bd..b25ca19 100644 --- a/src/applist.hpp +++ b/src/applist.hpp @@ -51,8 +51,8 @@ class AppList int countClient() const; std::shared_ptr 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); diff --git a/src/controller_hooks.hpp b/src/controller_hooks.hpp index b8c142c..a7d8068 100644 --- a/src/controller_hooks.hpp +++ b/src/controller_hooks.hpp @@ -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 diff --git a/src/wayland_ivi_wm.cpp b/src/wayland_ivi_wm.cpp index b26ce7e..7e94208 100644 --- a/src/wayland_ivi_wm.cpp +++ b/src/wayland_ivi_wm.cpp @@ -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) -- 2.16.6