# HG changeset patch # User Paper # Date 1718853679 14400 # Node ID 052ec053ee37f3b9166a71aa89df418a48d82316 # Parent 74e2365326c687ebf442ad1d3d2caed2d867d3d1 dep/animone: a11y/win32: fix missing ComInterface definition diff -r 74e2365326c6 -r 052ec053ee37 dep/animone/src/a11y/win32.cc --- a/dep/animone/src/a11y/win32.cc Wed Jun 19 23:13:55 2024 -0400 +++ b/dep/animone/src/a11y/win32.cc Wed Jun 19 23:21:19 2024 -0400 @@ -21,11 +21,25 @@ using element_proc_t = std::function; using properties_t = std::vector>; +/* ------------------------------------------------------------------- */ + +template +struct ComInterfaceDeleter { + static_assert(std::is_base_of::value, "Invalid COM interface"); + using pointer = T*; + void operator()(pointer p) const { if (p) p->Release(); } +}; + +template +using ComInterface = std::unique_ptr>; + +/* ------------------------------------------------------------------- */ + // The main interface that is used throughout this file. Must be initialized // before it can be used for the first time. static ComInterface ui_automation; -//////////////////////////////////////////////////////////////////////////////// +/* ------------------------------------------------------------------- */ static bool InitializeUIAutomation() { if (ui_automation) @@ -44,7 +58,7 @@ return SUCCEEDED(result); } -//////////////////////////////////////////////////////////////////////////////// +/* ------------------------------------------------------------------- */ static Element* GetElementFromHandle(HWND hwnd) { Element* element = nullptr; @@ -83,7 +97,7 @@ return element_value; } -//////////////////////////////////////////////////////////////////////////////// +/* ------------------------------------------------------------------- */ static bool VerifyElementProperties(Element& element, const properties_t& properties) { VARIANT v = {}; @@ -116,7 +130,7 @@ return VerifyElementProperties(element, properties); } -//////////////////////////////////////////////////////////////////////////////// +/* ------------------------------------------------------------------- */ static void WalkElements(TreeWalker& tree_walker, Element& parent, TreeScope scope, size_t depth, element_proc_t element_proc) {