< prev index next >

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

Print this page
rev 54094 : 8257853: Remove dependencies on JNF's JNI utility functions in AWT and 2D code
rev 54096 : 8259651: [macOS] Replace JNF_COCOA_ENTER/EXIT macros
rev 54098 : 8260616: Removing remaining JNF dependencies in the java.desktop module
8259729: Missed JNFInstanceOf -> IsInstanceOf conversion

*** 24,37 **** */ #import "PrintModel.h" - #import <JavaNativeFoundation/JavaNativeFoundation.h> - #import "PrinterView.h" #import "ThreadUtilities.h" @implementation PrintModel - (id)initWithPrintInfo:(NSPrintInfo*)printInfo { self = [super init]; --- 24,36 ---- */ #import "PrintModel.h" #import "PrinterView.h" #import "ThreadUtilities.h" + #import "JNIUtilities.h" @implementation PrintModel - (id)initWithPrintInfo:(NSPrintInfo*)printInfo { self = [super init];
*** 50,71 **** } - (BOOL)runPageSetup { __block BOOL fResult = NO; ! [JNFRunLoop performOnMainThreadWaiting:YES withBlock:^(){ NSPageLayout* pageLayout = [NSPageLayout pageLayout]; fResult = ([pageLayout runModalWithPrintInfo:fPrintInfo] == NSOKButton); }]; return fResult; } - (BOOL)runJobSetup { __block BOOL fResult = NO; ! [JNFRunLoop performOnMainThreadWaiting:YES withBlock:^(){ NSPrintPanel* printPanel = [NSPrintPanel printPanel]; fResult = ([printPanel runModalWithPrintInfo:fPrintInfo] == NSOKButton); }]; return fResult; --- 49,70 ---- } - (BOOL)runPageSetup { __block BOOL fResult = NO; ! [ThreadUtilities performOnMainThreadWaiting:YES block:^(){ NSPageLayout* pageLayout = [NSPageLayout pageLayout]; fResult = ([pageLayout runModalWithPrintInfo:fPrintInfo] == NSOKButton); }]; return fResult; } - (BOOL)runJobSetup { __block BOOL fResult = NO; ! [ThreadUtilities performOnMainThreadWaiting:YES block:^(){ NSPrintPanel* printPanel = [NSPrintPanel printPanel]; fResult = ([printPanel runModalWithPrintInfo:fPrintInfo] == NSOKButton); }]; return fResult;
*** 86,98 **** } else { // Retain these so they don't go away while we're in Java [self retain]; [printerView retain]; ! static JNF_CLASS_CACHE(jc_CPrinterJob, "sun/lwawt/macosx/CPrinterJob"); ! static JNF_STATIC_MEMBER_CACHE(jm_detachPrintLoop, jc_CPrinterJob, "detachPrintLoop", "(JJ)V"); ! JNFCallStaticVoidMethod(env, jm_detachPrintLoop, ptr_to_jlong(self), ptr_to_jlong(printerView)); // AWT_THREADING Safe (known object) } return fResult; } --- 85,98 ---- } else { // Retain these so they don't go away while we're in Java [self retain]; [printerView retain]; ! DECLARE_CLASS_RETURN(jc_CPrinterJob, "sun/lwawt/macosx/CPrinterJob", NO); ! DECLARE_STATIC_METHOD_RETURN(jm_detachPrintLoop, jc_CPrinterJob, "detachPrintLoop", "(JJ)V", NO); ! (*env)->CallStaticVoidMethod(env, jc_CPrinterJob, jm_detachPrintLoop, ptr_to_jlong(self), ptr_to_jlong(printerView)); // AWT_THREADING Safe (known object) ! CHECK_EXCEPTION(); } return fResult; }
*** 123,141 **** * Signature: (JJ)V */ JNIEXPORT void JNICALL Java_sun_lwawt_macosx_CPrinterJob__1safePrintLoop (JNIEnv *env, jclass clz, jlong target, jlong view) { ! JNF_COCOA_ENTER(env); PrintModel *model = (PrintModel *)jlong_to_ptr(target); PrinterView *arg = (PrinterView *)jlong_to_ptr(view); [model safePrintLoop:arg withEnv:env]; // These are to match the retains in runPrintLoopWithView: [model release]; [arg release]; ! JNF_COCOA_EXIT(env); } --- 123,141 ---- * Signature: (JJ)V */ JNIEXPORT void JNICALL Java_sun_lwawt_macosx_CPrinterJob__1safePrintLoop (JNIEnv *env, jclass clz, jlong target, jlong view) { ! JNI_COCOA_ENTER(env); PrintModel *model = (PrintModel *)jlong_to_ptr(target); PrinterView *arg = (PrinterView *)jlong_to_ptr(view); [model safePrintLoop:arg withEnv:env]; // These are to match the retains in runPrintLoopWithView: [model release]; [arg release]; ! JNI_COCOA_EXIT(env); }
< prev index next >