diff --git a/src/Hyprpaper.cpp b/src/Hyprpaper.cpp index 221fca4..131ea84 100644 --- a/src/Hyprpaper.cpp +++ b/src/Hyprpaper.cpp @@ -567,13 +567,14 @@ void CHyprpaper::renderWallpaperForMonitor(SMonitor* pMonitor) { // get scale // we always do cover - double scale = 1.0; - Vector2D origin; - - double imgW = PWALLPAPERTARGET->m_vSize.x; - double imgH = PWALLPAPERTARGET->m_vSize.y; + double scale = 1.0; + Vector2D origin; - if ((ROTATION % 4 == 1) || (ROTATION % 4 == 3)) std::swap(imgW, imgH); + double imgW = PWALLPAPERTARGET->m_vSize.x; + double imgH = PWALLPAPERTARGET->m_vSize.y; + + if ((ROTATION % 4 == 1) || (ROTATION % 4 == 3)) + std::swap(imgW, imgH); cairo_save(PCAIRO); @@ -591,17 +592,16 @@ void CHyprpaper::renderWallpaperForMonitor(SMonitor* pMonitor) { cairo_translate(PCAIRO, -DIMENSIONS.x / 2.0, -DIMENSIONS.y / 2.0); } - if (TILE) { cairo_pattern_t* pattern = cairo_pattern_create_for_surface(PWALLPAPERTARGET->m_pCairoSurface->cairo()); cairo_pattern_set_extend(pattern, CAIRO_EXTEND_REPEAT); cairo_set_source(PCAIRO, pattern); cairo_pattern_destroy(pattern); } else { - - if (CONTAIN){ + + if (CONTAIN) { scale = std::min(DIMENSIONS.x / imgW, DIMENSIONS.y / imgH); - }else{ + } else { scale = std::max(DIMENSIONS.x / imgW, DIMENSIONS.y / imgH); } diff --git a/src/Hyprpaper.hpp b/src/Hyprpaper.hpp index aba7b2f..20c4ebf 100644 --- a/src/Hyprpaper.hpp +++ b/src/Hyprpaper.hpp @@ -17,8 +17,8 @@ #include "protocols/wlr-layer-shell-unstable-v1.hpp" struct SWallpaperRenderData { - bool contain = false; - bool tile = false; + bool contain = false; + bool tile = false; uint32_t rotation = 0; }; diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp index 4445605..7bda357 100644 --- a/src/config/ConfigManager.cpp +++ b/src/config/ConfigManager.cpp @@ -13,15 +13,12 @@ static Hyprlang::CParseResult handleWallpaper(const char* C, const char* V) { return result; } - auto firstComma = VALUE.find_first_of(','); + auto firstComma = VALUE.find_first_of(','); auto secondComma = VALUE.find_first_of(',', firstComma + 1); auto MONITOR = VALUE.substr(0, firstComma); - auto WALLPAPER = g_pConfigManager->trimPath( - VALUE.substr(firstComma + 1, - (secondComma == std::string::npos ? std::string::npos : secondComma - firstComma - 1)) - ); + auto WALLPAPER = g_pConfigManager->trimPath(VALUE.substr(firstComma + 1, (secondComma == std::string::npos ? std::string::npos : secondComma - firstComma - 1))); bool contain = false; @@ -70,18 +67,18 @@ static Hyprlang::CParseResult handleWallpaper(const char* C, const char* V) { } g_pHyprpaper->clearWallpaperFromMonitor(MONITOR); - g_pHyprpaper->m_mMonitorActiveWallpapers[MONITOR] = WALLPAPER; - g_pHyprpaper->m_mMonitorWallpaperRenderData[MONITOR].contain = contain; - g_pHyprpaper->m_mMonitorWallpaperRenderData[MONITOR].tile = tile; + g_pHyprpaper->m_mMonitorActiveWallpapers[MONITOR] = WALLPAPER; + g_pHyprpaper->m_mMonitorWallpaperRenderData[MONITOR].contain = contain; + g_pHyprpaper->m_mMonitorWallpaperRenderData[MONITOR].tile = tile; g_pHyprpaper->m_mMonitorWallpaperRenderData[MONITOR].rotation = rotation; if (MONITOR.empty()) { for (auto& m : g_pHyprpaper->m_vMonitors) { if (!m->hasATarget || m->wildcard) { g_pHyprpaper->clearWallpaperFromMonitor(m->name); - g_pHyprpaper->m_mMonitorActiveWallpapers[m->name] = WALLPAPER; - g_pHyprpaper->m_mMonitorWallpaperRenderData[m->name].contain = contain; - g_pHyprpaper->m_mMonitorWallpaperRenderData[m->name].tile = tile; + g_pHyprpaper->m_mMonitorActiveWallpapers[m->name] = WALLPAPER; + g_pHyprpaper->m_mMonitorWallpaperRenderData[m->name].contain = contain; + g_pHyprpaper->m_mMonitorWallpaperRenderData[m->name].tile = tile; g_pHyprpaper->m_mMonitorWallpaperRenderData[m->name].rotation = rotation; } }