From b2ba2773d9361fa2b0cbea2f175b364a343abd70 Mon Sep 17 00:00:00 2001 From: iysheng Date: Sat, 10 Sep 2022 12:23:37 +0800 Subject: [PATCH] Modify to display window shadow when ds no equal to 0 --- src/window.cpp | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/src/window.cpp b/src/window.cpp index 3fcbf26f..304a009b 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -78,21 +78,23 @@ void Window::draw(NVGcontext *ctx) { : m_theme->m_window_fill_unfocused); nvgFill(ctx); + if (ds) + { + /* Draw a drop shadow */ + NVGpaint shadow_paint = nvgBoxGradient( + ctx, m_pos.x(), m_pos.y(), m_size.x(), m_size.y(), cr*2, ds*2, + m_theme->m_drop_shadow, m_theme->m_transparent); - /* Draw a drop shadow */ - NVGpaint shadow_paint = nvgBoxGradient( - ctx, m_pos.x(), m_pos.y(), m_size.x(), m_size.y(), cr*2, ds*2, - m_theme->m_drop_shadow, m_theme->m_transparent); - - nvgSave(ctx); - nvgResetScissor(ctx); - nvgBeginPath(ctx); - nvgRect(ctx, m_pos.x()-ds,m_pos.y()-ds, m_size.x()+2*ds, m_size.y()+2*ds); - nvgRoundedRect(ctx, m_pos.x(), m_pos.y(), m_size.x(), m_size.y(), cr); - nvgPathWinding(ctx, NVG_HOLE); - nvgFillPaint(ctx, shadow_paint); - nvgFill(ctx); - nvgRestore(ctx); + nvgSave(ctx); + nvgResetScissor(ctx); + nvgBeginPath(ctx); + nvgRect(ctx, m_pos.x()-ds,m_pos.y()-ds, m_size.x()+2*ds, m_size.y()+2*ds); + nvgRoundedRect(ctx, m_pos.x(), m_pos.y(), m_size.x(), m_size.y(), cr); + nvgPathWinding(ctx, NVG_HOLE); + nvgFillPaint(ctx, shadow_paint); + nvgFill(ctx); + nvgRestore(ctx); + } if (!m_title.empty()) { /* Draw header */