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 (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to