From 8d3fd927843da18d959c54292c135e760f8bd4c8 Mon Sep 17 00:00:00 2001 From: ed Date: Thu, 7 Jan 2021 12:25:21 +0000 Subject: [PATCH] macOS: Redraw drop-shadow on repaint for transparent NSWindows to fix some drawing artifacts --- .../native/juce_mac_NSViewComponentPeer.mm | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm b/modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm index 98c05fc7ca..d41bf96d69 100644 --- a/modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm +++ b/modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm @@ -876,13 +876,18 @@ public: drawRect (cg, rect, displayScale); CGContextRestoreGState (cg); } - - return; } } + else #endif + { + drawRect (cg, r, displayScale); + } - drawRect (cg, r, displayScale); + // transparent NSWindows with a drop-shadow need to redraw their shadow when the content + // changes to avoid stale shadows being drawn behind the window + if (! isSharedWindow && ! [window isOpaque] && [window hasShadow]) + [window invalidateShadow]; } void drawRect (CGContextRef cg, NSRect r, float displayScale)