Detect correctly if mouse is inside or outside the Display on
creation and resize.
This commit is contained in:
parent
c328463776
commit
f6a2bc8327
|
@ -153,8 +153,6 @@ final class MacOSXDisplay implements DisplayImplementation {
|
||||||
}
|
}
|
||||||
|
|
||||||
native_mode = nIsNativeMode(peer_handle);
|
native_mode = nIsNativeMode(peer_handle);
|
||||||
mouseInsideWindow = true;
|
|
||||||
updateNativeCursor = true;
|
|
||||||
|
|
||||||
if (!native_mode) {
|
if (!native_mode) {
|
||||||
robot = AWTUtil.createRobot(canvas);
|
robot = AWTUtil.createRobot(canvas);
|
||||||
|
|
|
@ -342,11 +342,23 @@ static NSAutoreleasePool *pool;
|
||||||
owner:self
|
owner:self
|
||||||
userInfo:nil];
|
userInfo:nil];
|
||||||
[self addTrackingArea:_trackingArea];
|
[self addTrackingArea:_trackingArea];
|
||||||
|
|
||||||
|
// since nstrackingarea's don't know if mouse is inside or outside on creation
|
||||||
|
// manually detect this and send a fake mouse entered/exited message
|
||||||
|
NSPoint mouseLocation = [[self window] mouseLocationOutsideOfEventStream];
|
||||||
|
mouseLocation = [self convertPoint:mouseLocation fromView:nil];
|
||||||
|
|
||||||
|
if (NSPointInRect(mouseLocation, [self bounds])) {
|
||||||
|
[self mouseEntered: nil];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
[self mouseExited: nil];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
-(void)mouseEntered:(NSEvent *)event {
|
-(void)mouseEntered:(NSEvent *)event {
|
||||||
JNIEnv *env = attachCurrentThread();
|
JNIEnv *env = attachCurrentThread();
|
||||||
if (env == nil || event == nil || _parent == nil || _parent->jdisplay == nil) {
|
if (env == nil || _parent == nil || _parent->jdisplay == nil) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -357,7 +369,7 @@ static NSAutoreleasePool *pool;
|
||||||
|
|
||||||
-(void)mouseExited:(NSEvent *)event {
|
-(void)mouseExited:(NSEvent *)event {
|
||||||
JNIEnv *env = attachCurrentThread();
|
JNIEnv *env = attachCurrentThread();
|
||||||
if (env == nil || event == nil || _parent == nil || _parent->jdisplay == nil) {
|
if (env == nil || _parent == nil || _parent->jdisplay == nil) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue