From 4faa65ee907a78649e118717574c96031dc9e79b Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Tue, 6 Sep 2011 02:56:07 +0200 Subject: NEWT/Window/Insets: Implement proper Inset usage ; Cleanup WindowImpl::reconfigureWindowImpl Implement proper Inset usage (window decoration size) - Insets are either polled (updateInsets()) or event driven (insetsChanged()) - Insets are used for size/pos calculations from Java side - Natural size/pos in NEWT is client-area, ie w/o Insets - Adding setTopLevelPosition()/setTopLevelSize() for top-level values, ie including insets WindowImpl::reconfigureWindowImpl - Use flags to pass down the requested action to the native implementation - Impl. all native actions: visible, decoration, reparent, resize, fullscreen - Always use size/pos in client-area space, impl. shall use Insets to tranform them - Remove double-setting of (reparent/fullscreen), which where introduced due to buggy impl. code - Fix return from fullscreen position: Was overwritten with FS position (0/0) - Fix decoration change: Remove visible toggle - not required, and actually disturbing X11Windows/WindowsWindow: Added/Fixed Insets impl. Tests (manual): - TestSharedContextVBOES2NEWT utilizies proper window layout using Insets - TestParenting03bAWT uses window layout for reparenting --- .../junit/jogl/acore/TestSharedContextListAWT.java | 4 +- .../jogl/acore/TestSharedContextListNEWT.java | 14 +++-- .../jogl/acore/TestSharedContextVBOES1NEWT.java | 14 +++-- .../jogl/acore/TestSharedContextVBOES2NEWT.java | 14 +++-- .../jogl/demos/es2/newt/TestGearsES2NEWT.java | 14 +++++ .../parenting/NewtAWTReparentingKeyAdapter.java | 66 ++++++++++++++++++++++ .../junit/newt/parenting/TestParenting03bAWT.java | 42 +------------- 7 files changed, 112 insertions(+), 56 deletions(-) create mode 100644 src/test/com/jogamp/opengl/test/junit/newt/parenting/NewtAWTReparentingKeyAdapter.java (limited to 'src/test') diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextListAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextListAWT.java index 8ee182939..99e81af04 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextListAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextListAWT.java @@ -60,8 +60,8 @@ public class TestSharedContextListAWT extends UITestCase { Assert.assertNotNull(glp); caps = new GLCapabilities(glp); Assert.assertNotNull(caps); - width = 512; - height = 512; + width = 256; + height = 256; } private void initShared() { diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextListNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextListNEWT.java index 231a45ca0..73a227740 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextListNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextListNEWT.java @@ -30,6 +30,7 @@ package com.jogamp.opengl.test.junit.jogl.acore; import com.jogamp.newt.opengl.GLWindow; +import javax.media.nativewindow.util.InsetsImmutable; import javax.media.opengl.FPSCounter; import javax.media.opengl.GLCapabilities; import javax.media.opengl.GLDrawableFactory; @@ -58,8 +59,8 @@ public class TestSharedContextListNEWT extends UITestCase { Assert.assertNotNull(glp); caps = new GLCapabilities(glp); Assert.assertNotNull(caps); - width = 512; - height = 512; + width = 256; + height = 256; } private void initShared() { @@ -86,7 +87,6 @@ public class TestSharedContextListNEWT extends UITestCase { } glWindow.setSize(width, height); - glWindow.setPosition(x, y); Gears gears = new Gears(vsync ? 1 : 0); if(useShared) { @@ -98,6 +98,9 @@ public class TestSharedContextListNEWT extends UITestCase { glWindow.setVisible(true); + /** insets (if supported) are available only if window is set visible and hence is created */ + glWindow.setTopLevelPosition(x, y); + return glWindow; } @@ -106,8 +109,9 @@ public class TestSharedContextListNEWT extends UITestCase { initShared(); Animator animator = new Animator(); GLWindow f1 = runTestGL(animator, 0, 0, true, false); - GLWindow f2 = runTestGL(animator, width, 0, true, false); - GLWindow f3 = runTestGL(animator, 0, height, false, true); + InsetsImmutable insets = f1.getInsets(); + GLWindow f2 = runTestGL(animator, width+insets.getTotalWidth(), 0, true, false); + GLWindow f3 = runTestGL(animator, 0, height+insets.getTotalHeight(), false, true); animator.setUpdateFPSFrames(1, null); animator.start(); while(animator.isAnimating() && animator.getTotalFPSDuration()