renderer: add decoration:blur:popups_ignorealpha

fixes #4282
This commit is contained in:
Vaxry 2023-12-28 22:28:58 +01:00
parent 5f65946c84
commit 4f3ee4c645
2 changed files with 43 additions and 34 deletions

View file

@ -173,6 +173,7 @@ void CConfigManager::setDefaultVars() {
configValues["decoration:blur:noise"].floatValue = 0.0117;
configValues["decoration:blur:special"].intValue = 0;
configValues["decoration:blur:popups"].intValue = 0;
configValues["decoration:blur:popups_ignorealpha"].floatValue = 0.2;
configValues["decoration:active_opacity"].floatValue = 1;
configValues["decoration:inactive_opacity"].floatValue = 1;
configValues["decoration:fullscreen_opacity"].floatValue = 1;

View file

@ -51,6 +51,7 @@ CHyprRenderer::CHyprRenderer() {
static void renderSurface(struct wlr_surface* surface, int x, int y, void* data) {
static auto* const PBLURPOPUPS = &g_pConfigManager->getConfigValuePtr("decoration:blur:popups")->intValue;
static auto* const PBLURPOPUPSIGNOREALPHA = &g_pConfigManager->getConfigValuePtr("decoration:blur:popups_ignorealpha")->floatValue;
const auto TEXTURE = wlr_surface_get_texture(surface);
const auto RDATA = (SRenderData*)data;
@ -136,9 +137,16 @@ static void renderSurface(struct wlr_surface* surface, int x, int y, void* data)
g_pHyprOpenGL->renderTexture(TEXTURE, &windowBox, RDATA->fadeAlpha * RDATA->alpha, rounding, true);
}
} else {
if (RDATA->blur && RDATA->popup && *PBLURPOPUPS)
if (RDATA->blur && RDATA->popup && *PBLURPOPUPS) {
if (*PBLURPOPUPSIGNOREALPHA != 1.f) {
g_pHyprOpenGL->m_RenderData.discardMode |= DISCARD_ALPHA;
g_pHyprOpenGL->m_RenderData.discardOpacity = *PBLURPOPUPSIGNOREALPHA;
}
g_pHyprOpenGL->renderTextureWithBlur(TEXTURE, &windowBox, RDATA->fadeAlpha * RDATA->alpha, surface, rounding, true);
else
g_pHyprOpenGL->m_RenderData.discardMode &= ~DISCARD_ALPHA;
} else
g_pHyprOpenGL->renderTexture(TEXTURE, &windowBox, RDATA->fadeAlpha * RDATA->alpha, rounding, true);
}