提交 3cdd5f79 编写于 作者: D dcherepanov

7154062: [macosx] Mouse cursor isn't updated in applets

Reviewed-by: anthony, art
上级 392410ca
......@@ -36,6 +36,7 @@ final class CCursorManager extends LWCursorManager {
private static native Point2D nativeGetCursorPosition();
private static native void nativeSetBuiltInCursor(final int type, final String name);
private static native void nativeSetCustomCursor(final long imgPtr, final double x, final double y);
public static native void nativeSetAllowsCursorSetInBackground(final boolean allows);
private static final int NAMED_CURSOR = -1;
......
......@@ -76,6 +76,12 @@ public class CEmbeddedFrame extends EmbeddedFrame {
int screenX = locationOnScreen.x + x;
int screenY = locationOnScreen.y + y;
if (eventType == CocoaConstants.NPCocoaEventMouseEntered) {
CCursorManager.nativeSetAllowsCursorSetInBackground(true);
} else if (eventType == CocoaConstants.NPCocoaEventMouseExited) {
CCursorManager.nativeSetAllowsCursorSetInBackground(false);
}
responder.handleMouseEvent(eventType, modifierFlags, buttonNumber,
clickCount, x, y, screenX, screenY);
}
......
......@@ -137,3 +137,30 @@ JNF_COCOA_EXIT(env);
return jpt;
}
JNIEXPORT void JNICALL
Java_sun_lwawt_macosx_CCursorManager_nativeSetAllowsCursorSetInBackground
(JNIEnv *env, jclass class, jboolean allows)
{
JNF_COCOA_ENTER(env);
AWT_ASSERT_NOT_APPKIT_THREAD;
SEL allowsSetInBackground_SEL = @selector(javaSetAllowsCursorSetInBackground:);
if ([[NSCursor class] respondsToSelector:allowsSetInBackground_SEL]) {
[JNFRunLoop performOnMainThreadWaiting:YES withBlock:^(){
NSMethodSignature *allowsSetInBackground_sig =
[[NSCursor class] methodSignatureForSelector:allowsSetInBackground_SEL];
NSInvocation *invocation =
[NSInvocation invocationWithMethodSignature:allowsSetInBackground_sig];
BOOL arg = (BOOL)allows;
[invocation setSelector:allowsSetInBackground_SEL];
[invocation setArgument:&arg atIndex:2];
[invocation invokeWithTarget:[NSCursor class]];
}];
}
JNF_COCOA_EXIT(env);
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册