From: Kazumasa Mitsunari Date: Fri, 14 Sep 2018 12:23:57 +0000 (+0900) Subject: New API: setRenderOrder X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=commitdiff_plain;ds=sidebyside;h=419360d5e88e4036bc9f4fd6a5068052cf8b8703;p=apps%2Fagl-service-windowmanager.git New API: setRenderOrder Add stub function in windowmanager Change-Id: I2e3f5ebe6318443bdcdfd21a14eadef2d69d8e4d Signed-off-by: Kazumasa Mitsunari --- 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 #include #include +#include #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 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 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 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}, diff --git a/src/window_manager.cpp b/src/window_manager.cpp index acfdab2..a72f4a5 100644 --- a/src/window_manager.cpp +++ b/src/window_manager.cpp @@ -502,6 +502,12 @@ void WindowManager::api_enddraw(char const *appid, char const *drawing_name) } } +bool WindowManager::api_client_set_render_order(char const* appid, const vector& render_order) +{ + bool ret = false; + return ret; +} + result WindowManager::api_get_display_info() { Screen screen = this->lc->getScreenInfo(); diff --git a/src/window_manager.hpp b/src/window_manager.hpp index eb53b10..96dbfe6 100644 --- a/src/window_manager.hpp +++ b/src/window_manager.hpp @@ -177,6 +177,7 @@ class WindowManager void api_activate_surface(char const *appid, char const *role, char const *drawing_area, const reply_func &reply); void api_deactivate_surface(char const *appid, char const *role, const reply_func &reply); void api_enddraw(char const *appid, char const *role); + bool api_client_set_render_order(const char *appid, const std::vector &render_order); result api_get_display_info(); result api_get_area_info(char const *role); void send_event(char const *evname, char const *label);