< prev index next >

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

Print this page

        

*** 23,33 **** * questions. */ #import "CDataTransferer.h" #import "ThreadUtilities.h" ! #import "jni_util.h" #import <Cocoa/Cocoa.h> #import <JavaNativeFoundation/JavaNativeFoundation.h> @interface CClipboard : NSObject { } @property NSInteger changeCount; --- 23,33 ---- * questions. */ #import "CDataTransferer.h" #import "ThreadUtilities.h" ! #import "jni_util.h" #import <Cocoa/Cocoa.h> #import <JavaNativeFoundation/JavaNativeFoundation.h> @interface CClipboard : NSObject { } @property NSInteger changeCount;
*** 77,90 **** } - (void)checkPasteboard:(id)sender { // This is called via NSApplicationDidBecomeActiveNotification. ! // If the change count on the general pasteboard is different than when we set it // someone else put data on the clipboard. That means the current owner lost ownership. ! NSInteger newChangeCount = [[NSPasteboard generalPasteboard] changeCount]; if (self.changeCount != newChangeCount) { self.changeCount = newChangeCount; --- 77,90 ---- } - (void)checkPasteboard:(id)sender { // This is called via NSApplicationDidBecomeActiveNotification. ! // If the change count on the general pasteboard is different than when we set it // someone else put data on the clipboard. That means the current owner lost ownership. ! NSInteger newChangeCount = [[NSPasteboard generalPasteboard] changeCount]; if (self.changeCount != newChangeCount) { self.changeCount = newChangeCount;
*** 107,121 **** } } - (BOOL) checkPasteboardWithoutNotification:(id)application { AWT_ASSERT_APPKIT_THREAD; ! NSInteger newChangeCount = [[NSPasteboard generalPasteboard] changeCount]; ! if (self.changeCount != newChangeCount) { ! self.changeCount = newChangeCount; return YES; } else { return NO; } } --- 107,121 ---- } } - (BOOL) checkPasteboardWithoutNotification:(id)application { AWT_ASSERT_APPKIT_THREAD; ! NSInteger newChangeCount = [[NSPasteboard generalPasteboard] changeCount]; ! if (self.changeCount != newChangeCount) { ! self.changeCount = newChangeCount; return YES; } else { return NO; } }
*** 187,197 **** __block NSArray* dataTypes; [ThreadUtilities performOnMainThreadWaiting:YES block:^() { dataTypes = [[[NSPasteboard generalPasteboard] types] retain]; }]; [dataTypes autorelease]; ! NSUInteger nFormats = [dataTypes count]; NSUInteger knownFormats = 0; NSUInteger i; // There can be any number of formats on the general pasteboard. Find out which ones --- 187,197 ---- __block NSArray* dataTypes; [ThreadUtilities performOnMainThreadWaiting:YES block:^() { dataTypes = [[[NSPasteboard generalPasteboard] types] retain]; }]; [dataTypes autorelease]; ! NSUInteger nFormats = [dataTypes count]; NSUInteger knownFormats = 0; NSUInteger i; // There can be any number of formats on the general pasteboard. Find out which ones
*** 248,258 **** NSString *formatAsString = formatForIndex(format); __block NSData* clipData; [ThreadUtilities performOnMainThreadWaiting:YES block:^() { clipData = [[[NSPasteboard generalPasteboard] dataForType:formatAsString] retain]; }]; ! if (clipData == NULL) { [JNFException raise:env as:"java/io/IOException" reason:"Font transform has NaN position"]; return NULL; } else { [clipData autorelease]; --- 248,258 ---- NSString *formatAsString = formatForIndex(format); __block NSData* clipData; [ThreadUtilities performOnMainThreadWaiting:YES block:^() { clipData = [[[NSPasteboard generalPasteboard] dataForType:formatAsString] retain]; }]; ! if (clipData == NULL) { [JNFException raise:env as:"java/io/IOException" reason:"Font transform has NaN position"]; return NULL; } else { [clipData autorelease];
*** 271,292 **** JNF_COCOA_EXIT(env); return returnValue; } ! /* ! * Class: sun_lwawt_macosx_CClipboard ! * Method: checkPasteboard ! * Signature: ()V ! */ 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:^(){ ! ret = [[CClipboard sharedClipboard] checkPasteboardWithoutNotification:nil]; ! }]; ! ! JNF_COCOA_EXIT(env); ! return ret; ! } --- 271,292 ---- JNF_COCOA_EXIT(env); return returnValue; } ! /* ! * Class: sun_lwawt_macosx_CClipboard ! * Method: checkPasteboard ! * Signature: ()V ! */ 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:^(){ ! ret = [[CClipboard sharedClipboard] checkPasteboardWithoutNotification:nil]; ! }]; ! ! JNF_COCOA_EXIT(env); ! return ret; ! }
< prev index next >