diff options
Diffstat (limited to 'src/nativewindow')
3 files changed, 7 insertions, 74 deletions
diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/swt/SWTAccessor.java b/src/nativewindow/classes/com/jogamp/nativewindow/swt/SWTAccessor.java index 97ffde5ee..b2428f7fa 100644 --- a/src/nativewindow/classes/com/jogamp/nativewindow/swt/SWTAccessor.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/swt/SWTAccessor.java @@ -721,27 +721,4 @@ public class SWTAccessor { public static void destroyGDKWindow(final long gdkWindow) { // OS.gdk_window_destroy (gdkWindow); } - - public static com.jogamp.nativewindow.util.Point getLocationOnScreen(final com.jogamp.nativewindow.util.Point storage, - Control comp) - { - while(null != comp) { - final org.eclipse.swt.graphics.Point p = comp.getLocation(); - final int dx = p.x; - final int dy = p.y; - storage.translate(dx, dy); - comp = comp.getParent(); - } - return storage; - } - public static Control getTopControl(Control comp) - { - Control last = null; - while(null != comp) { - last = comp; - comp = comp.getParent(); - } - return last; - } - } diff --git a/src/nativewindow/classes/jogamp/nativewindow/macosx/OSXUtil.java b/src/nativewindow/classes/jogamp/nativewindow/macosx/OSXUtil.java index 1197f059d..e06a68953 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/macosx/OSXUtil.java +++ b/src/nativewindow/classes/jogamp/nativewindow/macosx/OSXUtil.java @@ -117,13 +117,6 @@ public class OSXUtil implements ToolkitProperties { /** * @param windowOrView - * @return top-left client-area position in window units - */ - public static Point GetLocation(final long windowOrView) { - return (Point) GetLocation0(windowOrView); - } - /** - * @param windowOrView * @param src_x * @param src_y * @return top-left client-area position in window units @@ -443,7 +436,6 @@ public class OSXUtil implements ToolkitProperties { private static native boolean initIDs0(); private static native boolean isNSView0(long object); private static native boolean isNSWindow0(long object); - private static native Object GetLocation0(long windowOrView); private static native Object GetLocationOnScreen0(long windowOrView, int src_x, int src_y); private static native Object GetInsets0(long windowOrView); private static native float GetScreenPixelScale1(int displayID); diff --git a/src/nativewindow/native/macosx/OSXmisc.m b/src/nativewindow/native/macosx/OSXmisc.m index 6c13d9c05..f5991b1b5 100644 --- a/src/nativewindow/native/macosx/OSXmisc.m +++ b/src/nativewindow/native/macosx/OSXmisc.m @@ -180,42 +180,6 @@ static NSScreen * OSXUtil_getNSScreenByCGDirectDisplayID(CGDirectDisplayID displ /* * Class: Java_jogamp_nativewindow_macosx_OSXUtil - * Method: getLocation0 - * Signature: (J)Lcom/jogamp/nativewindow/util/Point; - */ -JNIEXPORT jobject JNICALL Java_jogamp_nativewindow_macosx_OSXUtil_GetLocation0 - (JNIEnv *env, jclass unused, jlong winOrView) -{ - NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; - - /** - * return location in 0/0 top-left space, - * OSX is 0/0 bottom-left space naturally - */ - NSObject *nsObj = (NSObject*) (intptr_t) winOrView; - NSWindow* win = NULL; - NSView* view = NULL; - - if( [nsObj isKindOfClass:[NSWindow class]] ) { - win = (NSWindow*) nsObj; - view = [win contentView]; - } else if( nsObj != NULL && [nsObj isKindOfClass:[NSView class]] ) { - view = (NSView*) nsObj; - win = [view window]; - } else { - NativewindowCommon_throwNewRuntimeException(env, "neither win nor view %p\n", nsObj); - } - NSRect viewFrame = [view frame]; - - jobject res = (*env)->NewObject(env, pointClz, pointCstr, (jint)viewFrame.origin.x, (jint)viewFrame.origin.y); - - [pool release]; - - return res; -} - -/* - * Class: Java_jogamp_nativewindow_macosx_OSXUtil * Method: getLocationOnScreen0 * Signature: (JII)Lcom/jogamp/nativewindow/util/Point; */ @@ -243,13 +207,13 @@ JNIEXPORT jobject JNICALL Java_jogamp_nativewindow_macosx_OSXUtil_GetLocationOnS } NSRect viewFrame = [view frame]; - NSRect r; - r.origin.x = src_x; - r.origin.y = viewFrame.size.height - src_y; // y-flip for 0/0 top-left - r.size.width = 0; - r.size.height = 0; - // NSRect rS = [win convertRectToScreen: r]; // 10.7 - NSPoint oS = [win convertBaseToScreen: r.origin]; // BL-screen + NSPoint oS = NSMakePoint(src_x, src_y); + if( ![view isFlipped] ) { + // y-flip for 0/0 top-left: TL-view -> BL-view + oS.y = viewFrame.size.height - oS.y; + } + oS = [view convertPoint: oS toView:nil]; // BL-view -> BL-window + oS = [win convertBaseToScreen: oS]; // BL-window -> BL-screen NSScreen* screen = [win screen]; CGDirectDisplayID display = OSXUtil_getCGDirectDisplayIDByNSScreen(screen); |