Need help filtering mouse events in an overlay child window
Need help filtering mouse events in an overlay child window
- Subject: Need help filtering mouse events in an overlay child window
- From: Michael Crawford <email@hidden>
- Date: Fri, 11 May 2012 21:35:50 -0400
I'd like to act on -mouseDown when it occurs within the bounds of an NSImageView, which is a subview of a transparent overlay child window. Some of you may be wondering why I'm trying to do this so I'll try to explain that up front. There are bugs in Snow Leopard regarding the use of Core Animation with layer-backed views and NSOutlineView. In order to avoid these bugs, which I'm told Apple will not be fixing for 10.6, I'm using a transparent overlay to do the required animation and implement something like QuickLook or a preview function.
I tried the following code but it resulted in really bad latency and coordinate issues (I think) in the parent window's event handling.
#pragma mark - NSEvent Handling Methods
- (void)mouseDown:(NSEvent *)event
{
[self.parentWindow sendEvent:event];
#if 0
[super mouseDown:event];
[self.parentWindow removeChildWindow:self];
[[NSOperationQueue mainQueue] addOperationWithBlock:^{
[self close];
}];
#endif
}
- (void)mouseDragged:(NSEvent *)event
{
[self.parentWindow sendEvent:event];
}
- (void)mouseEntered:(NSEvent *)event
{
[self.parentWindow sendEvent:event];
}
- (void)mouseExited:(NSEvent *)event
{
[self.parentWindow sendEvent:event];
}
- (void)mouseMoved:(NSEvent *)event
{
[self.parentWindow sendEvent:event];
}
- (void)mouseUp:(NSEvent *)event
{
[self.parentWindow sendEvent:event];
}
I'm thinking that the way I'm forwarding events to the parent is wrong. So I'm looking for advice on implementing a proper mouse filter that can forward events and generate the same result as if the event was originally sent to the parent window.
-Michael
_______________________________________________
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