summaryrefslogtreecommitdiffstats
path: root/src/test/com/jogamp
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2020-01-13 06:52:22 +0100
committerSven Gothel <[email protected]>2020-01-13 06:52:22 +0100
commit12bbb049b716282321c979ae78918801ef071884 (patch)
tree39693b99cb6506603fb90dc7c04c6484cc3c1b2b /src/test/com/jogamp
parente3e671e3ca63235830a2ebf7875650a4c86ce18e (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/test/com/jogamp')
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/swt/TestGLCanvasSWTNewtCanvasSWTPosInTabs.java7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestGLCanvasSWTNewtCanvasSWTPosInTabs.java b/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestGLCanvasSWTNewtCanvasSWTPosInTabs.java
index 776c72385..c373660cf 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestGLCanvasSWTNewtCanvasSWTPosInTabs.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestGLCanvasSWTNewtCanvasSWTPosInTabs.java
@@ -355,7 +355,7 @@ public class TestGLCanvasSWTNewtCanvasSWTPosInTabs extends UITestCase {
final Canvas canvas = focusOnTab1 ? canvas1 : canvas2;
System.err.println("Canvas pixel-units pos/siz.0: pos "+SWTAccessor.getLocationInPixels(canvas)+", size "+SWTAccessor.getSizeInPixels(canvas));
System.err.println("Canvas window-units pos/siz.0: pos "+canvas.getLocation()+", size "+canvas.getSize());
- System.err.println("Canvas LOS.0: "+SWTAccessor.getLocationOnScreen(new Point(), canvas));
+ System.err.println("Canvas LOS.0: "+canvas.toDisplay(0, 0));
}
if( useNewtCanvasSWT ) {
final GLWindow glWindow = focusOnTab1 ? glWindow1 : glWindow2;
@@ -384,7 +384,7 @@ public class TestGLCanvasSWTNewtCanvasSWTPosInTabs extends UITestCase {
final Canvas canvas = focusOnTab1 ? canvas1 : canvas2;
System.err.println("Canvas pixel-units pos/siz.1: pos "+SWTAccessor.getLocationInPixels(canvas)+", size "+SWTAccessor.getSizeInPixels(canvas));
System.err.println("Canvas window-units pos/siz.1: pos "+canvas.getLocation()+", size "+canvas.getSize());
- System.err.println("Canvas LOS.1: "+SWTAccessor.getLocationOnScreen(new Point(), canvas));
+ System.err.println("Canvas LOS.1: "+canvas.toDisplay(0, 0));
}
if( useNewtCanvasSWT ) {
final GLWindow glWindow = focusOnTab1 ? glWindow1 : glWindow2;
@@ -405,7 +405,8 @@ public class TestGLCanvasSWTNewtCanvasSWTPosInTabs extends UITestCase {
System.err.println("NewtCanvasSWT2 LOS: "+pNatWinLOS);
Assert.assertTrue( "NewtCanvasAWT2 LOS "+pNatWinLOS+" not >= sash-right "+pSashRightClient, pNatWinLOS.compareTo(pSashRightClient) >= 0 );
} else {
- pGLWinLOS = SWTAccessor.getLocationOnScreen(new Point(), glCanvas2);
+ final org.eclipse.swt.graphics.Point los = glCanvas2.toDisplay(0, 0);
+ pGLWinLOS = new Point(los.x, los.y);
System.err.println("GLCanvas2 LOS: "+pGLWinLOS);
}
Assert.assertTrue( "GLWindow2 LOS "+pGLWinLOS+" not >= sash-right "+pSashRightClient, pGLWinLOS.compareTo(pSashRightClient) >= 0 );