-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBarPassElement.cpp
More file actions
32 lines (25 loc) · 1.33 KB
/
Copy pathBarPassElement.cpp
File metadata and controls
32 lines (25 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#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() {
static auto* const PCOLOR = (Hyprlang::INT* const*)HyprlandAPI::getConfigValue(PHANDLE, "plugin:hyprdecor:bar_color")->getDataStaticPtr();
static auto* const PENABLEBLUR = (Hyprlang::INT* const*)HyprlandAPI::getConfigValue(PHANDLE, "plugin:hyprdecor: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() {
// Temporary fix: expand the bar bb a bit, otherwise occlusion gets too aggressive.
return data.deco->assignedBoxGlobal().translate(-g_pHyprOpenGL->m_renderData.pMonitor->m_position).expand(10);
}
bool CBarPassElement::needsPrecomputeBlur() {
return false;
}