Re: Lion breaks the ability to "click-through" transparent window areas when the window is resizable.
Re: Lion breaks the ability to "click-through" transparent window areas when the window is resizable.
- Subject: Re: Lion breaks the ability to "click-through" transparent window areas when the window is resizable.
- From: Andreas Mayer <email@hidden>
- Date: Sat, 10 Sep 2011 05:43:05 +0200
Follow-Up:
While doing some additional testing before writing a bug report, I noticed that Apple's "RoundTransparentWindow" sample code did work as expected!
Turns out that setIgnoresMouseEvents:NO will do the actual breaking.
Thus:
Bug ID# 10104405
Summary:
Sending setIgnoresMouseEvents:NO to a borderless window makes the transparent parts of the window opaque to mouse events.
Steps to Reproduce:
1. Take RoundTransparentWindow sample project (https://developer.apple.com/library/mac/samplecode/RoundTransparentWindow/)
2. Add
[self setIgnoresMouseEvents:NO];
to the CustomWindow class' initializer:
- (id)initWithContentRect:(NSRect)contentRect
styleMask:(NSUInteger)aStyle
backing:(NSBackingStoreType)bufferingType
defer:(BOOL)flag {
// Using NSBorderlessWindowMask results in a window without a title bar.
self = [super initWithContentRect:contentRect styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO];
if (self != nil) {
// Start with no transparency for all drawing into the window
[self setAlphaValue:1.0];
// Turn off opacity so that the parts of the window that are not drawn into are transparent.
[self setOpaque:NO];
// this following call will make the transparent parts of the window opaque to mouse events!
[self setIgnoresMouseEvents:NO];
}
return self;
}
3. Run project.
4. Click and drag inside the window's frame but outside the visible content. The window will move.
Expected Results:
Mouse events should be ignored for transparent parts of the window.
Actual Results:
Window receives mouse events everywhere inside its frame, regardless of opacity.
Regression:
This did work as expected in versions of Mac OS X prior to 10.7.
Notes:
Regarding this specific example: Since the window was initially (per default) set up to NOT ignore mouse events anyway, setIgnoresMouseEvents:NO shouldn't do anything at all.
Andreas_______________________________________________
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