< prev index next >
src/java.desktop/macosx/native/libawt_lwawt/awt/CSystemColors.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
*** 26,65 ****
#import "CSystemColors.h"
#import "java_awt_SystemColor.h"
#import "sun_lwawt_macosx_LWCToolkit.h"
- #import <JavaNativeFoundation/JavaNativeFoundation.h>
#import <JavaRuntimeSupport/JavaRuntimeSupport.h>
#import "ThreadUtilities.h"
NSColor **sColors = nil;
NSColor **appleColors = nil;
@implementation CSystemColors
+ (void)initialize {
JNIEnv *env = [ThreadUtilities getJNIEnv];
! JNF_COCOA_ENTER(env);
[CSystemColors reloadColors];
[[NSNotificationCenter defaultCenter] addObserver:[CSystemColors class] selector:@selector(systemColorsDidChange:) name:NSSystemColorsDidChangeNotification object:nil];
! JNF_COCOA_EXIT(env);
}
- static JNF_CLASS_CACHE(jc_LWCToolkit, "sun/lwawt/macosx/LWCToolkit");
- static JNF_STATIC_MEMBER_CACHE(jm_systemColorsChanged, jc_LWCToolkit, "systemColorsChanged", "()V");
+ (void)systemColorsDidChange:(NSNotification *)notification {
AWT_ASSERT_APPKIT_THREAD;
[CSystemColors reloadColors];
// Call LWCToolkit with the news. LWCToolkit makes certain to do its duties
// from a new thread.
JNIEnv* env = [ThreadUtilities getJNIEnv];
! JNFCallStaticVoidMethod(env, jm_systemColorsChanged); // AWT_THREADING Safe (event)
}
+ (void)reloadColors {
// NOTE: <rdar://problem/3447825> was filed to make this code even lazier. Each
--- 26,67 ----
#import "CSystemColors.h"
#import "java_awt_SystemColor.h"
#import "sun_lwawt_macosx_LWCToolkit.h"
#import <JavaRuntimeSupport/JavaRuntimeSupport.h>
#import "ThreadUtilities.h"
+ #import "JNIUtilities.h"
NSColor **sColors = nil;
NSColor **appleColors = nil;
@implementation CSystemColors
+ (void)initialize {
JNIEnv *env = [ThreadUtilities getJNIEnv];
! JNI_COCOA_ENTER(env);
[CSystemColors reloadColors];
[[NSNotificationCenter defaultCenter] addObserver:[CSystemColors class] selector:@selector(systemColorsDidChange:) name:NSSystemColorsDidChangeNotification object:nil];
! JNI_COCOA_EXIT(env);
}
+ (void)systemColorsDidChange:(NSNotification *)notification {
AWT_ASSERT_APPKIT_THREAD;
[CSystemColors reloadColors];
// Call LWCToolkit with the news. LWCToolkit makes certain to do its duties
// from a new thread.
JNIEnv* env = [ThreadUtilities getJNIEnv];
! DECLARE_CLASS(jc_LWCToolkit, "sun/lwawt/macosx/LWCToolkit");
! DECLARE_STATIC_METHOD(jm_systemColorsChanged, jc_LWCToolkit, "systemColorsChanged", "()V");
! (*env)->CallStaticVoidMethod(env, jc_LWCToolkit, jm_systemColorsChanged); // AWT_THREADING Safe (event)
! CHECK_EXCEPTION();
!
}
+ (void)reloadColors {
// NOTE: <rdar://problem/3447825> was filed to make this code even lazier. Each
< prev index next >