diff options
| author | 杨宇千 <crupest@outlook.com> | 2019-09-13 23:38:16 +0800 |
|---|---|---|
| committer | 杨宇千 <crupest@outlook.com> | 2019-09-13 23:38:16 +0800 |
| commit | 401ca68f7d9d62d195c558edfeda4ece985805e1 (patch) | |
| tree | c31d89661825a08441fff2673b065d42c423c95c /src/ui/routed_event_dispatch.hpp | |
| parent | e3423168a298139051e6bc8b9bacf8b7d594c94e (diff) | |
| download | cru-401ca68f7d9d62d195c558edfeda4ece985805e1.tar.gz cru-401ca68f7d9d62d195c558edfeda4ece985805e1.tar.bz2 cru-401ca68f7d9d62d195c558edfeda4ece985805e1.zip | |
...
Diffstat (limited to 'src/ui/routed_event_dispatch.hpp')
| -rw-r--r-- | src/ui/routed_event_dispatch.hpp | 41 |
1 files changed, 26 insertions, 15 deletions
diff --git a/src/ui/routed_event_dispatch.hpp b/src/ui/routed_event_dispatch.hpp index b032c0a3..a5270575 100644 --- a/src/ui/routed_event_dispatch.hpp +++ b/src/ui/routed_event_dispatch.hpp @@ -24,13 +24,21 @@ void DispatchEvent(const std::wstring_view& event_name, Control* const original_sender, event::RoutedEvent<EventArgs>* (Control::*event_ptr)(), Control* const last_receiver, Args&&... args) { - if (original_sender == last_receiver) { #ifdef CRU_DEBUG - log::Debug( - L"Routed event {} no need to dispatch (original_sender == " - L"last_receiver). Original sender is {}.", - event_name, original_sender->GetControlType()); + bool do_log = true; + if (event_name == L"MouseMove") do_log = false; #endif + + if (original_sender == last_receiver) { + /* + #ifdef CRU_DEBUG + if (do_log) + log::Debug( + L"Routed event {} no need to dispatch (original_sender == " + L"last_receiver). Original sender is {}.", + event_name, original_sender->GetControlType()); + #endif + */ return; } @@ -43,7 +51,7 @@ void DispatchEvent(const std::wstring_view& event_name, } #ifdef CRU_DEBUG - { + if (do_log) { std::wstring log = L"Dispatch routed event "; log += event_name; log += L". Path (parent first): "; @@ -75,10 +83,11 @@ void DispatchEvent(const std::wstring_view& event_name, if (event_args.IsHandled()) { handled = true; #ifdef CRU_DEBUG - log::Debug( - L"Routed event is short-circuit in TUNNEL at {}-st control (count " - L"from parent).", - count); + if (do_log) + log::Debug( + L"Routed event is short-circuit in TUNNEL at {}-st control (count " + L"from parent).", + count); #endif break; } @@ -95,10 +104,12 @@ void DispatchEvent(const std::wstring_view& event_name, ->Raise(event_args); if (event_args.IsHandled()) { #ifdef CRU_DEBUG - log::Debug( - L"Routed event is short-circuit in BUBBLE at {}-st control (count " - L"from parent).", - count); + if (do_log) + log::Debug( + L"Routed event is short-circuit in BUBBLE at {}-st control " + L"(count " + L"from parent).", + count); #endif break; } @@ -113,7 +124,7 @@ void DispatchEvent(const std::wstring_view& event_name, } #ifdef CRU_DEBUG - log::Debug(L"Routed event dispatch finished."); + if (do_log) log::Debug(L"Routed event dispatch finished."); #endif } } // namespace cru::ui |
