hyprland-plugins/hyprbars/BarPassElement.cpp
Vaxry dbe221941a
bars/vkfix/focus: chase hyprland
Chase hyprland changes, fix for lua. Too lazy to do expo and b++ rn.
2026-04-26 17:15:05 +01:00

34 lines
1.2 KiB
C++

#include "BarPassElement.hpp"
#include <hyprland/src/render/OpenGL.hpp>
#include <hyprland/src/render/Renderer.hpp>
#include "barDeco.hpp"
using namespace Render::GL;
CBarPassElement::CBarPassElement(const CBarPassElement::SBarData& data_) : data(data_) {
;
}
std::vector<UP<IPassElement>> CBarPassElement::draw() {
data.deco->renderPass(g_pHyprRenderer->m_renderData.pMonitor.lock(), data.a);
return {};
}
bool CBarPassElement::needsLiveBlur() {
static auto* const PENABLEBLURGLOBAL = (Hyprlang::INT* const*)HyprlandAPI::getConfigValue(PHANDLE, "decoration:blur:enabled")->getDataStaticPtr();
CHyprColor color = data.deco->m_bForcedBarColor.value_or(CHyprColor{static_cast<uint64_t>(g_pGlobalState->config.barColor->value())});
color.a *= data.a;
const bool SHOULDBLUR = g_pGlobalState->config.barBlur->value() && **PENABLEBLURGLOBAL && color.a < 1.F;
return SHOULDBLUR;
}
std::optional<CBox> CBarPassElement::boundingBox() {
// Temporary fix: expand the bar bb a bit, otherwise occlusion gets too aggressive.
return data.deco->assignedBoxGlobal().translate(-g_pHyprRenderer->m_renderData.pMonitor->m_position).expand(10);
}
bool CBarPassElement::needsPrecomputeBlur() {
return false;
}