7154062: [macosx] Mouse cursor isn't updated in applets
Reviewed-by: anthony, art
This commit is contained in:
parent
5b2008805b
commit
3f596509e1
@ -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);
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user