aboutsummaryrefslogtreecommitdiffstats
path: root/src/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp43
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},