MCPcopy Create free account
hub / github.com/TranslucentTB/TranslucentTB / VisualTreeWatcher

Method VisualTreeWatcher

ExplorerTAP/visualtreewatcher.cpp:7–20  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5#include "redefgetcurrenttime.h"
6
7VisualTreeWatcher::VisualTreeWatcher(winrt::com_ptr<IUnknown> site, wil::unique_event_nothrow&& readyEvent) :
8 m_XamlDiagnostics(site.as<IXamlDiagnostics>()),
9 m_AppearanceService(winrt::make_self<TaskbarAppearanceService>()),
10 m_ReadyEvent(std::move(readyEvent))
11{
12
13 // Calling AdviseVisualTreeChange from a separate thread solves some hangs.
14 std::thread([self_strong = get_strong()]
15 {
16 // AdviseVisualTreeChange is special-cased to bring us to the UI thread for the callback.
17 winrt::check_hresult(self_strong->m_XamlDiagnostics.as<IVisualTreeService3>()->AdviseVisualTreeChange(self_strong.get()));
18 self_strong->m_ReadyEvent.SetEvent();
19 }).detach();
20}
21
22HRESULT VisualTreeWatcher::OnVisualTreeChange(ParentChildRelation relation, VisualElement element, VisualMutationType mutationType) try
23{

Callers

nothing calls this directly

Calls 2

detachMethod · 0.80
getMethod · 0.80

Tested by

no test coverage detected