Browse Source

trick to make OSX invalidate the shadow.

pull/5943/head
Dan Walmsley 5 years ago
parent
commit
b5efb293ba
  1. 1
      native/Avalonia.Native/src/OSX/window.h
  2. 19
      native/Avalonia.Native/src/OSX/window.mm

1
native/Avalonia.Native/src/OSX/window.h

@ -34,6 +34,7 @@ class WindowBaseImpl;
-(double) getScaling;
-(double) getExtendedTitleBarHeight;
-(void) setIsExtended:(bool)value;
-(void) updateShadow;
@end
struct INSWindowHolder

19
native/Avalonia.Native/src/OSX/window.mm

@ -124,7 +124,11 @@ public:
[Window setTitle:_lastTitle];
_shown = true;
dispatch_async(dispatch_get_main_queue(), ^{
[Window updateShadow];
});
return S_OK;
}
}
@ -1838,6 +1842,19 @@ NSArray* AllLoopModes = [NSArray arrayWithObjects: NSDefaultRunLoopMode, NSEvent
double _lastScaling;
}
- (void)updateShadow
{
// Because of [invalidateShadow] of NSWindow is not working,
// We should do the trick as following to force the NSWindow re-renders its shadow.
NSRect frame = [self frame];
NSRect updatedFrame = NSMakeRect(frame.origin.x, frame.origin.y, frame.size.width + 1.0, frame.size.height + 1.0);
[self setFrame:updatedFrame display:YES];
[self setFrame:frame display:YES];
[self invalidateShadow];
}
-(void) setIsExtended:(bool)value;
{
_isExtended = value;

Loading…
Cancel
Save