diff --git a/modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm b/modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm index 8f14102e70..2ca227874d 100644 --- a/modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm +++ b/modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm @@ -856,6 +856,14 @@ public: if ([screen respondsToSelector: @selector (backingScaleFactor)]) displayScale = (float) screen.backingScaleFactor; + auto invalidateTransparentWindowShadow = [this] + { + // 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]; + }; + #if USE_COREGRAPHICS_RENDERING && JUCE_COREGRAPHICS_RENDER_WITH_MULTIPLE_PAINT_CALLS // This option invokes a separate paint call for each rectangle of the clip region. // It's a long story, but this is a basically a workaround for a CGContext not having @@ -876,18 +884,15 @@ public: drawRect (cg, rect, displayScale); CGContextRestoreGState (cg); } + + invalidateTransparentWindowShadow(); + return; } } - else #endif - { - 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]; + drawRect (cg, r, displayScale); + invalidateTransparentWindowShadow(); } void drawRect (CGContextRef cg, NSRect r, float displayScale)