diff options
author | Sven Gothel <[email protected]> | 2011-11-25 00:12:17 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2011-11-25 00:12:17 +0100 |
commit | c84e235b3284d0e18481748b44594116e25821a9 (patch) | |
tree | e18d64647e830132389ef675d85cef13a080380f /src/newt/classes/jogamp | |
parent | 3bc1ef8344ad44969ef436a0b98b0cde490a78fa (diff) |
JOGL/NativeWindow: Push down JOGL's X11AWTGLXGraphicsConfigurationFactory to NativeWindow X11AWTGraphicsConfigurationFactory
X11AWTGraphicsConfigurationFactory properly construct a AWTGraphicsConfiguration
encapsulated a native X11GraphicsConfiguration, now available for non JOGL modules, ie NEWT.
AWTGraphicsConfiguration's create() utilizes the X11AWTGraphicsConfigurationFactory
via the generic factory mechanism and hence allows encapsulating a native [X11]GraphicsConfiguration.
NewtCanvasAWT creates/destroys the JAWT NativeWindow on addNotify/removeNotify (reparentWindow) again.
Hence the JAWTWindow is instantiated completly only, instead of utilizing updateConfiguration(..),
which simplifies the mechanism.
Diffstat (limited to 'src/newt/classes/jogamp')
-rw-r--r-- | src/newt/classes/jogamp/newt/awt/NewtFactoryAWT.java | 23 |
1 files changed, 3 insertions, 20 deletions
diff --git a/src/newt/classes/jogamp/newt/awt/NewtFactoryAWT.java b/src/newt/classes/jogamp/newt/awt/NewtFactoryAWT.java index d4b2fd3d6..a551ae689 100644 --- a/src/newt/classes/jogamp/newt/awt/NewtFactoryAWT.java +++ b/src/newt/classes/jogamp/newt/awt/NewtFactoryAWT.java @@ -36,6 +36,7 @@ import javax.media.nativewindow.awt.*; import com.jogamp.newt.NewtFactory; import jogamp.nativewindow.jawt.JAWTWindow; +import jogamp.nativewindow.x11.awt.X11AWTGraphicsConfigurationFactory; import jogamp.newt.Debug; public class NewtFactoryAWT extends NewtFactory { @@ -64,7 +65,7 @@ public class NewtFactoryAWT extends NewtFactory { } public static JAWTWindow getNativeWindow(java.awt.Component awtComp, CapabilitiesImmutable capsRequested) { - AWTGraphicsConfiguration config = AWTGraphicsConfiguration.create(awtComp, null, capsRequested); + AWTGraphicsConfiguration config = X11AWTGraphicsConfigurationFactory.chooseGraphicsConfigurationStatic(awtComp, null, capsRequested); NativeWindow nw = NativeWindowFactory.getNativeWindow(awtComp, config); // a JAWTWindow if(! ( nw instanceof JAWTWindow ) ) { throw new NativeWindowException("Not an AWT NativeWindow: "+nw); @@ -73,24 +74,6 @@ public class NewtFactoryAWT extends NewtFactory { System.err.println("NewtFactoryAWT.getNativeWindow: "+awtComp+" -> "+nw); } return (JAWTWindow)nw; - } - - public static void updateGraphicsConfiguration(JAWTWindow nw, java.awt.Component awtComp) { - if(DEBUG_IMPLEMENTATION) { - System.err.println("NewtFactoryAWT.updateGraphicsConfiguration: (pre) "+awtComp+" -> "+nw); - } - final AWTGraphicsConfiguration awtConfig = (AWTGraphicsConfiguration) nw.getGraphicsConfiguration(); - awtConfig.updateGraphicsConfiguration(awtComp); - // lockSurface() re-issues JAWTWindow's native validation - if( NativeSurface.LOCK_SURFACE_NOT_READY >= nw.lockSurface() ) { - throw new NativeWindowException("could not lock "+nw); - } - nw.unlockSurface(); - - if(DEBUG_IMPLEMENTATION) { - System.err.println("NewtFactoryAWT.updateGraphicsConfiguration: (post) "+awtComp+" -> "+nw); - } - } - + } } |