From 122aaa2182d8f7df95b2ac08c38df33fe8c75cd7 Mon Sep 17 00:00:00 2001 From: vaxerski Date: Mon, 1 Jan 2024 13:34:50 +0100 Subject: [PATCH] internal: update to hyprlang 0.2.0 fixes #87 --- CMakeLists.txt | 3 +-- src/Hyprpaper.cpp | 14 ++++++-------- src/config/ConfigManager.cpp | 2 +- 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2f093d8..09bd2d5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -41,7 +41,7 @@ add_compile_options(-Wall -Wextra -Wno-unused-parameter -Wno-unused-value -Wno-m find_package(Threads REQUIRED) find_package(PkgConfig REQUIRED) -pkg_check_modules(deps REQUIRED IMPORTED_TARGET wayland-client wayland-protocols cairo pango pangocairo libjpeg libwebp) +pkg_check_modules(deps REQUIRED IMPORTED_TARGET wayland-client wayland-protocols cairo pango pangocairo libjpeg libwebp hyprlang>=0.2.0) file(GLOB_RECURSE SRCFILES "src/*.cpp") @@ -65,7 +65,6 @@ target_link_libraries(hyprpaper GLESv2 pthread magic - hyprlang ${CMAKE_THREAD_LIBS_INIT} ${CMAKE_SOURCE_DIR}/wlr-layer-shell-unstable-v1-protocol.o ${CMAKE_SOURCE_DIR}/xdg-shell-protocol.o diff --git a/src/Hyprpaper.cpp b/src/Hyprpaper.cpp index c3b6225..5b996a8 100644 --- a/src/Hyprpaper.cpp +++ b/src/Hyprpaper.cpp @@ -29,7 +29,7 @@ void CHyprpaper::init() { preloadAllWallpapersFromConfig(); - if (std::any_cast(g_pConfigManager->config->getConfigValue("ipc"))) + if (std::any_cast(g_pConfigManager->config->getConfigValue("ipc"))) g_pIPCSocket->initialize(); // run @@ -451,10 +451,8 @@ SPoolBuffer* CHyprpaper::getPoolBuffer(SMonitor* pMonitor, CWallpaperTarget* pWa } void CHyprpaper::renderWallpaperForMonitor(SMonitor* pMonitor) { - static auto* const PRENDERSPLASH = g_pConfigManager->config->getConfigValuePtr("splash"); - static auto* const PSPLASHOFFSET = g_pConfigManager->config->getConfigValuePtr("splash_offset"); - const auto RENDERSPLASH = *reinterpret_cast(PRENDERSPLASH->dataPtr()); - const auto SPLASHOFFSET = *reinterpret_cast(PSPLASHOFFSET->dataPtr()); + static auto* const PRENDERSPLASH = reinterpret_cast(g_pConfigManager->config->getConfigValuePtr("splash")->getDataStaticPtr()); + static auto* const PSPLASHOFFSET = reinterpret_cast(g_pConfigManager->config->getConfigValuePtr("splash_offset")->getDataStaticPtr()); const auto PWALLPAPERTARGET = m_mMonitorActiveWallpaperTargets[pMonitor]; const auto CONTAIN = m_mMonitorWallpaperRenderData[pMonitor->name].contain; @@ -513,7 +511,7 @@ void CHyprpaper::renderWallpaperForMonitor(SMonitor* pMonitor) { cairo_paint(PCAIRO); - if (RENDERSPLASH && getenv("HYPRLAND_INSTANCE_SIGNATURE")) { + if (**PRENDERSPLASH && getenv("HYPRLAND_INSTANCE_SIGNATURE")) { auto SPLASH = execAndGet("hyprctl splash"); SPLASH.pop_back(); @@ -529,9 +527,9 @@ void CHyprpaper::renderWallpaperForMonitor(SMonitor* pMonitor) { cairo_text_extents_t textExtents; cairo_text_extents(PCAIRO, SPLASH.c_str(), &textExtents); - cairo_move_to(PCAIRO, ((DIMENSIONS.x - textExtents.width * scale) / 2.0) / scale, ((DIMENSIONS.y * (100 - SPLASHOFFSET)) / 100 - textExtents.height * scale) / scale); + cairo_move_to(PCAIRO, ((DIMENSIONS.x - textExtents.width * scale) / 2.0) / scale, ((DIMENSIONS.y * (100 - **PSPLASHOFFSET)) / 100 - textExtents.height * scale) / scale); - Debug::log(LOG, "Splash font size: %d, pos: %.2f, %.2f", FONTSIZE, (DIMENSIONS.x - textExtents.width) / 2.0 / scale, ((DIMENSIONS.y * (100 - SPLASHOFFSET)) / 100 - textExtents.height * scale) / scale); + Debug::log(LOG, "Splash font size: %d, pos: %.2f, %.2f", FONTSIZE, (DIMENSIONS.x - textExtents.width) / 2.0 / scale, ((DIMENSIONS.y * (100 - **PSPLASHOFFSET)) / 100 - textExtents.height * scale) / scale); cairo_show_text(PCAIRO, SPLASH.c_str()); diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp index 1fcd34f..d557fb3 100644 --- a/src/config/ConfigManager.cpp +++ b/src/config/ConfigManager.cpp @@ -116,7 +116,7 @@ CConfigManager::CConfigManager() { std::string configPath = getMainConfigPath(); - config = std::make_unique(configPath.c_str(), Hyprlang::SConfigOptions{}); + config = std::make_unique(configPath.c_str(), Hyprlang::SConfigOptions{.allowMissingConfig = true}); config->addConfigValue("ipc", {1L}); config->addConfigValue("splash", {1L});