From da22fe21bc558e9444bb58f9286afe6ce9a3a706 Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Fri, 14 Mar 2025 12:22:24 +0100 Subject: [PATCH] hook_in_subscreen --- hyper.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/hyper.h b/hyper.h index 70f79a7f..b076aaac 100644 --- a/hyper.h +++ b/hyper.h @@ -792,6 +792,16 @@ template V callhandlers(V zero, const hookset& return h.callhandlers(zero, static_cast(args)...); } +void popScreen(); + +template void hook_in_subscreen(hookset& m, int prio, U&& hook) { + int v = m.add(prio, static_cast(hook)); + pushScreen([&m, v] { + delHook(m, v); + popScreen(); + }); + } + string XLAT(string); #define GLERR(call) glError(call, __FILE__, __LINE__)