internal: update to hyprlang 0.2.0

fixes #87
This commit is contained in:
Vaxry 2024-01-01 13:34:50 +01:00
parent 75270a9b38
commit 122aaa2182
3 changed files with 8 additions and 11 deletions

View file

@ -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

View file

@ -29,7 +29,7 @@ void CHyprpaper::init() {
preloadAllWallpapersFromConfig();
if (std::any_cast<int64_t>(g_pConfigManager->config->getConfigValue("ipc")))
if (std::any_cast<Hyprlang::INT>(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<int64_t*>(PRENDERSPLASH->dataPtr());
const auto SPLASHOFFSET = *reinterpret_cast<float*>(PSPLASHOFFSET->dataPtr());
static auto* const PRENDERSPLASH = reinterpret_cast<Hyprlang::INT* const*>(g_pConfigManager->config->getConfigValuePtr("splash")->getDataStaticPtr());
static auto* const PSPLASHOFFSET = reinterpret_cast<Hyprlang::FLOAT* const*>(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());

View file

@ -116,7 +116,7 @@ CConfigManager::CConfigManager() {
std::string configPath = getMainConfigPath();
config = std::make_unique<Hyprlang::CConfig>(configPath.c_str(), Hyprlang::SConfigOptions{});
config = std::make_unique<Hyprlang::CConfig>(configPath.c_str(), Hyprlang::SConfigOptions{.allowMissingConfig = true});
config->addConfigValue("ipc", {1L});
config->addConfigValue("splash", {1L});