diff options
-rw-r--r-- | include/cru/platform/gui/DebugFlags.hpp | 8 | ||||
-rw-r--r-- | src/win/gui/InputMethod.cpp | 7 | ||||
-rw-r--r-- | src/win/gui/Window.cpp | 9 |
3 files changed, 20 insertions, 4 deletions
diff --git a/include/cru/platform/gui/DebugFlags.hpp b/include/cru/platform/gui/DebugFlags.hpp new file mode 100644 index 00000000..2b7c7c19 --- /dev/null +++ b/include/cru/platform/gui/DebugFlags.hpp @@ -0,0 +1,8 @@ +#pragma once + +namespace cru::platform::gui { +struct DebugFlags { + static constexpr int paint = 0; + static constexpr int input_method = 0; +}; +} // namespace cru::platform::gui diff --git a/src/win/gui/InputMethod.cpp b/src/win/gui/InputMethod.cpp index d6f2146d..34638516 100644 --- a/src/win/gui/InputMethod.cpp +++ b/src/win/gui/InputMethod.cpp @@ -3,6 +3,7 @@ #include "cru/common/Logger.hpp" #include "cru/common/StringUtil.hpp" #include "cru/platform/Check.hpp" +#include "cru/platform/gui/DebugFlags.hpp" #include "cru/win/Exception.hpp" #include "cru/win/gui/Window.hpp" @@ -246,8 +247,10 @@ void WinInputMethodContext::OnWindowNativeMessage( case WM_IME_COMPOSITION: { composition_event_.Raise(nullptr); auto composition_text = GetCompositionText(); - log::TagDebug(log_tag, u"WM_IME_COMPOSITION composition text:\n{}", - composition_text); + if constexpr (DebugFlags::input_method) { + log::TagDebug(log_tag, u"WM_IME_COMPOSITION composition text:\n{}", + composition_text); + } if (message.l_param & GCS_RESULTSTR) { auto result_string = GetResultString(); text_event_.Raise(result_string); diff --git a/src/win/gui/Window.cpp b/src/win/gui/Window.cpp index dda8a36a..174b8931 100644 --- a/src/win/gui/Window.cpp +++ b/src/win/gui/Window.cpp @@ -4,6 +4,7 @@ #include "cru/common/Logger.hpp" #include "cru/platform/Check.hpp" #include "cru/platform/gui/Base.hpp" +#include "cru/platform/gui/DebugFlags.hpp" #include "cru/win/graphics/direct/WindowPainter.hpp" #include "cru/win/gui/Cursor.hpp" #include "cru/win/gui/Exception.hpp" @@ -132,7 +133,9 @@ bool WinNativeWindow::ReleaseMouse() { } void WinNativeWindow::RequestRepaint() { - log::TagDebug(log_tag, u"A repaint is requested."); + if constexpr (DebugFlags::paint) { + log::TagDebug(log_tag, u"A repaint is requested."); + } if (!::InvalidateRect(hwnd_, nullptr, FALSE)) throw Win32Error(::GetLastError(), "Failed to invalidate window."); if (!::UpdateWindow(hwnd_)) @@ -376,7 +379,9 @@ void WinNativeWindow::OnDestroyInternal() { void WinNativeWindow::OnPaintInternal() { paint_event_.Raise(nullptr); ValidateRect(hwnd_, nullptr); - log::TagDebug(log_tag, u"A repaint is finished."); + if constexpr (DebugFlags::paint) { + log::TagDebug(log_tag, u"A repaint is finished."); + } } void WinNativeWindow::OnResizeInternal(const int new_width, |