Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8259651: [macOS] Replace JNF_COCOA_ENTER/EXIT macros #176

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter
Filter file types
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.

Always

Just for now

@@ -27,7 +27,7 @@
#import "java_awt_event_KeyEvent.h"
#import "LWCToolkit.h"

#import "jni_util.h"
#import "JNIUtilities.h"

#import <JavaNativeFoundation/JavaNativeFoundation.h>
#import <sys/time.h>
@@ -668,11 +668,11 @@ jlong UTC(NSEvent *event) {
{
jint jmodifiers = 0;

JNF_COCOA_ENTER(env);
JNI_COCOA_ENTER(env);

jmodifiers = GetJavaMouseModifiers(modifierFlags);

JNF_COCOA_EXIT(env);
JNI_COCOA_EXIT(env);

return jmodifiers;
}
@@ -688,7 +688,7 @@ jlong UTC(NSEvent *event) {
{
BOOL postsTyped = NO;

JNF_COCOA_ENTER(env);
JNI_COCOA_ENTER(env);

jboolean copy = JNI_FALSE;
jint *data = (*env)->GetIntArrayElements(env, inData, &copy);
@@ -716,7 +716,7 @@ jlong UTC(NSEvent *event) {

(*env)->ReleaseIntArrayElements(env, inData, data, 0);

JNF_COCOA_EXIT(env);
JNI_COCOA_EXIT(env);

return postsTyped;
}
@@ -730,7 +730,7 @@ jlong UTC(NSEvent *event) {
Java_sun_lwawt_macosx_NSEvent_nsKeyModifiersToJavaKeyInfo
(JNIEnv *env, jclass cls, jintArray inData, jintArray outData)
{
JNF_COCOA_ENTER(env);
JNI_COCOA_ENTER(env);

jboolean copy = JNI_FALSE;
jint *data = (*env)->GetIntArrayElements(env, inData, &copy);
@@ -757,7 +757,7 @@ jlong UTC(NSEvent *event) {

(*env)->ReleaseIntArrayElements(env, inData, data, 0);

JNF_COCOA_EXIT(env);
JNI_COCOA_EXIT(env);
}

/*
@@ -771,11 +771,11 @@ jlong UTC(NSEvent *event) {
{
jchar javaChar = 0;

JNF_COCOA_ENTER(env);
JNI_COCOA_ENTER(env);

javaChar = NsCharToJavaChar(nsChar, modifierFlags, spaceKeyTyped);

JNF_COCOA_EXIT(env);
JNI_COCOA_EXIT(env);

return javaChar;
}
@@ -26,6 +26,7 @@
#import "AWTSurfaceLayers.h"
#import "ThreadUtilities.h"
#import "LWCToolkit.h"
#import "JNIUtilities.h"

#import <JavaNativeFoundation/JavaNativeFoundation.h>
#import <QuartzCore/CATransaction.h>
@@ -101,15 +102,15 @@ - (void) setBounds:(CGRect)rect {
{
__block AWTSurfaceLayers *surfaceLayers = nil;

JNF_COCOA_ENTER(env);
JNI_COCOA_ENTER(env);

[ThreadUtilities performOnMainThreadWaiting:YES block:^(){

CALayer *windowLayer = jlong_to_ptr(windowLayerPtr);
surfaceLayers = [[AWTSurfaceLayers alloc] initWithWindowLayer: windowLayer];
}];

JNF_COCOA_EXIT(env);
JNI_COCOA_EXIT(env);

return ptr_to_jlong(surfaceLayers);
}
@@ -122,7 +123,7 @@ - (void) setBounds:(CGRect)rect {
JNIEXPORT void JNICALL Java_sun_lwawt_macosx_CPlatformComponent_nativeSetBounds
(JNIEnv *env, jclass clazz, jlong surfaceLayersPtr, jint x, jint y, jint width, jint height)
{
JNF_COCOA_ENTER(env);
JNI_COCOA_ENTER(env);

AWTSurfaceLayers *surfaceLayers = OBJC(surfaceLayersPtr);

@@ -132,5 +133,5 @@ - (void) setBounds:(CGRect)rect {
[surfaceLayers setBounds: rect];
}];

JNF_COCOA_EXIT(env);
JNI_COCOA_EXIT(env);
}
@@ -1408,7 +1408,7 @@ - (void)abandonInput
{
__block AWTView *newView = nil;

JNF_COCOA_ENTER(env);
JNI_COCOA_ENTER(env);

NSRect rect = NSMakeRect(originX, originY, width, height);
jobject cPlatformView = (*env)->NewWeakGlobalRef(env, obj);
@@ -1421,7 +1421,7 @@ - (void)abandonInput
windowLayer:windowLayer];
}];

JNF_COCOA_EXIT(env);
JNI_COCOA_EXIT(env);

return ptr_to_jlong(newView);
}
@@ -1436,7 +1436,7 @@ - (void)abandonInput
Java_sun_lwawt_macosx_CPlatformView_nativeSetAutoResizable
(JNIEnv *env, jclass cls, jlong viewPtr, jboolean toResize)
{
JNF_COCOA_ENTER(env);
JNI_COCOA_ENTER(env);

NSView *view = (NSView *)jlong_to_ptr(viewPtr);

@@ -1453,7 +1453,7 @@ - (void)abandonInput
}

}];
JNF_COCOA_EXIT(env);
JNI_COCOA_EXIT(env);
}

/*
@@ -1468,15 +1468,15 @@ - (void)abandonInput
{
__block jint ret; //CGDirectDisplayID

JNF_COCOA_ENTER(env);
JNI_COCOA_ENTER(env);

NSView *view = (NSView *)jlong_to_ptr(viewPtr);
[ThreadUtilities performOnMainThreadWaiting:YES block:^(){
NSWindow *window = [view window];
ret = (jint)[[AWTWindow getNSWindowDisplayID_AppKitThread: window] intValue];
}];

JNF_COCOA_EXIT(env);
JNI_COCOA_EXIT(env);

return ret;
}
@@ -1493,7 +1493,7 @@ - (void)abandonInput
{
jobject jRect = NULL;

JNF_COCOA_ENTER(env);
JNI_COCOA_ENTER(env);

__block NSRect rect = NSZeroRect;

@@ -1509,7 +1509,7 @@ - (void)abandonInput
}];
jRect = NSToJavaRect(env, rect);

JNF_COCOA_EXIT(env);
JNI_COCOA_EXIT(env);

return jRect;
}
@@ -1525,7 +1525,7 @@ - (void)abandonInput
{
__block jboolean underMouse = JNI_FALSE;

JNF_COCOA_ENTER(env);
JNI_COCOA_ENTER(env);

NSView *nsView = OBJC(viewPtr);
[ThreadUtilities performOnMainThreadWaiting:YES block:^(){
@@ -1534,7 +1534,7 @@ - (void)abandonInput
underMouse = [nsView hitTest:ptViewCoords] != nil;
}];

JNF_COCOA_EXIT(env);
JNI_COCOA_EXIT(env);

return underMouse;
}
ProTip! Use n and p to navigate between commits in a pull request.