diff --git a/src/macosx/classes/sun/lwawt/macosx/CWrapper.java b/src/macosx/classes/sun/lwawt/macosx/CWrapper.java index c4c1781b93dfd98e95c465b501c558aacb05d833..aacc9898b72c28fd1c36e7944405eba9a2f1136c 100644 --- a/src/macosx/classes/sun/lwawt/macosx/CWrapper.java +++ b/src/macosx/classes/sun/lwawt/macosx/CWrapper.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,8 +25,6 @@ package sun.lwawt.macosx; -import java.awt.geom.Rectangle2D; - public final class CWrapper { private CWrapper() { } @@ -61,8 +59,6 @@ public final class CWrapper { public static native void addChildWindow(long parent, long child, int ordered); public static native void removeChildWindow(long parent, long child); - public static native void setFrame(long window, int x, int y, int w, int h, boolean display); - public static native void setAlphaValue(long window, float alpha); public static native void setOpaque(long window, boolean opaque); public static native void setBackgroundColor(long window, long color); @@ -80,7 +76,6 @@ public final class CWrapper { public static native void removeFromSuperview(long view); public static native void setFrame(long view, int x, int y, int w, int h); - public static native Rectangle2D frame(long view); public static native long window(long view); public static native void setHidden(long view, boolean hidden); @@ -88,10 +83,6 @@ public final class CWrapper { public static native void setToolTip(long view, String msg); } - public static final class NSObject { - public static native void release(long object); - } - public static final class NSColor { public static native long clearColor(); } diff --git a/src/macosx/native/sun/awt/AWTView.h b/src/macosx/native/sun/awt/AWTView.h index 58e4f6e0705ce66b4d5cdbeb4dde9f488246fab4..592235bf7be845535cb5ba5da165b17ba68b9015 100644 --- a/src/macosx/native/sun/awt/AWTView.h +++ b/src/macosx/native/sun/awt/AWTView.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -29,7 +29,7 @@ #import "CDragSource.h" #import "CDropTarget.h" -@interface AWTView : NSView { +@interface AWTView : NSView { @private jobject m_cPlatformView; @@ -61,14 +61,8 @@ - (id) initWithRect:(NSRect) rect platformView:(jobject)cPlatformView windowLayer:(CALayer*)windowLayer; - (void) deliverJavaMouseEvent: (NSEvent *) event; -- (void) resetTrackingArea; -- (void) deliverJavaKeyEventHelper: (NSEvent *) event; - (jobject) awtComponent:(JNIEnv *)env; -- (void) setDragSource:(CDragSource *)source; -- (void) setDropTarget:(CDropTarget *)target; - - // Input method-related events - (void)setInputMethod:(jobject)inputMethod; - (void)abandonInput; diff --git a/src/macosx/native/sun/awt/AWTView.m b/src/macosx/native/sun/awt/AWTView.m index 0356ebc790c81a7d555abf339ed373d2b3509e7c..9db9532815de3c314389c219760f7f9ce285587c 100644 --- a/src/macosx/native/sun/awt/AWTView.m +++ b/src/macosx/native/sun/awt/AWTView.m @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -42,6 +42,10 @@ @interface AWTView() @property (retain) CDropTarget *_dropTarget; @property (retain) CDragSource *_dragSource; + +-(void) deliverResize: (NSRect) rect; +-(void) resetTrackingArea; +-(void) deliverJavaKeyEventHelper: (NSEvent*) event; @end // Uncomment this line to see fprintfs of each InputMethod API being called on this View diff --git a/src/macosx/native/sun/awt/CDragSource.h b/src/macosx/native/sun/awt/CDragSource.h index 96e0e6831b10fb5fa4b2c9bf971d8c81ed8f1889..d18816abd410cc297596d277ddc951f424a5a9f7 100644 --- a/src/macosx/native/sun/awt/CDragSource.h +++ b/src/macosx/native/sun/awt/CDragSource.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -29,9 +29,15 @@ #import #include +@class CDragSource; + +@protocol CDragSourceHolder +- (void) setDragSource:(CDragSource *)source; +@end + @interface CDragSource : NSObject { @private - NSView* fView; + NSView* fView; jobject fComponent; jobject fDragSourceContextPeer; @@ -53,8 +59,6 @@ jint fDragMouseModifiers; } -+ (CDragSource *) currentDragSource; - // Common methods: - (id) init:(jobject)jDragSourceContextPeer component:(jobject)jComponent @@ -84,13 +88,6 @@ - (void)draggedImage:(NSImage *)image movedTo:(NSPoint)screenPoint; - (BOOL)ignoreModifierKeysWhileDragging; -// Updates from the destination to the source -- (void) postDragEnter; -- (void) postDragExit; - -// Utility -- (NSPoint) mapNSScreenPointToJavaWithOffset:(NSPoint) point; - @end #endif // CDragSource_h diff --git a/src/macosx/native/sun/awt/CDragSource.m b/src/macosx/native/sun/awt/CDragSource.m index 7459a805164a1651e1c55679dcd1d0a1b55dc1f0..dc1507746bea1f5b72eea1871537e52ef67e2923 100644 --- a/src/macosx/native/sun/awt/CDragSource.m +++ b/src/macosx/native/sun/awt/CDragSource.m @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -75,14 +75,17 @@ JNF_CLASS_CACHE(CImageClass, "sun/lwawt/macosx/CImage"); static NSDragOperation sDragOperation; static NSPoint sDraggingLocation; -static CDragSource* sCurrentDragSource; static BOOL sNeedsEnter; -@implementation CDragSource +@interface CDragSource () +// Updates from the destination to the source +- (void) postDragEnter; +- (void) postDragExit; +// Utility +- (NSPoint) mapNSScreenPointToJavaWithOffset:(NSPoint) point; +@end -+ (CDragSource *) currentDragSource { - return sCurrentDragSource; -} +@implementation CDragSource - (id) init:(jobject)jDragSourceContextPeer component:(jobject)jComponent @@ -515,8 +518,6 @@ static BOOL sNeedsEnter; fDragKeyModifiers = [DnDUtilities extractJavaExtKeyModifiersFromJavaExtModifiers:fModifiers]; fDragMouseModifiers = [DnDUtilities extractJavaExtMouseModifiersFromJavaExtModifiers:fModifiers]; - // Set the current DragSource - sCurrentDragSource = self; sNeedsEnter = YES; @try { @@ -566,8 +567,6 @@ static BOOL sNeedsEnter; JNF_MEMBER_CACHE(resetHoveringMethod, CDragSourceContextPeerClass, "resetHovering", "()V"); JNFCallVoidMethod(env, fDragSourceContextPeer, resetHoveringMethod); // Hust reset static variable } @finally { - // Clear the current DragSource - sCurrentDragSource = nil; sNeedsEnter = NO; } diff --git a/src/macosx/native/sun/awt/CDropTarget.h b/src/macosx/native/sun/awt/CDropTarget.h index e8f801d7009a00465d9c3afeb3af61ec657f1260..b6cd156562b2806ec0e897ccd0b7509ad5fb593c 100644 --- a/src/macosx/native/sun/awt/CDropTarget.h +++ b/src/macosx/native/sun/awt/CDropTarget.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -31,9 +31,15 @@ @class ControlModel; +@class CDropTarget; + +@protocol CDropTargetHolder +- (void) setDropTarget:(CDropTarget *)target; +@end + @interface CDropTarget : NSObject { @private - NSView* fView; + NSView* fView; jobject fComponent; jobject fDropTarget; jobject fDropTargetContextPeer; diff --git a/src/macosx/native/sun/awt/CWrapper.h b/src/macosx/native/sun/awt/CWrapper.h deleted file mode 100644 index 416bac7ce6ba6a2ca58f5b23cc27d9b40b94d6ad..0000000000000000000000000000000000000000 --- a/src/macosx/native/sun/awt/CWrapper.h +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ diff --git a/src/macosx/native/sun/awt/CWrapper.m b/src/macosx/native/sun/awt/CWrapper.m index 9e4c6bbeb597684a0099f5f7aa17c316f51f52a6..247358f0df98d4dba0796721811df49b0ca2983c 100644 --- a/src/macosx/native/sun/awt/CWrapper.m +++ b/src/macosx/native/sun/awt/CWrapper.m @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,37 +23,10 @@ * questions. */ -#import "CWrapper.h" - #import - -#import "AWTWindow.h" -#import "LWCToolkit.h" -#import "GeomUtilities.h" #import "ThreadUtilities.h" - #import "sun_lwawt_macosx_CWrapper_NSWindow.h" -/* - * Class: sun_lwawt_macosx_CWrapper$NSObject - * Method: release - * Signature: (J)V - */ -JNIEXPORT void JNICALL -Java_sun_lwawt_macosx_CWrapper_00024NSObject_release -(JNIEnv *env, jclass cls, jlong objectPtr) -{ -JNF_COCOA_ENTER(env); - - id obj = (id)jlong_to_ptr(objectPtr); - [ThreadUtilities performOnMainThreadWaiting:NO block:^(){ - CFRelease(obj); - }]; - -JNF_COCOA_EXIT(env); -} - - /* * Class: sun_lwawt_macosx_CWrapper$NSWindow * Method: makeKeyAndOrderFront @@ -309,8 +282,8 @@ Java_sun_lwawt_macosx_CWrapper_00024NSWindow_removeChildWindow { JNF_COCOA_ENTER(env); - AWTWindow *parent = (AWTWindow *)jlong_to_ptr(parentPtr); - AWTWindow *child = (AWTWindow *)jlong_to_ptr(childPtr); + NSWindow *parent = (NSWindow *)jlong_to_ptr(parentPtr); + NSWindow *child = (NSWindow *)jlong_to_ptr(childPtr); [ThreadUtilities performOnMainThread:@selector(removeChildWindow:) on:parent withObject:child @@ -319,26 +292,6 @@ JNF_COCOA_ENTER(env); JNF_COCOA_EXIT(env); } -/* - * Class: sun_lwawt_macosx_CWrapper$NSWindow - * Method: setFrame - * Signature: (JIIIIZ)V - */ -JNIEXPORT void JNICALL -Java_sun_lwawt_macosx_CWrapper_00024NSWindow_setFrame -(JNIEnv *env, jclass cls, jlong windowPtr, jint x, jint y, jint w, jint h, jboolean display) -{ -JNF_COCOA_ENTER(env); - - AWTWindow *window = (AWTWindow *)jlong_to_ptr(windowPtr); - NSRect frame = NSMakeRect(x, y, w, h); - [ThreadUtilities performOnMainThreadWaiting:NO block:^(){ - [window setFrame:frame display:display]; - }]; - -JNF_COCOA_EXIT(env); -} - /* * Class: sun_lwawt_macosx_CWrapper$NSWindow * Method: setAlphaValue @@ -350,7 +303,7 @@ Java_sun_lwawt_macosx_CWrapper_00024NSWindow_setAlphaValue { JNF_COCOA_ENTER(env); - AWTWindow *window = (AWTWindow *)jlong_to_ptr(windowPtr); + NSWindow *window = (NSWindow *)jlong_to_ptr(windowPtr); [ThreadUtilities performOnMainThreadWaiting:NO block:^(){ [window setAlphaValue:(CGFloat)alpha]; }]; @@ -369,7 +322,7 @@ Java_sun_lwawt_macosx_CWrapper_00024NSWindow_setOpaque { JNF_COCOA_ENTER(env); - AWTWindow *window = (AWTWindow *)jlong_to_ptr(windowPtr); + NSWindow *window = (NSWindow *)jlong_to_ptr(windowPtr); [ThreadUtilities performOnMainThreadWaiting:NO block:^(){ [window setOpaque:(BOOL)opaque]; }]; @@ -388,7 +341,7 @@ Java_sun_lwawt_macosx_CWrapper_00024NSWindow_setBackgroundColor { JNF_COCOA_ENTER(env); - AWTWindow *window = (AWTWindow *)jlong_to_ptr(windowPtr); + NSWindow *window = (NSWindow *)jlong_to_ptr(windowPtr); NSColor *color = (NSColor *)jlong_to_ptr(colorPtr); [ThreadUtilities performOnMainThreadWaiting:NO block:^(){ [window setBackgroundColor:color]; @@ -398,6 +351,7 @@ JNF_COCOA_EXIT(env); } /* + * Class: sun_lwawt_macosx_CWrapper$NSWindow * Method: miniaturize * Signature: (J)V */ @@ -559,33 +513,6 @@ JNF_COCOA_ENTER(env); JNF_COCOA_EXIT(env); } -/* - * Class: sun_lwawt_macosx_CWrapper$NSView - * Method: frame - * Signature: (J)Ljava/awt/Rectangle; - */ -JNIEXPORT jobject JNICALL -Java_sun_lwawt_macosx_CWrapper_00024NSView_frame -(JNIEnv *env, jclass cls, jlong viewPtr) -{ - jobject jRect = NULL; - -JNF_COCOA_ENTER(env); - - __block NSRect rect = NSZeroRect; - - NSView *view = (NSView *)jlong_to_ptr(viewPtr); - [ThreadUtilities performOnMainThreadWaiting:YES block:^(){ - rect = [view frame]; - }]; - - jRect = NSToJavaRect(env, rect); - -JNF_COCOA_EXIT(env); - - return jRect; -} - /* * Class: sun_lwawt_macosx_CWrapper$NSView * Method: window