src/macosx/native/sun/awt/CClipboard.m

Print this page




  95         JNFCallStaticVoidMethod(env, jm_contentChanged);
  96 
  97         // If we have a Java pasteboard owner, tell it that it doesn't own the pasteboard anymore.
  98         static JNF_MEMBER_CACHE(jm_lostOwnership, jc_CClipboard, "notifyLostOwnership", "()V");
  99         @synchronized(self) {
 100             if (self.clipboardOwner) {
 101                 JNIEnv *env = [ThreadUtilities getJNIEnv];
 102                 JNFCallVoidMethod(env, self.clipboardOwner, jm_lostOwnership); // AWT_THREADING Safe (event)
 103                 JNFDeleteGlobalRef(env, self.clipboardOwner);
 104                 self.clipboardOwner = NULL;
 105             }
 106         }
 107     }
 108 }
 109 
 110 @end
 111 
 112 /*
 113  * Class:     sun_lwawt_macosx_CClipboard
 114  * Method:    declareTypes
 115  * Signature: ([JLsun/awt/datatransfer/SunClipboard;)V
 116 */
 117 JNIEXPORT void JNICALL Java_sun_lwawt_macosx_CClipboard_declareTypes
 118 (JNIEnv *env, jobject inObject, jlongArray inTypes, jobject inJavaClip)
 119 {
 120 JNF_COCOA_ENTER(env);
 121 
 122     jint i;
 123     jint nElements = (*env)->GetArrayLength(env, inTypes);
 124     NSMutableArray *formatArray = [NSMutableArray arrayWithCapacity:nElements];
 125     jlong *elements = (*env)->GetPrimitiveArrayCritical(env, inTypes, NULL);
 126 
 127     for (i = 0; i < nElements; i++) {
 128         NSString *pbFormat = formatForIndex(elements[i]);
 129         if (pbFormat)
 130             [formatArray addObject:pbFormat];
 131     }
 132 
 133     (*env)->ReleasePrimitiveArrayCritical(env, inTypes, elements, JNI_ABORT);
 134     [[CClipboard sharedClipboard] declareTypes:formatArray withOwner:inJavaClip jniEnv:env];
 135 JNF_COCOA_EXIT(env);




  95         JNFCallStaticVoidMethod(env, jm_contentChanged);
  96 
  97         // If we have a Java pasteboard owner, tell it that it doesn't own the pasteboard anymore.
  98         static JNF_MEMBER_CACHE(jm_lostOwnership, jc_CClipboard, "notifyLostOwnership", "()V");
  99         @synchronized(self) {
 100             if (self.clipboardOwner) {
 101                 JNIEnv *env = [ThreadUtilities getJNIEnv];
 102                 JNFCallVoidMethod(env, self.clipboardOwner, jm_lostOwnership); // AWT_THREADING Safe (event)
 103                 JNFDeleteGlobalRef(env, self.clipboardOwner);
 104                 self.clipboardOwner = NULL;
 105             }
 106         }
 107     }
 108 }
 109 
 110 @end
 111 
 112 /*
 113  * Class:     sun_lwawt_macosx_CClipboard
 114  * Method:    declareTypes
 115  * Signature: ([JLsun/awt/datatransfer/desktop/SunClipboard;)V
 116 */
 117 JNIEXPORT void JNICALL Java_sun_lwawt_macosx_CClipboard_declareTypes
 118 (JNIEnv *env, jobject inObject, jlongArray inTypes, jobject inJavaClip)
 119 {
 120 JNF_COCOA_ENTER(env);
 121 
 122     jint i;
 123     jint nElements = (*env)->GetArrayLength(env, inTypes);
 124     NSMutableArray *formatArray = [NSMutableArray arrayWithCapacity:nElements];
 125     jlong *elements = (*env)->GetPrimitiveArrayCritical(env, inTypes, NULL);
 126 
 127     for (i = 0; i < nElements; i++) {
 128         NSString *pbFormat = formatForIndex(elements[i]);
 129         if (pbFormat)
 130             [formatArray addObject:pbFormat];
 131     }
 132 
 133     (*env)->ReleasePrimitiveArrayCritical(env, inTypes, elements, JNI_ABORT);
 134     [[CClipboard sharedClipboard] declareTypes:formatArray withOwner:inJavaClip jniEnv:env];
 135 JNF_COCOA_EXIT(env);