Re: Turn off background click behavior on a window?
Re: Turn off background click behavior on a window?
- Subject: Re: Turn off background click behavior on a window?
- From: Jonathan Mitchell <email@hidden>
- Date: Wed, 29 Oct 2014 16:05:42 +0000
> On 29 Oct 2014, at 15:21, Steve Mills <email@hidden> wrote:
>
> Is there no way to turn off the annoying and dangerous behavior of views accepting background clicks, short of subclassing every view in a window and returning NO from acceptsFirstMouse:? The only docs I can find still state the opposite of what happens these days (https://developer.apple.com/library/mac/documentation/cocoa/conceptual/eventoverview/HandlingMouseEvents/HandlingMouseEvents.html#//apple_ref/doc/uid/10000060i-CH6-SW17):
>
> "By default, a mouse-down event in a window that isn’t the key window simply brings the window forward and makes it key; the event isn’t sent to the NSView object over which the mouse click occurs."
>
> That's not what I get. Background clicks cause the window to become key AND the click is handled by the view that was clicked. I don't want that. The window should only become key and the clicked view should ignore the event.
>
Hmm.
I created a sample project with a single NSWindow and content view subclass like so:
@implementation TestView
- (void)mouseDown:(NSEvent *)theEvent
{
NSLog(@"Mouse down");
}
/*
- (BOOL)acceptsFirstMouse:(NSEvent *)theEvent
{
return YES;
} */
@end
It seems to behave as the docs suggest on OS X 10.9.
Perhaps your app has some additional event handling in place.
Jonathan
_______________________________________________
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