diff options
author | Kazumasa Mitsunari <knimitz@witz-inc.co.jp> | 2018-09-14 21:23:57 +0900 |
---|---|---|
committer | Kazumasa Mitsunari <knimitz@witz-inc.co.jp> | 2018-09-14 21:24:25 +0900 |
commit | 419360d5e88e4036bc9f4fd6a5068052cf8b8703 (patch) | |
tree | 0f393222f7712360972bec34a49a3caf8b0270d9 /src/main.cpp | |
parent | 788789a6f310d5e907b4d74284ab3c9e91ae2b3f (diff) |
New API: setRenderOrder
Add stub function in windowmanager
Change-Id: I2e3f5ebe6318443bdcdfd21a14eadef2d69d8e4d
Signed-off-by: Kazumasa Mitsunari <knimitz@witz-inc.co.jp>
Diffstat (limited to 'src/main.cpp')
-rw-r--r-- | src/main.cpp | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/src/main.cpp b/src/main.cpp index 964abde..d5adfd5 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -19,6 +19,7 @@ #include <mutex> #include <json.h> #include <stdlib.h> +#include <vector> #include "window_manager.hpp" #include "json_helper.hpp" @@ -465,6 +466,47 @@ void windowmanager_getareainfo_thunk(afb_req req) noexcept } } +void windowmanager_set_render_order(afb_req req) noexcept +{ + std::lock_guard<std::mutex> guard(binding_m); + if (g_afb_instance == nullptr) + { + afb_req_fail(req, "failed", "Binding not initialized, did the compositor die?"); + return; + } + + char* appid = afb_req_get_application_id(req); + if(appid) + { + json_object *jreq = afb_req_json(req); + json_object *j_ro; // Do not free this. binder frees jreq, then free j_ro + if (json_object_object_get_ex(jreq, "render_order", &j_ro)) + { + int size = json_object_array_length(j_ro); + std::vector<std::string> ro(size); + for(int i = 0; i < size; i++) + { + ro[i] = json_object_get_string(json_object_array_get_idx(j_ro, i)); + } + + auto ret = g_afb_instance->wmgr.api_client_set_render_order(appid, ro); + if (!ret) + { + afb_req_fail(req, "failed", nullptr); + } + else + { + afb_req_success(req, nullptr, nullptr); + } + } + free(appid); + } + else + { + afb_req_fail(req, "failed", nullptr); + } +} + void windowmanager_wm_subscribe(afb_req req) noexcept { std::lock_guard<std::mutex> guard(binding_m); @@ -663,6 +705,7 @@ const struct afb_verb_v2 windowmanager_verbs[] = { {"endDraw", windowmanager_enddraw, nullptr, nullptr, AFB_SESSION_NONE}, {"getDisplayInfo", windowmanager_getdisplayinfo_thunk, nullptr, nullptr, AFB_SESSION_NONE}, {"getAreaInfo", windowmanager_getareainfo_thunk, nullptr, nullptr, AFB_SESSION_NONE}, + {"setRenderOrder", windowmanager_set_render_order, nullptr, nullptr, AFB_SESSION_NONE}, {"wm_subscribe", windowmanager_wm_subscribe, nullptr, nullptr, AFB_SESSION_NONE}, {"list_drawing_names", windowmanager_list_drawing_names, nullptr, nullptr, AFB_SESSION_NONE}, {"ping", windowmanager_ping, nullptr, nullptr, AFB_SESSION_NONE}, |