aboutsummaryrefslogtreecommitdiffstats
path: root/src/nativewindow/classes
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2012-03-06 09:59:34 +0100
committerSven Gothel <[email protected]>2012-03-06 09:59:34 +0100
commit3fbcf164be214f3c36bfc062e3ef63ddcc2e1687 (patch)
tree7172ac49435fc1cce26c82809b93322d1e72df0e /src/nativewindow/classes
parentefa70cd39e1a2ac18c3e8660f8d57e4569b19018 (diff)
NativeWindow public* reorg 3/3 ; NativeVisualID -> VisualIDHolder incl. proper utilization.
- VisualIDHolder: Update documentation (Exception case, etc) - NativeVisualID -> VisualIDHolder (public) - incl. generic Comparator - better doc and enum values - VID_UNDEFINED == 0 - methods shall not throw exception, but return UNDEFINED - CapabilitiesImmutable extends VisualIDHolder - All Capabilties impl. - use VID_UNDEFINED for undef. value - use final private (immutable) fields - AbstractGraphicsConfiguration extends VisualIDHolder - X11 CreateDummyWindow takes (int) visualID
Diffstat (limited to 'src/nativewindow/classes')
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/AbstractGraphicsConfiguration.java2
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/AbstractGraphicsDevice.java4
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/Capabilities.java14
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/CapabilitiesImmutable.java2
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsConfiguration.java22
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/GraphicsConfigurationFactory.java8
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/VisualIDHolder.java109
-rw-r--r--src/nativewindow/classes/jogamp/nativewindow/x11/X11Capabilities.java52
-rw-r--r--src/nativewindow/classes/jogamp/nativewindow/x11/awt/X11AWTGraphicsConfigurationFactory.java59
9 files changed, 161 insertions, 111 deletions
diff --git a/src/nativewindow/classes/javax/media/nativewindow/AbstractGraphicsConfiguration.java b/src/nativewindow/classes/javax/media/nativewindow/AbstractGraphicsConfiguration.java
index 1930bdda3..ebdaf2fbb 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/AbstractGraphicsConfiguration.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/AbstractGraphicsConfiguration.java
@@ -43,7 +43,7 @@ package javax.media.nativewindow;
/** A marker interface describing a graphics configuration, visual, or
pixel format in a toolkit-independent manner. */
-public interface AbstractGraphicsConfiguration extends Cloneable {
+public interface AbstractGraphicsConfiguration extends VisualIDHolder, Cloneable {
/**
* Return the screen this graphics configuration is valid for
*/
diff --git a/src/nativewindow/classes/javax/media/nativewindow/AbstractGraphicsDevice.java b/src/nativewindow/classes/javax/media/nativewindow/AbstractGraphicsDevice.java
index fa25c214f..1dd01a274 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/AbstractGraphicsDevice.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/AbstractGraphicsDevice.java
@@ -114,8 +114,8 @@ public interface AbstractGraphicsDevice extends Cloneable {
* <p>
* The default implementation is a <code>NOP</code>, just setting the handle to <code>null</code>.
* </p>
- * The specific implementing, ie {@link javax.media.nativewindow.x11.X11GraphicsDevice},
- * shall have a enable/disable like {@link javax.media.nativewindow.x11.X11GraphicsDevice#setCloseDisplay(boolean, boolean)},<br>
+ * The specific implementing, ie {@link com.jogamp.nativewindow.x11.X11GraphicsDevice},
+ * shall have a enable/disable like {@link com.jogamp.nativewindow.x11.X11GraphicsDevice#setCloseDisplay(boolean, boolean)},<br>
* which shall be invoked at creation time to determine ownership/role of freeing the resource.<br>
*
* @return true if the handle was not <code>null</code>, otherwise false.
diff --git a/src/nativewindow/classes/javax/media/nativewindow/Capabilities.java b/src/nativewindow/classes/javax/media/nativewindow/Capabilities.java
index 89cd3d60f..7a58e688f 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/Capabilities.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/Capabilities.java
@@ -40,6 +40,8 @@
package javax.media.nativewindow;
+import javax.media.nativewindow.VisualIDHolder.VIDType;
+
/** Specifies a set of capabilities that a window's rendering context
must support, such as color depth per channel. It currently
contains the minimal number of routines which allow configuration
@@ -140,6 +142,17 @@ public class Capabilities implements CapabilitiesImmutable, Cloneable, Comparabl
return 0; // they are equal: RGBA
}
+ @Override
+ public int getVisualID(VIDType type) throws NativeWindowException {
+ switch(type) {
+ case INTRINSIC:
+ case NATIVE:
+ return VisualIDHolder.VID_UNDEFINED;
+ default:
+ throw new NativeWindowException("Invalid type <"+type+">");
+ }
+ }
+
/** Returns the number of bits requested for the color buffer's red
component. On some systems only the color depth, which is the
sum of the red, green, and blue bits, is considered. */
@@ -331,4 +344,5 @@ public class Capabilities implements CapabilitiesImmutable, Cloneable, Comparabl
msg.append("]");
return msg.toString();
}
+
}
diff --git a/src/nativewindow/classes/javax/media/nativewindow/CapabilitiesImmutable.java b/src/nativewindow/classes/javax/media/nativewindow/CapabilitiesImmutable.java
index eccdf7797..848ec74e1 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/CapabilitiesImmutable.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/CapabilitiesImmutable.java
@@ -36,7 +36,7 @@ import com.jogamp.common.type.WriteCloneable;
*
* @see javax.media.nativewindow.Capabilities
*/
-public interface CapabilitiesImmutable extends WriteCloneable {
+public interface CapabilitiesImmutable extends VisualIDHolder, WriteCloneable {
/**
* Returns the number of bits requested for the color buffer's red
diff --git a/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsConfiguration.java b/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsConfiguration.java
index 15c9e6a36..a33c3792a 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsConfiguration.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsConfiguration.java
@@ -44,13 +44,16 @@ public class DefaultGraphicsConfiguration implements Cloneable, AbstractGraphics
public DefaultGraphicsConfiguration(AbstractGraphicsScreen screen,
CapabilitiesImmutable capsChosen, CapabilitiesImmutable capsRequested) {
if(null == screen) {
- throw new NativeWindowException("Null screen");
+ throw new IllegalArgumentException("Null screen");
}
if(null == capsChosen) {
- throw new NativeWindowException("Null chosen caps");
+ throw new IllegalArgumentException("Null chosen caps");
}
if(null == capsRequested) {
- throw new NativeWindowException("Null requested caps");
+ throw new IllegalArgumentException("Null requested caps");
+ }
+ if( ! ( capsChosen instanceof VisualIDHolder ) ) {
+ throw new IllegalArgumentException("Chosen caps is not implementing NativeVisualID");
}
this.screen = screen;
this.capabilitiesChosen = capsChosen;
@@ -66,15 +69,15 @@ public class DefaultGraphicsConfiguration implements Cloneable, AbstractGraphics
}
}
- public AbstractGraphicsScreen getScreen() {
+ final public AbstractGraphicsScreen getScreen() {
return screen;
}
- public CapabilitiesImmutable getChosenCapabilities() {
+ final public CapabilitiesImmutable getChosenCapabilities() {
return capabilitiesChosen;
}
- public CapabilitiesImmutable getRequestedCapabilities() {
+ final public CapabilitiesImmutable getRequestedCapabilities() {
return capabilitiesRequested;
}
@@ -82,6 +85,11 @@ public class DefaultGraphicsConfiguration implements Cloneable, AbstractGraphics
return this;
}
+ @Override
+ final public int getVisualID(VIDType type) throws NativeWindowException {
+ return capabilitiesChosen.getVisualID(type);
+ }
+
/**
* Set the capabilities to a new value.
*
@@ -102,7 +110,7 @@ public class DefaultGraphicsConfiguration implements Cloneable, AbstractGraphics
*
* A copy of the passed object is being used.
*/
- protected void setScreen(DefaultGraphicsScreen screen) {
+ final protected void setScreen(DefaultGraphicsScreen screen) {
this.screen = (AbstractGraphicsScreen) screen.clone();
}
diff --git a/src/nativewindow/classes/javax/media/nativewindow/GraphicsConfigurationFactory.java b/src/nativewindow/classes/javax/media/nativewindow/GraphicsConfigurationFactory.java
index fb8bf2764..e5f230b4c 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/GraphicsConfigurationFactory.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/GraphicsConfigurationFactory.java
@@ -223,12 +223,12 @@ public abstract class GraphicsConfigurationFactory {
* returned graphics configuration must be specified in the
* documentation binding this particular API to the underlying
* window toolkit. The Reference Implementation accepts {@link
- * javax.media.nativewindow.awt.AWTGraphicsDevice AWTGraphicsDevice} objects and returns {@link
- * javax.media.nativewindow.awt.AWTGraphicsConfiguration AWTGraphicsConfiguration} objects. On
+ * com.jogamp.nativewindow.awt.AWTGraphicsDevice AWTGraphicsDevice} objects and returns {@link
+ * com.jogamp.nativewindow.awt.AWTGraphicsConfiguration AWTGraphicsConfiguration} objects. On
* X11 platforms where the AWT is not in use, it also accepts
- * {@link javax.media.nativewindow.x11.X11GraphicsDevice
+ * {@link com.jogamp.nativewindow.x11.X11GraphicsDevice
* X11GraphicsDevice} objects and returns {@link
- * javax.media.nativewindow.x11.X11GraphicsConfiguration
+ * com.jogamp.nativewindow.x11.X11GraphicsConfiguration
* X11GraphicsConfiguration} objects.</P>
*
* @param capsChosen the intermediate chosen capabilities to be refined by this implementation, may be equal to capsRequested
diff --git a/src/nativewindow/classes/javax/media/nativewindow/VisualIDHolder.java b/src/nativewindow/classes/javax/media/nativewindow/VisualIDHolder.java
index 20d3ad6dc..4f3d3ff00 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/VisualIDHolder.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/VisualIDHolder.java
@@ -26,59 +26,110 @@
* or implied, of JogAmp Community.
*/
-package jogamp.nativewindow;
+package javax.media.nativewindow;
+
+import java.util.Comparator;
/**
- * Specifies query to the native capabilities identification.
- * Semantics may differ depending on the native windowing system,
+ * Visual ID holder interface.
+ * <p>
+ * Allows queries of different types of native visual IDs,
* see {@link #getVisualID(int)}.
+ * </p>
*/
-public interface NativeVisualID {
+public interface VisualIDHolder {
- public enum NVIDType {
- GEN_ID(0), NATIVE_ID(1),
- EGL_ConfigID(2), EGL_NativeVisualID(3), X11_XVisualID(4), X11_FBConfigID(5), WIN32_PFDID(6);
+ public enum VIDType {
+ // Generic Values
+ INTRINSIC(0), NATIVE(1),
+ // EGL Values
+ EGL_CONFIG(10),
+ // X11 Values
+ X11_XVISUAL(20), X11_FBCONFIG(21),
+ // Windows Values
+ WIN32_PFD(30);
public final int id;
- NVIDType(int id){
+ VIDType(int id){
this.id = id;
}
}
/**
- * Returns the native identification of the given <code>type</code>.
+ * Returns the native visual ID of the given <code>type</code>
+ * if supported, or {@link #VID_UNDEFINED} if not supported.
* <p>
- * Depending on the native windowing system, this might be
+ * Depending on the native windowing system, <code>type</code> is handled as follows:
* <ul>
- * <li>X11
+ * <li>X11 throws NativeWindowException on <code>EGL_CONFIG</code>, <code>WIN32_PFD</code>
* <ul>
- * <li>GEN_ID: X11_XVisualID</li>
- * <li>NATIVE_ID: X11_XVisualID</li>
- * <li>X11_XVisualID</li>
+ * <li><code>INTRINSIC</code>: <i>X11 XVisual ID</i></li>
+ * <li><code>NATIVE</code>: <i>X11 XVisual ID</i></li>
+ * <li><code>X11_XVISUAL</code>: <i>X11 XVisual ID</i></li>
+ * <li><code>X11_FBCONFIG</code>: <code>VID_UNDEFINED</code></li>
* </ul></li>
- * <li>X11/GL
+ * <li>X11/GL throws NativeWindowException on <code>EGL_CONFIG</code>, <code>WIN32_PFD</code>
* <ul>
- * <li>GEN_ID: X11_XVisualID</li>
- * <li>NATIVE_ID: X11_XVisualID</li>
- * <li>X11_XVisualID</li>
- * <li>X11FBConfigID</li>
+ * <li><code>INTRINSIC</code>: <i>X11 XVisual ID</i></li>
+ * <li><code>NATIVE</code>: <i>X11 XVisual ID</i></li>
+ * <li><code>X11_XVISUAL</code>: <i>X11 XVisual ID</i></li>
+ * <li><code>X11_FBCONFIG</code>: <i>X11 FBConfig ID</i> or <code>VID_UNDEFINED</code></li>
* </ul></li>
- * <li>Windows/GL
+ * <li>Windows/GL throws NativeWindowException on <code>EGL_CONFIG</code>, <code>X11_XVISUAL</code>, <code>X11_FBCONFIG</code>
* <ul>
- * <li>GEN_ID: WIN32_PFDID</li>
- * <li>NATIVE_ID: WIN32_PFDID</li>
- * <li>WIN32_PFDID</li>
+ * <li><code>INTRINSIC</code>: <i>Win32 PIXELFORMATDESCRIPTOR ID</i></li>
+ * <li><code>NATIVE</code>: <i>Win32 PIXELFORMATDESCRIPTOR ID</i></li>
+ * <li><code>WIN32_PFD</code>: <i>Win32 PIXELFORMATDESCRIPTOR ID</i></li>
* </ul></li>
- * <li>EGL/GL
+ * <li>EGL/GL throws NativeWindowException on <code>X11_XVISUAL</code>, <code>X11_FBCONFIG</code>, <code>WIN32_PFD</code>
* <ul>
- * <li>GEN_ID: EGL_ConfigID</li>
- * <li>NATIVE_ID: EGL_NativeVisualID (X11_XVisualID, WIN32_PFDID, ..)</li>
- * <li>EGL_ConfigID</li>
- * <li>EGL_NativeVisualID</li>
+ * <li><code>INTRINSIC</code>: <i>EGL Config ID</i></li>
+ * <li><code>NATIVE</code>: <i>EGL NativeVisual ID</i> (<i>X11 XVisual ID</i>, <i>Win32 PIXELFORMATDESCRIPTOR ID</i>, ...)</li>
+ * <li><code>EGL_CONFIG</code>: <i>EGL Config ID</i></li>
* </ul></li>
* </ul>
* </p>
+ * Note: <code>INTRINSIC</code> and <code>NATIVE</code> are always handled,
+ * but may result in {@link #VID_UNDEFINED}. The latter is true if
+ * the native value are actually undefined or the corresponding object is not
+ * mapped to a native visual object.
+ *
+ * @throws NativeWindowException if <code>type</code> is neither
+ * <code>INTRINSIC</code> nor <code>NATIVE</code>
+ * and does not match the native implementation.
+ */
+ int getVisualID(VIDType type) throws NativeWindowException ;
+
+ /**
+ * {@link #getVisualID(VIDType)} result indicating an undefined value,
+ * which could be cause by an unsupported query.
+ * <p>
+ * We assume the const value <code>0</code> doesn't reflect a valid native visual ID
+ * and is interpreted as <i>no value</i> on all platforms.
+ * This is currently true for Android, X11 and Windows.
+ * </p>
*/
- int getVisualID(NVIDType type);
+ static final int VID_UNDEFINED = 0;
+
+ /** Comparing {@link VIDType#NATIVE} */
+ public static class VIDComparator implements Comparator<VisualIDHolder> {
+ private VIDType type;
+
+ public VIDComparator(VIDType type) {
+ this.type = type;
+ }
+
+ public int compare(VisualIDHolder vid1, VisualIDHolder vid2) {
+ final int id1 = vid1.getVisualID(type);
+ final int id2 = vid2.getVisualID(type);
+
+ if(id1 > id2) {
+ return 1;
+ } else if(id1 < id2) {
+ return -1;
+ }
+ return 0;
+ }
+ }
}
diff --git a/src/nativewindow/classes/jogamp/nativewindow/x11/X11Capabilities.java b/src/nativewindow/classes/jogamp/nativewindow/x11/X11Capabilities.java
index 2e9ab5485..f9eee67f3 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/x11/X11Capabilities.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/x11/X11Capabilities.java
@@ -28,41 +28,12 @@
package jogamp.nativewindow.x11;
-import jogamp.nativewindow.NativeVisualID;
-import java.util.Comparator;
-
import javax.media.nativewindow.Capabilities;
import javax.media.nativewindow.NativeWindowException;
+import javax.media.nativewindow.VisualIDHolder;
-public class X11Capabilities extends Capabilities implements NativeVisualID {
- final XVisualInfo xVisualInfo; // maybe null if !onscreen
-
- /** Comparing xvisual id only */
- public static class XVisualIDComparator implements Comparator {
- public int compare(Object o1, Object o2) {
- if ( ! ( o1 instanceof NativeVisualID ) ) {
- Class<?> c = (null != o1) ? o1.getClass() : null ;
- throw new ClassCastException("arg1 not a NativeVisualID object: " + c);
- }
- if ( ! ( o2 instanceof NativeVisualID ) ) {
- Class<?> c = (null != o2) ? o2.getClass() : null ;
- throw new ClassCastException("arg2 not a NativeVisualID object: " + c);
- }
-
- final NativeVisualID nvid1 = (NativeVisualID) o1;
- final int id1 = nvid1.getVisualID(NativeVisualID.NVIDType.X11_XVisualID);
-
- final NativeVisualID nvid2 = (NativeVisualID) o2;
- final int id2 = nvid2.getVisualID(NativeVisualID.NVIDType.X11_XVisualID);
-
- if(id1 > id2) {
- return 1;
- } else if(id1 < id2) {
- return -1;
- }
- return 0;
- }
- }
+public class X11Capabilities extends Capabilities {
+ final private XVisualInfo xVisualInfo; // maybe null if !onscreen
public X11Capabilities(XVisualInfo xVisualInfo) {
super();
@@ -82,20 +53,21 @@ public class X11Capabilities extends Capabilities implements NativeVisualID {
}
final public XVisualInfo getXVisualInfo() { return xVisualInfo; }
- final public int getXVisualID() { return (null!=xVisualInfo) ? (int) xVisualInfo.getVisualid() : 0; }
+ final public int getXVisualID() { return (null!=xVisualInfo) ? (int) xVisualInfo.getVisualid() : VisualIDHolder.VID_UNDEFINED; }
final public boolean hasXVisualInfo() { return null!=xVisualInfo; }
- final public int getVisualID(NVIDType type) {
+ @Override
+ final public int getVisualID(VIDType type) throws NativeWindowException {
switch(type) {
- case GEN_ID:
- case NATIVE_ID:
+ case INTRINSIC:
+ case NATIVE:
// fall through intended
- case X11_XVisualID:
+ case X11_XVISUAL:
return getXVisualID();
- case X11_FBConfigID:
- // fall through intended
+ case X11_FBCONFIG:
+ return VisualIDHolder.VID_UNDEFINED;
default:
- throw new IllegalArgumentException("Invalid type <"+type+">");
+ throw new NativeWindowException("Invalid type <"+type+">");
}
}
diff --git a/src/nativewindow/classes/jogamp/nativewindow/x11/awt/X11AWTGraphicsConfigurationFactory.java b/src/nativewindow/classes/jogamp/nativewindow/x11/awt/X11AWTGraphicsConfigurationFactory.java
index 5dc143559..697be9f93 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/x11/awt/X11AWTGraphicsConfigurationFactory.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/x11/awt/X11AWTGraphicsConfigurationFactory.java
@@ -42,17 +42,18 @@ import javax.media.nativewindow.AbstractGraphicsScreen;
import javax.media.nativewindow.CapabilitiesChooser;
import javax.media.nativewindow.CapabilitiesImmutable;
import javax.media.nativewindow.GraphicsConfigurationFactory;
+import javax.media.nativewindow.VisualIDHolder;
import javax.media.nativewindow.NativeWindowException;
import javax.media.nativewindow.NativeWindowFactory;
import javax.media.nativewindow.ToolkitLock;
-import javax.media.nativewindow.awt.AWTGraphicsConfiguration;
-import javax.media.nativewindow.awt.AWTGraphicsDevice;
-import javax.media.nativewindow.awt.AWTGraphicsScreen;
-import javax.media.nativewindow.x11.X11GraphicsDevice;
-import javax.media.nativewindow.x11.X11GraphicsScreen;
+import javax.media.nativewindow.VisualIDHolder.VIDType;
+
+import com.jogamp.nativewindow.awt.AWTGraphicsConfiguration;
+import com.jogamp.nativewindow.awt.AWTGraphicsDevice;
+import com.jogamp.nativewindow.awt.AWTGraphicsScreen;
+import com.jogamp.nativewindow.x11.X11GraphicsDevice;
+import com.jogamp.nativewindow.x11.X11GraphicsScreen;
-import jogamp.nativewindow.NativeVisualID;
-import jogamp.nativewindow.NativeVisualID.NVIDType;
import jogamp.nativewindow.jawt.x11.X11SunJDKReflection;
import jogamp.nativewindow.x11.X11Lib;
import jogamp.nativewindow.x11.X11Util;
@@ -60,7 +61,7 @@ import jogamp.nativewindow.x11.X11Util;
public class X11AWTGraphicsConfigurationFactory extends GraphicsConfigurationFactory {
public static void registerFactory() {
- GraphicsConfigurationFactory.registerFactory(javax.media.nativewindow.awt.AWTGraphicsDevice.class, new X11AWTGraphicsConfigurationFactory());
+ GraphicsConfigurationFactory.registerFactory(com.jogamp.nativewindow.awt.AWTGraphicsDevice.class, new X11AWTGraphicsConfigurationFactory());
}
private X11AWTGraphicsConfigurationFactory() {
}
@@ -138,17 +139,19 @@ public class X11AWTGraphicsConfigurationFactory extends GraphicsConfigurationFac
// ie. returned by GLCanvas's getGraphicsConfiguration() befor call by super.addNotify().
//
final GraphicsConfiguration[] configs = device.getConfigurations();
- int visualID = ((NativeVisualID) aConfig.getChosenCapabilities()).getVisualID(NVIDType.NATIVE_ID);
- for (int i = 0; i < configs.length; i++) {
- GraphicsConfiguration gc = configs[i];
- if (gc != null) {
- if (X11SunJDKReflection.graphicsConfigurationGetVisualID(gc) == visualID) {
- if(DEBUG) {
- System.err.println("Found matching AWT visual: 0x"+Integer.toHexString(visualID) +" -> "+aConfig);
+ int visualID = aConfig.getVisualID(VIDType.NATIVE);
+ if(VisualIDHolder.VID_UNDEFINED != visualID) {
+ for (int i = 0; i < configs.length; i++) {
+ GraphicsConfiguration gc = configs[i];
+ if (gc != null) {
+ if (X11SunJDKReflection.graphicsConfigurationGetVisualID(gc) == visualID) {
+ if(DEBUG) {
+ System.err.println("Found matching AWT visual: 0x"+Integer.toHexString(visualID) +" -> "+aConfig);
+ }
+ return new AWTGraphicsConfiguration(awtScreen,
+ aConfig.getChosenCapabilities(), aConfig.getRequestedCapabilities(),
+ gc, aConfig);
}
- return new AWTGraphicsConfiguration(awtScreen,
- aConfig.getChosenCapabilities(), aConfig.getRequestedCapabilities(),
- gc, aConfig);
}
}
}
@@ -160,16 +163,18 @@ public class X11AWTGraphicsConfigurationFactory extends GraphicsConfigurationFac
if (aConfig == null) {
throw new NativeWindowException("Unable to choose a GraphicsConfiguration (2): "+capsChosen+",\n\t"+chooser+"\n\t"+x11Screen);
}
- visualID = ((NativeVisualID) aConfig.getChosenCapabilities()).getVisualID(NVIDType.NATIVE_ID);
- for (int i = 0; i < configs.length; i++) {
- gc = configs[i];
- if (X11SunJDKReflection.graphicsConfigurationGetVisualID(gc) == visualID) {
- if(DEBUG) {
- System.err.println("Found matching default AWT visual: 0x"+Integer.toHexString(visualID) +" -> "+aConfig);
+ visualID = aConfig.getVisualID(VIDType.NATIVE);
+ if(VisualIDHolder.VID_UNDEFINED != visualID) {
+ for (int i = 0; i < configs.length; i++) {
+ gc = configs[i];
+ if (X11SunJDKReflection.graphicsConfigurationGetVisualID(gc) == visualID) {
+ if(DEBUG) {
+ System.err.println("Found matching default AWT visual: 0x"+Integer.toHexString(visualID) +" -> "+aConfig);
+ }
+ return new AWTGraphicsConfiguration(awtScreen,
+ aConfig.getChosenCapabilities(), aConfig.getRequestedCapabilities(),
+ gc, aConfig);
}
- return new AWTGraphicsConfiguration(awtScreen,
- aConfig.getChosenCapabilities(), aConfig.getRequestedCapabilities(),
- gc, aConfig);
}
}