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

Print this page

        

@@ -169,10 +169,12 @@
 
     if (returnValue) [args replaceObjectAtIndex:0 withObject:returnValue];
     else [args removeLastObject];
 }
 
+
+
 - (void) checkPasteboard:(id)application {
     AWT_ASSERT_APPKIT_THREAD;
     
     // This is called via NSApplicationDidBecomeActiveNotification.
     

@@ -200,10 +202,23 @@
             }
         }
     }
 }
 
+- (BOOL) checkPasteboardWithoutNotification:(id)application {
+    AWT_ASSERT_APPKIT_THREAD;
+    
+    NSInteger newChangeCount = [[NSPasteboard generalPasteboard] changeCount];
+    
+    if (fChangeCount != newChangeCount) {
+        fChangeCount = newChangeCount;    
+        return YES;
+    } else {
+        return NO;
+    }
+}
+
 @end
 
 /*
  * Class:     sun_lwawt_macosx_CClipboard
  * Method:    declareTypes

@@ -346,18 +361,19 @@
 /*
  * Class:     sun_lwawt_macosx_CClipboard
  * Method:    checkPasteboard
  * Signature: ()V
  */
-JNIEXPORT void JNICALL Java_sun_lwawt_macosx_CClipboard_checkPasteboard
-(JNIEnv *env, jobject inObject )
+JNIEXPORT jboolean JNICALL Java_sun_lwawt_macosx_CClipboard_checkPasteboardWithoutNotification
+(JNIEnv *env, jobject inObject)
 {
+    __block BOOL ret = NO;
     JNF_COCOA_ENTER(env);
-
     [ThreadUtilities performOnMainThreadWaiting:YES block:^(){
-        [[CClipboard sharedClipboard] checkPasteboard:nil];
+        ret = [[CClipboard sharedClipboard] checkPasteboardWithoutNotification:nil];
     }];
         
     JNF_COCOA_EXIT(env);
+    return ret;
 }