-const struct afb_verb_v2 windowmanager_verbs[] = {
- { "requestsurface", windowmanager_requestsurface, nullptr, nullptr, AFB_SESSION_NONE },
- { "requestsurfacexdg", windowmanager_requestsurfacexdg, nullptr, nullptr, AFB_SESSION_NONE },
- { "activatesurface", windowmanager_activatesurface, nullptr, nullptr, AFB_SESSION_NONE },
- { "deactivatesurface", windowmanager_deactivatesurface, nullptr, nullptr, AFB_SESSION_NONE },
- { "enddraw", windowmanager_enddraw, 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 },
- { "debug_status", windowmanager_debug_status, nullptr, nullptr, AFB_SESSION_NONE },
- { "debug_layers", windowmanager_debug_layers, nullptr, nullptr, AFB_SESSION_NONE },
- { "debug_surfaces", windowmanager_debug_surfaces, nullptr, nullptr, AFB_SESSION_NONE },
- { "debug_terminate", windowmanager_debug_terminate, nullptr, nullptr, AFB_SESSION_NONE },
- {}
-};
-
-namespace wm {
-void binding_api::send_event(char const *evname, char const *label) {
- HMI_DEBUG("wm", "%s: %s(%s)", __func__, evname, label);
-
- json_object *j = json_object_new_object();
- json_object_object_add(j, kKeyDrawingName, json_object_new_string(label));
-
- int ret = afb_event_push(g_afb_instance->app.map_afb_event[evname], j);
- if (ret != 0) {
- HMI_DEBUG("wm", "afb_event_push failed: %m");
- }
+void windowmanager_debug_status(afb_req req) noexcept
+{
+ std::lock_guard<std::mutex> guard(binding_m);
+#ifdef ST
+ ST();
+#endif
+ if (g_afb_instance == nullptr)
+ {
+ afb_req_fail(req, "failed", "Binding not initialized, did the compositor die?");
+ return;
+ }
+
+ try
+ {
+
+ json_object *jr = json_object_new_object();
+ json_object_object_add(jr, "surfaces",
+ to_json(g_afb_instance->app.controller->sprops));
+ json_object_object_add(jr, "layers", to_json(g_afb_instance->app.controller->lprops));
+
+ afb_req_success(req, jr, "success");
+ }
+ catch (std::exception &e)
+ {
+ afb_req_fail_f(req, "failed", "Uncaught exception while calling debug_status: %s", e.what());
+ return;
+ }