fixed discardopaque with custom alpha

This commit is contained in:
vaxerski 2022-04-18 18:23:10 +02:00
parent 7ae87a233c
commit cbf0d366b4
3 changed files with 10 additions and 6 deletions

View file

@ -45,6 +45,9 @@ struct SRenderData {
// for fade
float fadeAlpha = 255.f;
// for alpha settings
float alpha = 255.f;
};
struct SKeyboard {

View file

@ -20,9 +20,9 @@ void renderSurface(struct wlr_surface* surface, int x, int y, void* data) {
scaleBox(&windowBox, RDATA->output->scale);
if (RDATA->surface && surface == RDATA->surface)
g_pHyprOpenGL->renderTextureWithBlur(TEXTURE, &windowBox, RDATA->fadeAlpha, RDATA->dontRound ? 0 : g_pConfigManager->getInt("decoration:rounding"));
g_pHyprOpenGL->renderTextureWithBlur(TEXTURE, &windowBox, RDATA->fadeAlpha * RDATA->alpha, RDATA->dontRound ? 0 : g_pConfigManager->getInt("decoration:rounding"));
else
g_pHyprOpenGL->renderTexture(TEXTURE, &windowBox, RDATA->fadeAlpha, RDATA->dontRound ? 0 : g_pConfigManager->getInt("decoration:rounding"));
g_pHyprOpenGL->renderTexture(TEXTURE, &windowBox, RDATA->fadeAlpha * RDATA->alpha, RDATA->dontRound ? 0 : g_pConfigManager->getInt("decoration:rounding"));
wlr_surface_send_frame_done(surface, RDATA->when);
@ -89,7 +89,8 @@ void CHyprRenderer::renderWindow(CWindow* pWindow, SMonitor* pMonitor, timespec*
renderdata.w = pWindow->m_vRealSize.x;
renderdata.h = pWindow->m_vRealSize.y;
renderdata.dontRound = pWindow->m_bIsFullscreen;
renderdata.fadeAlpha = pWindow->m_fAlpha * (pWindow == g_pCompositor->m_pLastWindow ? g_pConfigManager->getFloat("decoration:active_opacity") : g_pConfigManager->getFloat("decoration:inactive_opacity"));
renderdata.fadeAlpha = pWindow->m_fAlpha;
renderdata.alpha = pWindow == g_pCompositor->m_pLastWindow ? g_pConfigManager->getFloat("decoration:active_opacity") : g_pConfigManager->getFloat("decoration:inactive_opacity");
wlr_surface_for_each_surface(g_pXWaylandManager->getWindowSurface(pWindow), renderSurface, &renderdata);

View file

@ -53,7 +53,7 @@ void main() {
vec4 pixColor = texture2D(tex, v_texcoord);
if (discardOpaque == 1 && pixColor[3] == 1.0) {
if (discardOpaque == 1 && pixColor[3] * alpha == 1.0) {
discard;
return;
}
@ -111,7 +111,7 @@ uniform int discardOpaque;
void main() {
if (discardOpaque == 1) {
if (discardOpaque == 1 && alpha == 1.0) {
discard;
return;
}
@ -274,7 +274,7 @@ void main() {
vec4 pixColor = texture2D(texture0, v_texcoord);
if (discardOpaque == 1 && pixColor[3] == 1.0) {
if (discardOpaque == 1 && pixColor[3] * alpha == 1.0) {
discard;
return;
}