Print this page
Added gradle and cmake project


  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 #import "jni_util.h"
  27 #import "CGLGraphicsConfig.h"
  28 #import "AWTView.h"
  29 #import "AWTWindow.h"
  30 #import "JavaComponentAccessibility.h"
  31 #import "JavaTextAccessibility.h"
  32 #import "JavaAccessibilityUtilities.h"
  33 #import "GeomUtilities.h"
  34 #import "OSVersion.h"
  35 #import "ThreadUtilities.h"
  36 
  37 #import <Carbon/Carbon.h>
  38 #import <JavaNativeFoundation/JavaNativeFoundation.h>
  39 


  40 @interface AWTView()
  41 @property (retain) CDropTarget *_dropTarget;
  42 @property (retain) CDragSource *_dragSource;
  43 
  44 -(void) deliverResize: (NSRect) rect;
  45 -(void) resetTrackingArea;
  46 -(void) deliverJavaKeyEventHelper: (NSEvent*) event;
  47 -(BOOL) isCodePointInUnicodeBlockNeedingIMEvent: (unichar) codePoint;
  48 -(NSMutableString *) parseString : (id) complexString;
  49 @end
  50 
  51 // Uncomment this line to see fprintfs of each InputMethod API being called on this View
  52 //#define IM_DEBUG TRUE
  53 //#define EXTRA_DEBUG
  54 


  55 static BOOL shouldUsePressAndHold() {
  56     static int shouldUsePressAndHold = -1;
  57     if (shouldUsePressAndHold != -1) return shouldUsePressAndHold;
  58     shouldUsePressAndHold = !isSnowLeopardOrLower();
  59     return shouldUsePressAndHold;
  60 }
  61 
  62 @implementation AWTView
  63 
  64 @synthesize _dropTarget;
  65 @synthesize _dragSource;
  66 @synthesize cglLayer;
  67 @synthesize mouseIsOver;
  68 
  69 // Note: Must be called on main (AppKit) thread only
  70 - (id) initWithRect: (NSRect) rect
  71        platformView: (jobject) cPlatformView
  72         windowLayer: (CALayer*) windowLayer
  73 {
  74     AWT_ASSERT_APPKIT_THREAD;


1481  */
1482 
1483 JNIEXPORT jboolean JNICALL Java_sun_lwawt_macosx_CPlatformView_nativeIsViewUnderMouse
1484 (JNIEnv *env, jclass clazz, jlong viewPtr)
1485 {
1486     __block jboolean underMouse = JNI_FALSE;
1487 
1488     JNF_COCOA_ENTER(env);
1489 
1490     NSView *nsView = OBJC(viewPtr);
1491     [ThreadUtilities performOnMainThreadWaiting:YES block:^(){
1492         NSPoint ptWindowCoords = [[nsView window] mouseLocationOutsideOfEventStream];
1493         NSPoint ptViewCoords = [nsView convertPoint:ptWindowCoords fromView:nil];
1494         underMouse = [nsView hitTest:ptViewCoords] != nil;
1495     }];
1496 
1497     JNF_COCOA_EXIT(env);
1498 
1499     return underMouse;
1500 }


















  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 #import "jni_util.h"
  27 #import "CGLGraphicsConfig.h"
  28 #import "AWTView.h"
  29 #import "AWTWindow.h"
  30 #import "JavaComponentAccessibility.h"
  31 #import "JavaTextAccessibility.h"
  32 #import "JavaAccessibilityUtilities.h"
  33 #import "GeomUtilities.h"
  34 #import "OSVersion.h"
  35 #import "ThreadUtilities.h"
  36 
  37 #import <Carbon/Carbon.h>
  38 #import <JavaNativeFoundation/JavaNativeFoundation.h>
  39 
  40 jboolean metalEnabled = JNI_FALSE;
  41 
  42 @interface AWTView()
  43 @property (retain) CDropTarget *_dropTarget;
  44 @property (retain) CDragSource *_dragSource;
  45 
  46 -(void) deliverResize: (NSRect) rect;
  47 -(void) resetTrackingArea;
  48 -(void) deliverJavaKeyEventHelper: (NSEvent*) event;
  49 -(BOOL) isCodePointInUnicodeBlockNeedingIMEvent: (unichar) codePoint;
  50 -(NSMutableString *) parseString : (id) complexString;
  51 @end
  52 
  53 // Uncomment this line to see fprintfs of each InputMethod API being called on this View
  54 //#define IM_DEBUG TRUE
  55 //#define EXTRA_DEBUG
  56 
  57 #define METAL_DEBUG
  58 
  59 static BOOL shouldUsePressAndHold() {
  60     static int shouldUsePressAndHold = -1;
  61     if (shouldUsePressAndHold != -1) return shouldUsePressAndHold;
  62     shouldUsePressAndHold = !isSnowLeopardOrLower();
  63     return shouldUsePressAndHold;
  64 }
  65 
  66 @implementation AWTView
  67 
  68 @synthesize _dropTarget;
  69 @synthesize _dragSource;
  70 @synthesize cglLayer;
  71 @synthesize mouseIsOver;
  72 
  73 // Note: Must be called on main (AppKit) thread only
  74 - (id) initWithRect: (NSRect) rect
  75        platformView: (jobject) cPlatformView
  76         windowLayer: (CALayer*) windowLayer
  77 {
  78     AWT_ASSERT_APPKIT_THREAD;


1485  */
1486 
1487 JNIEXPORT jboolean JNICALL Java_sun_lwawt_macosx_CPlatformView_nativeIsViewUnderMouse
1488 (JNIEnv *env, jclass clazz, jlong viewPtr)
1489 {
1490     __block jboolean underMouse = JNI_FALSE;
1491 
1492     JNF_COCOA_ENTER(env);
1493 
1494     NSView *nsView = OBJC(viewPtr);
1495     [ThreadUtilities performOnMainThreadWaiting:YES block:^(){
1496         NSPoint ptWindowCoords = [[nsView window] mouseLocationOutsideOfEventStream];
1497         NSPoint ptViewCoords = [nsView convertPoint:ptWindowCoords fromView:nil];
1498         underMouse = [nsView hitTest:ptViewCoords] != nil;
1499     }];
1500 
1501     JNF_COCOA_EXIT(env);
1502 
1503     return underMouse;
1504 }
1505 
1506 jboolean GetStaticBoolean(JNIEnv *env, jclass fClass, const char *fieldName)
1507 {
1508     jfieldID fieldID = (*env)->GetStaticFieldID(env, fClass, fieldName, "Z");
1509     return (*env)->GetStaticBooleanField(env, fClass, fieldID);
1510 }
1511 
1512 JNIEXPORT void JNICALL
1513 Java_sun_java2d_macos_MacOSFlags_initNativeFlags(JNIEnv *env,
1514                                                      jclass flagsClass)
1515 {
1516   metalEnabled = GetStaticBoolean(env, flagsClass, "metalEnabled");
1517 #ifdef METAL_DEBUG
1518   fprintf(stderr, "metalEnabled=%d\n", metalEnabled);
1519 #endif
1520 }