From c558f5f94338b1b95a99d6ef9c91731bd2d4cebf Mon Sep 17 00:00:00 2001 From: Kazumasa Mitsunari Date: Mon, 30 Jul 2018 21:19:09 +0900 Subject: Retrieve id and runid from response Change-Id: Ic4b8847c38fc7c6bdbd5975033287ee34a66e8ed Signed-off-by: Kazumasa Mitsunari --- src/window_manager.cpp | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/src/window_manager.cpp b/src/window_manager.cpp index bba7531..0eebbff 100644 --- a/src/window_manager.cpp +++ b/src/window_manager.cpp @@ -716,18 +716,34 @@ void WindowManager::surface_properties(unsigned surface_id, unsigned pid) json_object *response; afb_service_call_sync("afm-main", "runners", nullptr, &response); - // pick up appid from pid from application manager - std::string appid; + // 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); - // check appid then add it to the client g_app_list.addFloatingSurface(appid, surface_id, pid); } -- cgit 1.2.3-korg