diff options
Diffstat (limited to 'src/classes/com/sun/opengl')
3 files changed, 20 insertions, 15 deletions
diff --git a/src/classes/com/sun/opengl/impl/macosx/MacOSXGLDrawableFactory.java b/src/classes/com/sun/opengl/impl/macosx/MacOSXGLDrawableFactory.java index 9b351798c..22f550456 100644 --- a/src/classes/com/sun/opengl/impl/macosx/MacOSXGLDrawableFactory.java +++ b/src/classes/com/sun/opengl/impl/macosx/MacOSXGLDrawableFactory.java @@ -41,8 +41,6 @@ package com.sun.opengl.impl.macosx; import java.awt.Component; import java.awt.EventQueue; -import java.awt.GraphicsConfiguration; -import java.awt.GraphicsDevice; import java.lang.reflect.InvocationTargetException; import java.util.ArrayList; import java.util.List; @@ -54,9 +52,9 @@ public class MacOSXGLDrawableFactory extends GLDrawableFactoryImpl { NativeLibLoader.loadCore(); } - public GraphicsConfiguration chooseGraphicsConfiguration(GLCapabilities capabilities, - GLCapabilitiesChooser chooser, - GraphicsDevice device) { + public AbstractGraphicsConfiguration chooseGraphicsConfiguration(GLCapabilities capabilities, + GLCapabilitiesChooser chooser, + AbstractGraphicsDevice device) { return null; } diff --git a/src/classes/com/sun/opengl/impl/windows/WindowsGLDrawableFactory.java b/src/classes/com/sun/opengl/impl/windows/WindowsGLDrawableFactory.java index ac56d9469..4649ba8d0 100644 --- a/src/classes/com/sun/opengl/impl/windows/WindowsGLDrawableFactory.java +++ b/src/classes/com/sun/opengl/impl/windows/WindowsGLDrawableFactory.java @@ -40,8 +40,6 @@ package com.sun.opengl.impl.windows; import java.awt.Component; -import java.awt.GraphicsConfiguration; -import java.awt.GraphicsDevice; import java.awt.Rectangle; import java.io.File; import java.lang.reflect.InvocationTargetException; @@ -64,9 +62,9 @@ public class WindowsGLDrawableFactory extends GLDrawableFactoryImpl { NativeLibLoader.loadCore(); } - public GraphicsConfiguration chooseGraphicsConfiguration(GLCapabilities capabilities, - GLCapabilitiesChooser chooser, - GraphicsDevice device) { + public AbstractGraphicsConfiguration chooseGraphicsConfiguration(GLCapabilities capabilities, + GLCapabilitiesChooser chooser, + AbstractGraphicsDevice device) { return null; } diff --git a/src/classes/com/sun/opengl/impl/x11/X11GLDrawableFactory.java b/src/classes/com/sun/opengl/impl/x11/X11GLDrawableFactory.java index 133431824..64b4d437c 100644 --- a/src/classes/com/sun/opengl/impl/x11/X11GLDrawableFactory.java +++ b/src/classes/com/sun/opengl/impl/x11/X11GLDrawableFactory.java @@ -78,17 +78,26 @@ public class X11GLDrawableFactory extends GLDrawableFactoryImpl { private static final int MAX_ATTRIBS = 128; - public GraphicsConfiguration chooseGraphicsConfiguration(GLCapabilities capabilities, - GLCapabilitiesChooser chooser, - GraphicsDevice device) { + public AbstractGraphicsConfiguration chooseGraphicsConfiguration(GLCapabilities capabilities, + GLCapabilitiesChooser chooser, + AbstractGraphicsDevice absDevice) { if (capabilities == null) { capabilities = new GLCapabilities(); } if (chooser == null) { chooser = new DefaultGLCapabilitiesChooser(); } - if (device == null) { + GraphicsDevice device = null; + if (absDevice != null && + !(absDevice instanceof AWTGraphicsDevice)) { + throw new GLException("This GLDrawableFactory accepts only AWTGraphicsDevice objects"); + } + + if ((absDevice == null) || + (((AWTGraphicsDevice) absDevice).getGraphicsDevice() == null)) { device = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice(); + } else { + device = ((AWTGraphicsDevice) absDevice).getGraphicsDevice(); } int screen = X11SunJDKReflection.graphicsDeviceGetScreen(device); @@ -142,7 +151,7 @@ public class X11GLDrawableFactory extends GLDrawableFactoryImpl { GraphicsConfiguration config = configs[i]; if (config != null) { if (X11SunJDKReflection.graphicsConfigurationGetVisualID(config) == visualID) { - return config; + return new AWTGraphicsConfiguration(config); } } } |