From: Kazumasa Mitsunari Date: Mon, 20 Aug 2018 05:24:54 +0000 (+0900) Subject: get callback of surface_stats_received X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=commitdiff_plain;h=9d8002a41299d8755ed548f96be89eefe660c1bd;p=apps%2Fagl-service-windowmanager-2017.git get callback of surface_stats_received Change-Id: I2318752ba00f58c197ba42166c2ab91ea4c15bce Signed-off-by: Kazumasa Mitsunari --- diff --git a/src/controller_hooks.hpp b/src/controller_hooks.hpp index dd0a3aa..ae88187 100644 --- a/src/controller_hooks.hpp +++ b/src/controller_hooks.hpp @@ -34,6 +34,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 8b04c64..48d7bb4 100644 --- a/src/wayland_ivi_wm.cpp +++ b/src/wayland_ivi_wm.cpp @@ -610,6 +610,7 @@ void controller::surface_stats_received(uint32_t surface_id, { HMI_DEBUG("wm", "compositor::surface %s @ %d f %u pid %u", __func__, surface_id, frame_count, pid); + this->sprops[surface_id].pid = pid; } void controller::surface_created(uint32_t id) diff --git a/src/wayland_ivi_wm.hpp b/src/wayland_ivi_wm.hpp index b515a06..d8915a1 100644 --- a/src/wayland_ivi_wm.hpp +++ b/src/wayland_ivi_wm.hpp @@ -166,6 +166,7 @@ struct surface_properties int32_t orientation; int32_t visibility; float opacity; + uint32_t pid; }; /** diff --git a/src/window_manager.cpp b/src/window_manager.cpp index 24b6f30..2f8e3e9 100644 --- a/src/window_manager.cpp +++ b/src/window_manager.cpp @@ -608,6 +608,45 @@ void WindowManager::surface_removed(uint32_t surface_id) g_app_list.removeSurface(surface_id); } +void WindowManager::surface_properties(unsigned surface_id, unsigned pid) +{ + HMI_DEBUG("wm", "get surface properties"); + + // search pid from surfaceID + /*json_object *response; + afb_service_call_sync("afm-main", "runners", nullptr, &response); + + // retrieve appid from pid from application manager + std::string appid = ""; + if(response == nullptr) + { + HMI_ERROR("wm", "No runners"); + } + else + { + // check appid then add it to the client + HMI_INFO("wm", "Runners:%s", json_object_get_string(response)); + int size = json_object_array_length(response); + for(int i = 0; i < size; i++) + { + json_object *j = json_object_array_get_idx(response, i); + const char* id = jh::getStringFromJson(j, "id"); + int runid = jh::getIntFromJson(j, "runid"); + if(id && (runid > 0)) + { + if(runid == pid) + { + appid = id; + break; + } + } + } + } + json_object_put(response); + + g_app_list.addFloatingSurface(appid, surface_id, pid);*/ +} + void WindowManager::removeClient(const std::string &appid) { HMI_DEBUG("wm", "Remove clinet %s from list", appid.c_str()); @@ -1553,4 +1592,9 @@ void controller_hooks::surface_destination_rectangle(uint32_t /*surface_id*/, uint32_t /*w*/, uint32_t /*h*/) {} +void controller_hooks::surface_properties(uint32_t surface_id, uint32_t pid) +{ + this->wmgr->surface_properties(surface_id, pid); +} + } // namespace wm diff --git a/src/window_manager.hpp b/src/window_manager.hpp index 6cbd355..3ad9cc7 100644 --- a/src/window_manager.hpp +++ b/src/window_manager.hpp @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef TMCAGLWM_APP_HPP -#define TMCAGLWM_APP_HPP +#ifndef WINDOW_MANAGER_HPP +#define WINDOW_MANAGER_HPP #include #include @@ -224,6 +224,7 @@ class WindowManager // 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); void removeClient(const std::string &appid); void exceptionProcessForTransition(); @@ -286,4 +287,4 @@ class WindowManager } // namespace wm -#endif // TMCAGLWM_APP_HPP +#endif // WINDOW_MANAGER_HPP