2024-12-22 17:33:07 +01:00
|
|
|
#include "BarPassElement.hpp"
|
|
|
|
#include <hyprland/src/render/OpenGL.hpp>
|
|
|
|
#include "barDeco.hpp"
|
|
|
|
|
|
|
|
CBarPassElement::CBarPassElement(const CBarPassElement::SBarData& data_) : data(data_) {
|
|
|
|
;
|
|
|
|
}
|
|
|
|
|
|
|
|
void CBarPassElement::draw(const CRegion& damage) {
|
|
|
|
data.deco->renderPass(g_pHyprOpenGL->m_RenderData.pMonitor.lock(), data.a);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool CBarPassElement::needsLiveBlur() {
|
2024-12-22 17:52:40 +01:00
|
|
|
static auto* const PCOLOR = (Hyprlang::INT* const*)HyprlandAPI::getConfigValue(PHANDLE, "plugin:hyprbars:bar_color")->getDataStaticPtr();
|
|
|
|
static auto* const PENABLEBLUR = (Hyprlang::INT* const*)HyprlandAPI::getConfigValue(PHANDLE, "plugin:hyprbars:bar_blur")->getDataStaticPtr();
|
|
|
|
static auto* const PENABLEBLURGLOBAL = (Hyprlang::INT* const*)HyprlandAPI::getConfigValue(PHANDLE, "decoration:blur:enabled")->getDataStaticPtr();
|
|
|
|
|
|
|
|
CHyprColor color = data.deco->m_bForcedBarColor.value_or(**PCOLOR);
|
|
|
|
color.a *= data.a;
|
|
|
|
const bool SHOULDBLUR = **PENABLEBLUR && **PENABLEBLURGLOBAL && color.a < 1.F;
|
|
|
|
|
|
|
|
return SHOULDBLUR;
|
|
|
|
}
|
|
|
|
|
|
|
|
std::optional<CBox> CBarPassElement::boundingBox() {
|
|
|
|
return data.deco->assignedBoxGlobal().translate(-g_pHyprOpenGL->m_RenderData.pMonitor->vecPosition);
|
2024-12-22 17:33:07 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
bool CBarPassElement::needsPrecomputeBlur() {
|
|
|
|
return false;
|
|
|
|
}
|