fix fade with deco

This commit is contained in:
vaxerski 2022-06-25 20:31:54 +02:00
parent 747ff3369d
commit 2955698f28
8 changed files with 11 additions and 10 deletions

View File

@ -864,7 +864,7 @@ void CHyprOpenGLImpl::renderSnapshot(SLayerSurface** pLayer) {
pixman_region32_fini(&fakeDamage);
}
void CHyprOpenGLImpl::renderRoundedShadow(wlr_box* box, int round, int range) {
void CHyprOpenGLImpl::renderRoundedShadow(wlr_box* box, int round, int range, float a) {
RASSERT(m_RenderData.pMonitor, "Tried to render shadow without begin()!");
RASSERT((box->width > 0 && box->height > 0), "Tried to render shadow with width/height < 0!");
@ -891,7 +891,7 @@ void CHyprOpenGLImpl::renderRoundedShadow(wlr_box* box, int round, int range) {
glUseProgram(m_shSHADOW.program);
glUniformMatrix3fv(m_shSHADOW.proj, 1, GL_FALSE, glMatrix);
glUniform4f(glGetUniformLocation(m_shSHADOW.program, "color"), col.r / 255.f, col.g / 255.f, col.b / 255.f, col.a / 255.f);
glUniform4f(glGetUniformLocation(m_shSHADOW.program, "color"), col.r / 255.f, col.g / 255.f, col.b / 255.f, col.a / 255.f * a);
const auto TOPLEFT = Vector2D(range + round, range + round);
const auto BOTTOMRIGHT = Vector2D(box->width - (range + round), box->height - (range + round));

View File

@ -61,7 +61,7 @@ public:
void renderTexture(wlr_texture*, wlr_box*, float a, int round = 0);
void renderTexture(const CTexture&, wlr_box*, float a, int round = 0, bool discardOpaque = false, bool border = false, bool allowPrimary = false);
void renderTextureWithBlur(const CTexture&, wlr_box*, float a, wlr_surface* pSurface, int round = 0, bool border = false);
void renderRoundedShadow(wlr_box*, int round, int range);
void renderRoundedShadow(wlr_box*, int round, int range, float a = 1.0);
void makeWindowSnapshot(CWindow*);
void makeLayerSnapshot(SLayerSurface*);

View File

@ -168,7 +168,7 @@ void CHyprRenderer::renderWindow(CWindow* pWindow, SMonitor* pMonitor, timespec*
// render window decorations first
for (auto& wd : pWindow->m_dWindowDecorations)
wd->draw(pMonitor);
wd->draw(pMonitor, renderdata.alpha * renderdata.fadeAlpha / 255.f);
if (!pWindow->m_bIsX11) {

View File

@ -37,7 +37,7 @@ void CHyprDropShadowDecoration::updateWindow(CWindow* pWindow) {
damageEntire();
}
void CHyprDropShadowDecoration::draw(SMonitor* pMonitor) {
void CHyprDropShadowDecoration::draw(SMonitor* pMonitor, float a) {
if (!g_pCompositor->windowValidMapped(m_pWindow))
return;
@ -62,5 +62,5 @@ void CHyprDropShadowDecoration::draw(SMonitor* pMonitor) {
fullBox.x -= pMonitor->vecPosition.x;
fullBox.y -= pMonitor->vecPosition.y;
g_pHyprOpenGL->renderRoundedShadow(&fullBox, *PROUNDING, *PSHADOWSIZE);
g_pHyprOpenGL->renderRoundedShadow(&fullBox, *PROUNDING, *PSHADOWSIZE, a);
}

View File

@ -9,7 +9,7 @@ public:
virtual SWindowDecorationExtents getWindowDecorationExtents();
virtual void draw(SMonitor*);
virtual void draw(SMonitor*, float a);
virtual eDecorationType getDecorationType();

View File

@ -68,7 +68,7 @@ void CHyprGroupBarDecoration::damageEntire() {
g_pHyprRenderer->damageBox(&dm);
}
void CHyprGroupBarDecoration::draw(SMonitor* pMonitor) {
void CHyprGroupBarDecoration::draw(SMonitor* pMonitor, float a) {
// get how many bars we will draw
int barsToDraw = m_dwGroupMembers.size();
@ -88,6 +88,7 @@ void CHyprGroupBarDecoration::draw(SMonitor* pMonitor) {
break;
CColor color = m_dwGroupMembers[i] == g_pCompositor->m_pLastWindow ? CColor(g_pConfigManager->getInt("dwindle:col.group_border_active")) : CColor(g_pConfigManager->getInt("dwindle:col.group_border"));
color.a *= a;
g_pHyprOpenGL->renderRect(&rect, color);
xoff += PAD + BARW;

View File

@ -10,7 +10,7 @@ public:
virtual SWindowDecorationExtents getWindowDecorationExtents();
virtual void draw(SMonitor*);
virtual void draw(SMonitor*, float a);
virtual eDecorationType getDecorationType();

View File

@ -22,7 +22,7 @@ public:
virtual SWindowDecorationExtents getWindowDecorationExtents() = 0;
virtual void draw(SMonitor*) = 0;
virtual void draw(SMonitor*, float a) = 0;
virtual eDecorationType getDecorationType() = 0;