# HG changeset patch # User pchelko # Date 1435942072 -3600 # Node ID fe8eaadb491e68df0fbcccb3c696e9eaa541990c # Parent bed8b32f0decdeccd827a741df8f6814d97153bc 8027561: [macosx] Cleanup "may not respond to selector" warnings in native code Reviewed-by: azvegint, serb diff -r bed8b32f0dec -r fe8eaadb491e src/macosx/classes/sun/lwawt/macosx/CWrapper.java --- a/src/macosx/classes/sun/lwawt/macosx/CWrapper.java Fri Jul 03 17:39:58 2015 +0100 +++ b/src/macosx/classes/sun/lwawt/macosx/CWrapper.java Fri Jul 03 17:47:52 2015 +0100 @@ -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() { } @@ -60,8 +58,6 @@ 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); @@ -79,17 +75,12 @@ 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 setToolTip(long view, String msg); public static native void setHidden(long view, boolean hidden); } - public static final class NSObject { - public static native void release(long object); - } - public static final class NSColor { public static native long clearColor(); } diff -r bed8b32f0dec -r fe8eaadb491e src/macosx/native/sun/awt/AWTView.h --- a/src/macosx/native/sun/awt/AWTView.h Fri Jul 03 17:39:58 2015 +0100 +++ b/src/macosx/native/sun/awt/AWTView.h Fri Jul 03 17:47:52 2015 +0100 @@ -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 -r bed8b32f0dec -r fe8eaadb491e src/macosx/native/sun/awt/AWTView.m --- a/src/macosx/native/sun/awt/AWTView.m Fri Jul 03 17:39:58 2015 +0100 +++ b/src/macosx/native/sun/awt/AWTView.m Fri Jul 03 17:47:52 2015 +0100 @@ -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 -r bed8b32f0dec -r fe8eaadb491e src/macosx/native/sun/awt/CDragSource.h --- a/src/macosx/native/sun/awt/CDragSource.h Fri Jul 03 17:39:58 2015 +0100 +++ b/src/macosx/native/sun/awt/CDragSource.h Fri Jul 03 17:47:52 2015 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 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 -r bed8b32f0dec -r fe8eaadb491e src/macosx/native/sun/awt/CDragSource.m --- a/src/macosx/native/sun/awt/CDragSource.m Fri Jul 03 17:39:58 2015 +0100 +++ b/src/macosx/native/sun/awt/CDragSource.m Fri Jul 03 17:47:52 2015 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 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,15 +75,18 @@ static NSDragOperation sDragOperation; static NSPoint sDraggingLocation; -static CDragSource* sCurrentDragSource; static BOOL sNeedsEnter; +@interface CDragSource () +// Updates from the destination to the source +- (void) postDragEnter; +- (void) postDragExit; +// Utility +- (NSPoint) mapNSScreenPointToJavaWithOffset:(NSPoint) point; +@end + @implementation CDragSource -+ (CDragSource *) currentDragSource { - return sCurrentDragSource; -} - - (id) init:(jobject)jDragSourceContextPeer component:(jobject)jComponent control:(id)control @@ -515,8 +518,6 @@ fDragKeyModifiers = [DnDUtilities extractJavaExtKeyModifiersFromJavaExtModifiers:fModifiers]; fDragMouseModifiers = [DnDUtilities extractJavaExtMouseModifiersFromJavaExtModifiers:fModifiers]; - // Set the current DragSource - sCurrentDragSource = self; sNeedsEnter = YES; @try { @@ -566,8 +567,6 @@ 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 -r bed8b32f0dec -r fe8eaadb491e src/macosx/native/sun/awt/CDropTarget.h --- a/src/macosx/native/sun/awt/CDropTarget.h Fri Jul 03 17:39:58 2015 +0100 +++ b/src/macosx/native/sun/awt/CDropTarget.h Fri Jul 03 17:47:52 2015 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 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 -r bed8b32f0dec -r fe8eaadb491e src/macosx/native/sun/awt/CWrapper.h --- a/src/macosx/native/sun/awt/CWrapper.h Fri Jul 03 17:39:58 2015 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,24 +0,0 @@ -/* - * Copyright (c) 2011, 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 -r bed8b32f0dec -r fe8eaadb491e src/macosx/native/sun/awt/CWrapper.m --- a/src/macosx/native/sun/awt/CWrapper.m Fri Jul 03 17:39:58 2015 +0100 +++ b/src/macosx/native/sun/awt/CWrapper.m Fri Jul 03 17:47:52 2015 +0100 @@ -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,38 +23,11 @@ * 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 * Signature: (J)V @@ -308,8 +281,8 @@ { 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 @@ -320,26 +293,6 @@ /* * 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 * Signature: (JF)V */ @@ -349,7 +302,7 @@ { 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]; }]; @@ -368,7 +321,7 @@ { 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]; }]; @@ -387,7 +340,7 @@ { 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]; @@ -397,6 +350,7 @@ } /* + * Class: sun_lwawt_macosx_CWrapper$NSWindow * Method: miniaturize * Signature: (J)V */ @@ -560,33 +514,6 @@ /* * 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 * Signature: (J)J */