src/macosx/native/sun/awt/CClipboard.m
Print this page
*** 199,229 ****
NSInteger newChangeCount = [[NSPasteboard generalPasteboard] changeCount];
if (fChangeCount != newChangeCount) {
fChangeCount = newChangeCount;
! [self pasteboardChangedOwner:[NSPasteboard generalPasteboard]];
! }
! }
!
! - (void)pasteboardChangedOwner:(NSPasteboard *)sender; {
! AWT_ASSERT_APPKIT_THREAD;
!
static JNF_CLASS_CACHE(jc_CClipboard, "sun/lwawt/macosx/CClipboard");
! static JNF_MEMBER_CACHE(jm_lostOwnership, jc_CClipboard, "lostSelectionOwnershipImpl", "()V");
!
! //NSLog(@"CClipboard pasteboardChangedOwner");
// If we have a Java pasteboard owner, tell it that it doesn't own the pasteboard anymore.
@synchronized(self) {
if (fClipboardOwner) {
JNIEnv *env = [ThreadUtilities getJNIEnv];
JNFCallVoidMethod(env, fClipboardOwner, jm_lostOwnership); // AWT_THREADING Safe (event)
JNFDeleteGlobalRef(env, fClipboardOwner);
fClipboardOwner = NULL;
}
}
}
@end
/*
--- 199,225 ----
NSInteger newChangeCount = [[NSPasteboard generalPasteboard] changeCount];
if (fChangeCount != newChangeCount) {
fChangeCount = newChangeCount;
! // Notify that the content might be changed
static JNF_CLASS_CACHE(jc_CClipboard, "sun/lwawt/macosx/CClipboard");
! static JNF_STATIC_MEMBER_CACHE(jm_contentChanged, jc_CClipboard, "notifyChanged", "()V");
! JNIEnv *env = [ThreadUtilities getJNIEnv];
! JNFCallStaticVoidMethod(env, jm_contentChanged);
// If we have a Java pasteboard owner, tell it that it doesn't own the pasteboard anymore.
+ static JNF_MEMBER_CACHE(jm_lostOwnership, jc_CClipboard, "notifyLostOwnership", "()V");
@synchronized(self) {
if (fClipboardOwner) {
JNIEnv *env = [ThreadUtilities getJNIEnv];
JNFCallVoidMethod(env, fClipboardOwner, jm_lostOwnership); // AWT_THREADING Safe (event)
JNFDeleteGlobalRef(env, fClipboardOwner);
fClipboardOwner = NULL;
}
}
+ }
}
@end
/*