src/macosx/native/sun/awt/AWTView.m
Print this page
@@ -59,10 +59,11 @@
@implementation AWTView
@synthesize _dropTarget;
@synthesize _dragSource;
@synthesize cglLayer;
+@synthesize mouseIsOver;
// Note: Must be called on main (AppKit) thread only
- (id) initWithRect: (NSRect) rect
platformView: (jobject) cPlatformView
windowLayer: (CALayer*) windowLayer
@@ -79,10 +80,12 @@
fEnablePressAndHold = shouldUsePressAndHold();
fInPressAndHold = NO;
fPAHNeedsToSelect = NO;
+ mouseIsOver = NO;
+
if (windowLayer != nil) {
self.cglLayer = windowLayer;
[self setWantsLayer: YES];
[self.layer addSublayer: (CALayer *)cglLayer];
[self setLayerContentsRedrawPolicy: NSViewLayerContentsRedrawDuringViewResize];
@@ -297,18 +300,27 @@
/**
* Utility methods and accessors
*/
-(void) deliverJavaMouseEvent: (NSEvent *) event {
+
+ NSEventType type = [event type];
+
+ // check synthesized mouse entered/exited events
+ if ((type == NSMouseEntered && mouseIsOver) || (type == NSMouseExited && !mouseIsOver)) {
+ return;
+ }else if ((type == NSMouseEntered && !mouseIsOver) || (type == NSMouseExited && mouseIsOver)) {
+ mouseIsOver = !mouseIsOver;
+ }
+
[AWTToolkit eventCountPlusPlus];
JNIEnv *env = [ThreadUtilities getJNIEnv];
NSPoint eventLocation = [event locationInWindow];
NSPoint localPoint = [self convertPoint: eventLocation fromView: nil];
NSPoint absP = [NSEvent mouseLocation];
- NSEventType type = [event type];
// Convert global numbers between Cocoa's coordinate system and Java.
// TODO: need consitent way for doing that both with global as well as with local coordinates.
// The reason to do it here is one more native method for getting screen dimension otherwise.