From 90d07d7b520d3ea8d01dd248d16dcd96937f431c Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Mon, 18 Jul 2022 12:39:57 +0200 Subject: [PATCH] fix shadows on unmanaged and noborder --- src/Compositor.cpp | 10 +++++++--- src/events/Windows.cpp | 2 ++ src/render/decorations/CHyprDropShadowDecoration.cpp | 3 +++ 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/Compositor.cpp b/src/Compositor.cpp index 52b197ea..160f5e3f 100644 --- a/src/Compositor.cpp +++ b/src/Compositor.cpp @@ -1206,10 +1206,14 @@ void CCompositor::updateWindowAnimatedDecorationValues(CWindow* pWindow) { } // shadow - if (pWindow == m_pLastWindow) { - pWindow->m_cRealShadowColor = CColor(*PSHADOWCOL); + if (pWindow->m_iX11Type != 2 && !pWindow->m_bX11DoesntWantBorders) { + if (pWindow == m_pLastWindow) { + pWindow->m_cRealShadowColor = CColor(*PSHADOWCOL); + } else { + pWindow->m_cRealShadowColor = CColor(*PSHADOWCOLINACTIVE != INT_MAX ? *PSHADOWCOLINACTIVE : *PSHADOWCOL); + } } else { - pWindow->m_cRealShadowColor = CColor(*PSHADOWCOLINACTIVE != INT_MAX ? *PSHADOWCOLINACTIVE : *PSHADOWCOL); + pWindow->m_cRealShadowColor.setValueAndWarp(CColor(0, 0, 0, 0)); // no shadow } } diff --git a/src/events/Windows.cpp b/src/events/Windows.cpp index 36f0b2db..694b9a9c 100644 --- a/src/events/Windows.cpp +++ b/src/events/Windows.cpp @@ -49,6 +49,8 @@ void Events::listener_mapWindow(void* owner, void* data) { if (PWINDOW->m_iX11Type == 2) g_pCompositor->moveUnmanagedX11ToWindows(PWINDOW); + g_pCompositor->updateWindowAnimatedDecorationValues(PWINDOW); + // Set all windows tiled regardless of anything g_pXWaylandManager->setWindowStyleTiled(PWINDOW, WLR_EDGE_LEFT | WLR_EDGE_RIGHT | WLR_EDGE_TOP | WLR_EDGE_BOTTOM); diff --git a/src/render/decorations/CHyprDropShadowDecoration.cpp b/src/render/decorations/CHyprDropShadowDecoration.cpp index 40051942..a03181c0 100644 --- a/src/render/decorations/CHyprDropShadowDecoration.cpp +++ b/src/render/decorations/CHyprDropShadowDecoration.cpp @@ -53,6 +53,9 @@ void CHyprDropShadowDecoration::draw(SMonitor* pMonitor, float a) { if (!g_pCompositor->windowValidMapped(m_pWindow)) return; + if (m_pWindow->m_cRealShadowColor.col() == CColor(0, 0, 0, 0)) + return; // don't draw invisible shadows + static auto *const PSHADOWS = &g_pConfigManager->getConfigValuePtr("decoration:drop_shadow")->intValue; static auto *const PSHADOWSIZE = &g_pConfigManager->getConfigValuePtr("decoration:shadow_range")->intValue; static auto *const PROUNDING = &g_pConfigManager->getConfigValuePtr("decoration:rounding")->intValue;