From 3dbf8e936e5646d2e935509399f430fec850398a Mon Sep 17 00:00:00 2001 From: Vaxry Date: Mon, 15 Apr 2024 16:45:08 +0100 Subject: [PATCH] cursor: add hyprcursor loggers --- CMakeLists.txt | 2 +- src/managers/CursorManager.cpp | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ef0ce88e..0c949928 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -109,7 +109,7 @@ pkg_check_modules(deps REQUIRED IMPORTED_TARGET wayland-server wayland-client wayland-cursor wayland-protocols cairo pango pangocairo pixman-1 libdrm libinput hwdata libseat libdisplay-info libliftoff libudev gbm - hyprlang>=0.3.2 hyprcursor + hyprlang>=0.3.2 hyprcursor>=0.1.7 ) file(GLOB_RECURSE SRCFILES CONFIGURE_DEPENDS "src/*.cpp") diff --git a/src/managers/CursorManager.cpp b/src/managers/CursorManager.cpp index 4743b62b..627ca5e1 100644 --- a/src/managers/CursorManager.cpp +++ b/src/managers/CursorManager.cpp @@ -12,8 +12,15 @@ static int cursorAnimTimer(void* data) { return 1; } +static void hcLogger(enum eHyprcursorLogLevel level, char* message) { + if (level == HC_LOG_TRACE) + return; + + Debug::log(NONE, "[hc] {}", message); +} + CCursorManager::CCursorManager() { - m_pHyprcursor = std::make_unique(m_szTheme.empty() ? nullptr : m_szTheme.c_str()); + m_pHyprcursor = std::make_unique(m_szTheme.empty() ? nullptr : m_szTheme.c_str(), hcLogger); if (!m_pHyprcursor->valid()) Debug::log(ERR, "Hyprcursor failed loading theme \"{}\", falling back to X.", m_szTheme); @@ -224,7 +231,7 @@ void CCursorManager::updateTheme() { } void CCursorManager::changeTheme(const std::string& name, const int size) { - m_pHyprcursor = std::make_unique(name.empty() ? "" : name.c_str()); + m_pHyprcursor = std::make_unique(name.empty() ? "" : name.c_str(), hcLogger); m_szTheme = name; m_iSize = size;