Implemented clang format

This commit is contained in:
Lucas Christiansson 2025-09-25 19:32:19 +02:00
parent a4da1a924d
commit d4011a1c4d
3 changed files with 20 additions and 23 deletions

View file

@ -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);
}

View file

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

View file

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