diff options
author | Kazumasa Mitsunari <knimitz@witz-inc.co.jp> | 2018-07-30 21:19:09 +0900 |
---|---|---|
committer | Kazumasa Mitsunari <knimitz@witz-inc.co.jp> | 2018-07-31 11:14:33 +0900 |
commit | c558f5f94338b1b95a99d6ef9c91731bd2d4cebf (patch) | |
tree | f39ab42e50a725790d7ea4d3094eca37d77da2b2 | |
parent | 9302f3a5e63cbc83f019cbeff13cc1279d9cfeae (diff) |
Retrieve id and runid from response
Change-Id: Ic4b8847c38fc7c6bdbd5975033287ee34a66e8ed
Signed-off-by: Kazumasa Mitsunari <knimitz@witz-inc.co.jp>
-rw-r--r-- | src/window_manager.cpp | 22 |
1 files 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); } |