diff options
author | Sven Gothel <[email protected]> | 2020-01-13 06:52:22 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2020-01-13 06:52:22 +0100 |
commit | 12bbb049b716282321c979ae78918801ef071884 (patch) | |
tree | 39693b99cb6506603fb90dc7c04c6484cc3c1b2b /src/nativewindow/classes | |
parent | e3e671e3ca63235830a2ebf7875650a4c86ce18e (diff) |
Bug 1421, Bug 1358, Bug 969, Bug 672: Fix NEWT's coordinate conversion on MacOS (fixes NewtCanvasSWT on SWT positioning)
Newt's OSX Window consist out of NSView wrapped up within its own NSWindow.
It's position is being set via its NSWindow's client-area position on screen (frame),
which we derive from NSView's client-area position.
When NEWT reparents into a new 'window',
on OSX it uses the parent's NSView and its NSWindow
to attach its own NSView and NSWindow as a subview and childwindow.
SWT's OSX implementation uses NSView's for each Compositor,
but an individual NSWindow is only established for the Shell (Window).
An oversight in Nativewindow and NEWT's coordinate translation:
'top-left view <-> top-left screen'
by missing the 'view <-> window' translation caused this whole issue.
The oversight occured as NEWT's 'view <-> window' translation
had no impact due to its 1-view to 1-window mapping.
Fixing the coordinate translation resolves the mess
for SWT and for potential other toolkits on OSX.
NewtCanvasSWT behaves same on OSX as on X11 etc finally.
Diffstat (limited to 'src/nativewindow/classes')
-rw-r--r-- | src/nativewindow/classes/com/jogamp/nativewindow/swt/SWTAccessor.java | 23 | ||||
-rw-r--r-- | src/nativewindow/classes/jogamp/nativewindow/macosx/OSXUtil.java | 8 |
2 files changed, 0 insertions, 31 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); |