From bafd9b99816f55c105230a59211caf13f0315910 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Wed, 23 Nov 2011 07:44:42 +0100 Subject: NativeSurface's getGraphicsConfiguration() returns the native (delegated) AbstractGraphicsConfiguration, if delegation is used. This change restricts the usage of AbstractGraphicsConfiguration's getNativeGraphicsConfiguration() to NativeSurface implementations and hence reduces complexity. NativeSurface implementations are adapted and access to it's AbstractGraphicsConfiguration is controlled via get/set method avoiding flawed usage (read/write), since read access shall return the delegated AbstractGraphicsConfiguration, if used. --- src/newt/classes/jogamp/newt/driver/macosx/MacWindow.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/newt/classes/jogamp/newt/driver/macosx/MacWindow.java') diff --git a/src/newt/classes/jogamp/newt/driver/macosx/MacWindow.java b/src/newt/classes/jogamp/newt/driver/macosx/MacWindow.java index b7e572b6c..277f7e6b9 100644 --- a/src/newt/classes/jogamp/newt/driver/macosx/MacWindow.java +++ b/src/newt/classes/jogamp/newt/driver/macosx/MacWindow.java @@ -34,6 +34,7 @@ package jogamp.newt.driver.macosx; +import javax.media.nativewindow.AbstractGraphicsConfiguration; import javax.media.nativewindow.GraphicsConfigurationFactory; import javax.media.nativewindow.NativeWindow; import javax.media.nativewindow.NativeWindowException; @@ -59,11 +60,12 @@ public class MacWindow extends WindowImpl implements SurfaceChangeable, DriverCl @Override protected void createNativeImpl() { - config = GraphicsConfigurationFactory.getFactory(getScreen().getDisplay().getGraphicsDevice()).chooseGraphicsConfiguration( + final AbstractGraphicsConfiguration cfg = GraphicsConfigurationFactory.getFactory(getScreen().getDisplay().getGraphicsDevice()).chooseGraphicsConfiguration( capsRequested, capsRequested, capabilitiesChooser, getScreen().getGraphicsScreen()); - if (config == null) { + if (null == cfg) { throw new NativeWindowException("Error choosing GraphicsConfiguration creating window: "+this); } + setGraphicsConfiguration(cfg); reconfigureWindowImpl(x, y, width, height, getReconfigureFlags(FLAG_CHANGE_VISIBILITY, true)); if (0 == getWindowHandle()) { throw new NativeWindowException("Error creating window"); @@ -303,7 +305,7 @@ public class MacWindow extends WindowImpl implements SurfaceChangeable, DriverCl } setWindowHandle(createWindow0(getParentWindowHandle(), pS.getX(), pS.getY(), width, height, - (config.getChosenCapabilities().isBackgroundOpaque() && !offscreenInstance), + (getGraphicsConfiguration().getChosenCapabilities().isBackgroundOpaque() && !offscreenInstance), fullscreen, ((isUndecorated() || offscreenInstance) ? NSBorderlessWindowMask : -- cgit v1.2.3