+
+#define WRAP(F) \
+ [](afb_req req) noexcept { \
+ if (g_afb_instance == nullptr) { \
+ afb_req_fail(req, "failed", \
+ "Binding not initialized, did the compositor die?"); \
+ return; \
+ } \
+ try { \
+ F(req); \
+ } catch (std::exception & e) { \
+ afb_req_fail_f(req, "failed", "Uncaught exception: %s", e.what()); \
+ } \
+ }
+
+const struct afb_verb_v2 verbs[] = {
+ {"debug::status", WRAP(debug_status), NULL, NULL, AFB_SESSION_NONE_V2},
+ {"debug::layers", WRAP(debug_layers), NULL, NULL, AFB_SESSION_NONE_V2},
+ {"debug::surfaces", WRAP(debug_surfaces), NULL, NULL, AFB_SESSION_NONE_V2},
+
+ {"register_surface", WRAP(register_surface), NULL, NULL, AFB_SESSION_NONE_V2},
+ {}
+};
+} // namespace
+
+extern "C" const struct afb_binding_v2 afbBindingV2 = {
+ "winman", NULL, NULL, verbs, NULL, binding_init, NULL, 1};