< prev index next >

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

Print this page

        

*** 24,33 **** --- 24,34 ---- */ #import "AWT_debug.h" #import "jni_util.h" + #import "ThreadUtilities.h" #import <JavaNativeFoundation/JavaNativeFoundation.h> #define MAX_DISPLAYS 64
*** 112,132 **** static void displaycb_handle (CGDirectDisplayID display, CGDisplayChangeSummaryFlags flags, void *userInfo) { if (flags == kCGDisplayBeginConfigurationFlag) return; JNFPerformEnvBlock(JNFThreadDetachImmediately, ^(JNIEnv *env) { JNFWeakJObjectWrapper *wrapper = (JNFWeakJObjectWrapper *)userInfo; jobject graphicsEnv = [wrapper jObjectWithEnv:env]; if (graphicsEnv == NULL) return; // ref already GC'd static JNF_CLASS_CACHE(jc_CGraphicsEnvironment, "sun/awt/CGraphicsEnvironment"); ! static JNF_MEMBER_CACHE(jm_displayReconfiguration, jc_CGraphicsEnvironment, "_displayReconfiguration", "(IZ)V"); JNFCallVoidMethod(env, graphicsEnv, jm_displayReconfiguration, ! (jint) display, ! (jboolean) flags & kCGDisplayRemoveFlag); }); } /* * Class: sun_awt_CGraphicsEnvironment * Method: registerDisplayReconfiguration --- 113,136 ---- static void displaycb_handle (CGDirectDisplayID display, CGDisplayChangeSummaryFlags flags, void *userInfo) { if (flags == kCGDisplayBeginConfigurationFlag) return; + [ThreadUtilities performOnMainThreadWaiting:NO block:^() { + JNFPerformEnvBlock(JNFThreadDetachImmediately, ^(JNIEnv *env) { JNFWeakJObjectWrapper *wrapper = (JNFWeakJObjectWrapper *)userInfo; jobject graphicsEnv = [wrapper jObjectWithEnv:env]; if (graphicsEnv == NULL) return; // ref already GC'd static JNF_CLASS_CACHE(jc_CGraphicsEnvironment, "sun/awt/CGraphicsEnvironment"); ! static JNF_MEMBER_CACHE(jm_displayReconfiguration, ! jc_CGraphicsEnvironment, "_displayReconfiguration","(IZ)V"); JNFCallVoidMethod(env, graphicsEnv, jm_displayReconfiguration, ! (jint) display, (jboolean) flags & kCGDisplayRemoveFlag); }); + }]; } /* * Class: sun_awt_CGraphicsEnvironment * Method: registerDisplayReconfiguration
< prev index next >