< prev index next >

src/java.desktop/macosx/native/libawt_lwawt/awt/CCursorManager.m

Print this page
rev 54096 : 8259651: [macOS] Replace JNF_COCOA_ENTER/EXIT macros
rev 54098 : 8260616: Removing remaining JNF dependencies in the java.desktop module
8259729: Missed JNFInstanceOf -> IsInstanceOf conversion

@@ -24,11 +24,10 @@
  */
 
 #include "sun_lwawt_macosx_CCursorManager.h"
 
 #include <Cocoa/Cocoa.h>
-#include <JavaNativeFoundation/JavaNativeFoundation.h>
 
 #include "GeomUtilities.h"
 #include "ThreadUtilities.h"
 
 #include "java_awt_Cursor.h"

@@ -71,72 +70,74 @@
 
 JNIEXPORT void JNICALL
 Java_sun_lwawt_macosx_CCursorManager_nativeSetBuiltInCursor
 (JNIEnv *env, jclass class, jint type, jstring name)
 {
-JNF_COCOA_ENTER(env);
+JNI_COCOA_ENTER(env);
 
-    NSString *cursorName = JNFJavaToNSString(env, name);
+    NSString *cursorName = JavaStringToNSString(env, name);
     SEL cursorSelector = (type == sun_lwawt_macosx_CCursorManager_NAMED_CURSOR) ? lookupCursorSelectorForName(cursorName) : lookupCursorSelectorForType(type);
     if (cursorSelector == nil) {
         NSString *reason = [NSString stringWithFormat:@"unimplemented built-in cursor type: %d / %@", type, cursorName];
-        [JNFException raise:env as:kIllegalArgumentException reason:[reason UTF8String]];
+        JNU_ThrowIllegalArgumentException(env, [reason UTF8String]);
+        return;
     }
 
     if (![[NSCursor class] respondsToSelector:cursorSelector]) {
-        [JNFException raise:env as:kNoSuchMethodException reason:"missing NSCursor selector"];
+        JNU_ThrowByName(env, "java/lang/NoSuchMethodException", "missing NSCursor selector");
+        return;
     }
 
     [ThreadUtilities performOnMainThreadWaiting:NO block:^(){
         setCursorOnAppKitThread([[NSCursor class] performSelector:cursorSelector]);
     }];
 
-JNF_COCOA_EXIT(env);
+JNI_COCOA_EXIT(env);
 }
 
 JNIEXPORT void JNICALL
 Java_sun_lwawt_macosx_CCursorManager_nativeSetCustomCursor
 (JNIEnv *env, jclass class, jlong imgPtr, jdouble x, jdouble y)
 {
-JNF_COCOA_ENTER(env);
+JNI_COCOA_ENTER(env);
     NSImage *image = (NSImage *)jlong_to_ptr(imgPtr);
 
     [ThreadUtilities performOnMainThreadWaiting:NO block:^(){
         NSCursor *cursor = [[NSCursor alloc] initWithImage:image
                                                    hotSpot:(NSPoint){ x, y }];
         setCursorOnAppKitThread(cursor);
         [cursor release];
     }];
 
-JNF_COCOA_EXIT(env);
+JNI_COCOA_EXIT(env);
 }
 
 JNIEXPORT jobject JNICALL
 Java_sun_lwawt_macosx_CCursorManager_nativeGetCursorPosition
 (JNIEnv *env, jclass class)
 {
     jobject jpt = NULL;
 
-JNF_COCOA_ENTER(env);
+JNI_COCOA_ENTER(env);
 
     CGEventRef event = CGEventCreate(NULL);
     CGPoint globalPos = CGEventGetLocation(event);
     CFRelease(event);
 
     jpt = NSToJavaPoint(env, globalPos);
 
-JNF_COCOA_EXIT(env);
+JNI_COCOA_EXIT(env);
 
     return jpt;
 }
 
 
 JNIEXPORT void JNICALL
 Java_sun_lwawt_macosx_CCursorManager_nativeSetAllowsCursorSetInBackground
 (JNIEnv *env, jclass class, jboolean allows)
 {
-JNF_COCOA_ENTER(env);
+JNI_COCOA_ENTER(env);
 
     SEL allowsSetInBackground_SEL = @selector(javaSetAllowsCursorSetInBackground:);
     if ([[NSCursor class] respondsToSelector:allowsSetInBackground_SEL]) {
         [ThreadUtilities performOnMainThreadWaiting:YES block:^(){
             NSMethodSignature *allowsSetInBackground_sig =

@@ -148,8 +149,8 @@
             [invocation setArgument:&arg atIndex:2];
             [invocation invokeWithTarget:[NSCursor class]];
         }];
     }
 
-JNF_COCOA_EXIT(env);
+JNI_COCOA_EXIT(env);
 
 }
< prev index next >