< prev index next >
src/java.desktop/macosx/native/libawt_lwawt/awt/CClipboard.m
Print this page
@@ -23,11 +23,11 @@
* questions.
*/
#import "CDataTransferer.h"
#import "ThreadUtilities.h"
-#import "jni_util.h"
+#import "jni_util.h"
#import <Cocoa/Cocoa.h>
#import <JavaNativeFoundation/JavaNativeFoundation.h>
@interface CClipboard : NSObject { }
@property NSInteger changeCount;
@@ -77,14 +77,14 @@
}
- (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,15 +107,15 @@
}
}
- (BOOL) checkPasteboardWithoutNotification:(id)application {
AWT_ASSERT_APPKIT_THREAD;
-
+
NSInteger newChangeCount = [[NSPasteboard generalPasteboard] changeCount];
-
+
if (self.changeCount != newChangeCount) {
- self.changeCount = newChangeCount;
+ self.changeCount = newChangeCount;
return YES;
} else {
return NO;
}
}
@@ -187,11 +187,11 @@
__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,11 +248,11 @@
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,22 +271,22 @@
JNF_COCOA_EXIT(env);
return returnValue;
}
-/*
- * Class: sun_lwawt_macosx_CClipboard
- * Method: checkPasteboard
- * Signature: ()V
- */
+/*
+ * 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;
-}
+(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 >