Re: NSWindow - flickering shadow during height animation (borderless, transparent)
Re: NSWindow - flickering shadow during height animation (borderless, transparent)
- Subject: Re: NSWindow - flickering shadow during height animation (borderless, transparent)
- From: Ken Thomases <email@hidden>
- Date: Tue, 23 Apr 2013 18:28:07 -0500
On Apr 23, 2013, at 5:55 AM, Robert Vojta wrote:
> I do use borderless & transparent NSWindow with shadow. The way I do initialize this window is at the end of this email. I experienced lot of problems with shadow, but found in Apple examples that the only way to fix shadow (= read to display it correctly) is to call …
>
> [self display];
> [self setHasShadow:NO];
> [self setHasShadow:YES];
>
> … I tried to use [self invalidateShadow], etc. but nothing did work.
It's not clear if you tried to use [self invalidateShadow] instead of all three lines or just instead of the last two. The shadow shape is computed from the visible content of the window. That's why there's a call to -display there, to make sure the visible content is up to date. However, I would expect that using [self invalidateShadow] after a call to display would be at least as effective as toggling the hasShadow property and would possibly avoid the flicker.
(For what it's worth, I think the examples that toggle hasShadow are simply holdovers from the days before -invalidateShadow was introduced.)
In fact, you might just want to override -display in your window class and call -invalidateShadow after calling [super display]. That should keep the shadow always in sync with the contents. If you do that, remove any explicit calls to -display that you're doing just to update the shadow as well as any other manipulation of the shadow.
> - (id)initWithView:(NSView *)view anchorPoint:(NSPoint)anchorPoint position:(NSPoint)position distance:(CGFloat)distance {
> ...
> [self setHasShadow:NO];
Why are you setting the window not to have a shadow here?
Regards,
Ken
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden