src/macosx/native/sun/awt/AWTWindow.m
Print this page
*** 318,327 ****
--- 318,328 ----
return [window isKindOfClass: [AWTWindow_Panel class]] || [window isKindOfClass: [AWTWindow_Normal class]];
}
// return id for the topmost window under mouse
+ (NSInteger) getTopmostWindowUnderMouseID {
+ NSInteger result = -1;
NSRect screenRect = [[NSScreen mainScreen] frame];
NSPoint nsMouseLocation = [NSEvent mouseLocation];
CGPoint cgMouseLocation = CGPointMake(nsMouseLocation.x, screenRect.size.height - nsMouseLocation.y);
*** 332,346 ****
NSInteger layer = [[window objectForKey:(id)kCGWindowLayer] integerValue];
if (layer == 0) {
CGRect rect;
CGRectMakeWithDictionaryRepresentation((CFDictionaryRef)[window objectForKey:(id)kCGWindowBounds], &rect);
if (CGRectContainsPoint(rect, cgMouseLocation)) {
! return [[window objectForKey:(id)kCGWindowNumber] integerValue];
}
}
}
! return -1;
}
// checks that this window is under the mouse cursor and this point is not overlapped by other windows
- (BOOL) isTopmostWindowUnderMouse {
return [self.nsWindow windowNumber] == [AWTWindow getTopmostWindowUnderMouseID];
--- 333,349 ----
NSInteger layer = [[window objectForKey:(id)kCGWindowLayer] integerValue];
if (layer == 0) {
CGRect rect;
CGRectMakeWithDictionaryRepresentation((CFDictionaryRef)[window objectForKey:(id)kCGWindowBounds], &rect);
if (CGRectContainsPoint(rect, cgMouseLocation)) {
! result = [[window objectForKey:(id)kCGWindowNumber] integerValue];
! break;
}
}
}
! [windows release];
! return result;
}
// checks that this window is under the mouse cursor and this point is not overlapped by other windows
- (BOOL) isTopmostWindowUnderMouse {
return [self.nsWindow windowNumber] == [AWTWindow getTopmostWindowUnderMouseID];