aboutsummaryrefslogtreecommitdiff
path: root/src/ui/helper
diff options
context:
space:
mode:
authorYuqian Yang <crupest@crupest.life>2025-09-07 13:52:34 +0800
committerYuqian Yang <crupest@crupest.life>2025-09-07 13:52:34 +0800
commitbba3d52af4526ee19bd962c2448d0f8d24d4070b (patch)
tree592839be6277cb79cf81bb88091c6d0ada0e3cfc /src/ui/helper
parent6e665c0b9c0d38fe597df04a517833e219bddfc1 (diff)
downloadcru-bba3d52af4526ee19bd962c2448d0f8d24d4070b.tar.gz
cru-bba3d52af4526ee19bd962c2448d0f8d24d4070b.tar.bz2
cru-bba3d52af4526ee19bd962c2448d0f8d24d4070b.zip
Fix some compile error on macOS.
Diffstat (limited to 'src/ui/helper')
-rw-r--r--src/ui/helper/ClickDetector.cpp15
-rw-r--r--src/ui/helper/ShortcutHub.cpp2
2 files changed, 9 insertions, 8 deletions
diff --git a/src/ui/helper/ClickDetector.cpp b/src/ui/helper/ClickDetector.cpp
index 2e3dc1a0..21caff35 100644
--- a/src/ui/helper/ClickDetector.cpp
+++ b/src/ui/helper/ClickDetector.cpp
@@ -5,7 +5,7 @@
#include "cru/ui/controls/Control.h"
#include "cru/ui/host/WindowHost.h"
-#include <optional>
+#include <string>
namespace cru::ui::helper {
Point ClickEventArgs::GetDownPointOfScreen() const {
@@ -58,7 +58,8 @@ ClickDetector::ClickDetector(controls::Control* control) {
this->state_ == ClickState::Hover) {
if (!this->control_->CaptureMouse()) {
if constexpr (debug_flags::click_detector) {
- CRU_LOG_TAG_DEBUG("Failed to capture mouse when begin click.");
+ CRU_LOG_TAG_DEBUG(
+ "Failed to capture mouse when begin click.");
}
return;
}
@@ -123,16 +124,16 @@ void ClickDetector::SetTriggerButton(MouseButton trigger_button) {
void ClickDetector::SetState(ClickState state) {
if constexpr (debug_flags::click_detector) {
- auto to_string = [](ClickState state) -> std::u16string_view {
+ auto to_string = [](ClickState state) -> const char* {
switch (state) {
case ClickState::None:
- return u"None";
+ return "None";
case ClickState::Hover:
- return u"Hover";
+ return "Hover";
case ClickState::Press:
- return u"Press";
+ return "Press";
case ClickState::PressInactive:
- return u"PressInvactive";
+ return "PressInactive";
default:
UnreachableCode();
}
diff --git a/src/ui/helper/ShortcutHub.cpp b/src/ui/helper/ShortcutHub.cpp
index e3a06e8c..80e70fe1 100644
--- a/src/ui/helper/ShortcutHub.cpp
+++ b/src/ui/helper/ShortcutHub.cpp
@@ -93,7 +93,7 @@ void ShortcutHub::OnKeyDown(events::KeyEventArgs& event) {
key_bind.ToString().ToUtf8());
}
CRU_LOG_TAG_DEBUG("Begin to handle shortcut for key bind {}.",
- key_bind.ToString());
+ key_bind.ToString().ToUtf8());
}
for (const auto& shortcut : shortcut_list) {