From 96e87229a885492201a9fe8d4e6afcc91a8775d5 Mon Sep 17 00:00:00 2001 From: Marcus Fritzsch Date: Wed, 5 Jul 2017 16:13:46 +0200 Subject: [PATCH] main: add layers and surfaces API calls Signed-off-by: Marcus Fritzsch --- src/main.cpp | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index e78b42f..13e6ab2 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -228,8 +228,35 @@ void debug_status(struct afb_req req) noexcept { } } +void debug_surfaces(afb_req req) { + auto a = json_object_new_array(); + + if (!g_wayland->controller->surfaces.empty()) { + for (auto const &i : g_wayland->controller->surfaces) { + json_object_array_add(a, json_object_new_int(i.first)); + } + } + + afb_req_success(req, a, "surfaces"); +} + +void debug_layers(afb_req req) { + auto a = json_object_new_array(); + + if (!g_wayland->controller->layers.empty()) { + for (auto const &i : g_wayland->controller->layers) { + json_object_array_add(a, json_object_new_int(i.first)); + } + } + + afb_req_success(req, a, "surfaces"); +} + const struct afb_verb_v2 verbs[] = { - {"status", debug_status, NULL, NULL, AFB_SESSION_NONE_V2}, {}, + {"status", debug_status, NULL, NULL, AFB_SESSION_NONE_V2}, + {"layers", debug_layers, NULL, NULL, AFB_SESSION_NONE_V2}, + {"surfaces", debug_surfaces, NULL, NULL, AFB_SESSION_NONE_V2}, + {}, }; } // namespace -- 2.16.6