aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2011-11-25 00:20:06 +0100
committerSven Gothel <[email protected]>2011-11-25 00:20:06 +0100
commita94c1a2945a31aa5d93e354da3bc80f59f253ec4 (patch)
tree8709f61d318f6224500fff77f0d74c4a38c75912 /src
parentc84e235b3284d0e18481748b44594116e25821a9 (diff)
Nativewindow AWT Device/Screen: Cleanup construction [default, specific]; AWTDevice: Remove subtype
Diffstat (limited to 'src')
-rw-r--r--src/jogl/classes/javax/media/opengl/awt/GLCanvas.java4
-rw-r--r--src/jogl/classes/jogamp/opengl/macosx/cgl/awt/MacOSXAWTCGLGraphicsConfigurationFactory.java2
-rw-r--r--src/jogl/classes/jogamp/opengl/windows/wgl/awt/WindowsAWTWGLGraphicsConfigurationFactory.java2
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/awt/AWTGraphicsDevice.java37
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/awt/AWTGraphicsScreen.java9
-rw-r--r--src/newt/classes/jogamp/newt/driver/awt/AWTCanvas.java4
-rw-r--r--src/newt/classes/jogamp/newt/driver/awt/AWTDisplay.java3
7 files changed, 19 insertions, 42 deletions
diff --git a/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java b/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java
index 00def7233..329bb125e 100644
--- a/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java
+++ b/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java
@@ -1001,7 +1001,9 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
return null;
}
- final AbstractGraphicsScreen aScreen = AWTGraphicsScreen.createScreenDevice(device, AbstractGraphicsDevice.DEFAULT_UNIT);
+ final AbstractGraphicsScreen aScreen = null != device ?
+ AWTGraphicsScreen.createScreenDevice(device, AbstractGraphicsDevice.DEFAULT_UNIT):
+ AWTGraphicsScreen.createDefault();
AWTGraphicsConfiguration config = null;
if( EventQueue.isDispatchThread() || Thread.holdsLock(getTreeLock()) ) {
diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/awt/MacOSXAWTCGLGraphicsConfigurationFactory.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/awt/MacOSXAWTCGLGraphicsConfigurationFactory.java
index 12f40a73a..a8c04eee4 100644
--- a/src/jogl/classes/jogamp/opengl/macosx/cgl/awt/MacOSXAWTCGLGraphicsConfigurationFactory.java
+++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/awt/MacOSXAWTCGLGraphicsConfigurationFactory.java
@@ -74,7 +74,7 @@ public class MacOSXAWTCGLGraphicsConfigurationFactory extends GLGraphicsConfigur
}
if(null==absScreen) {
- absScreen = AWTGraphicsScreen.createScreenDevice(-1, AbstractGraphicsDevice.DEFAULT_UNIT);
+ absScreen = AWTGraphicsScreen.createDefault();
}
AWTGraphicsScreen awtScreen = (AWTGraphicsScreen) absScreen;
device = ((AWTGraphicsDevice)awtScreen.getDevice()).getGraphicsDevice();
diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/awt/WindowsAWTWGLGraphicsConfigurationFactory.java b/src/jogl/classes/jogamp/opengl/windows/wgl/awt/WindowsAWTWGLGraphicsConfigurationFactory.java
index 3c913d4ac..08cd63c5e 100644
--- a/src/jogl/classes/jogamp/opengl/windows/wgl/awt/WindowsAWTWGLGraphicsConfigurationFactory.java
+++ b/src/jogl/classes/jogamp/opengl/windows/wgl/awt/WindowsAWTWGLGraphicsConfigurationFactory.java
@@ -78,7 +78,7 @@ public class WindowsAWTWGLGraphicsConfigurationFactory extends GLGraphicsConfigu
}
if(null==absScreen) {
- absScreen = AWTGraphicsScreen.createScreenDevice(-1, AbstractGraphicsDevice.DEFAULT_UNIT);
+ absScreen = AWTGraphicsScreen.createDefault();
if(DEBUG) {
System.err.println("WindowsAWTWGLGraphicsConfigurationFactory: creating default device: "+absScreen);
}
diff --git a/src/nativewindow/classes/javax/media/nativewindow/awt/AWTGraphicsDevice.java b/src/nativewindow/classes/javax/media/nativewindow/awt/AWTGraphicsDevice.java
index 66a63bfcd..2b0fdd931 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/awt/AWTGraphicsDevice.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/awt/AWTGraphicsDevice.java
@@ -46,26 +46,20 @@ import javax.media.nativewindow.AbstractGraphicsDevice;
/** A wrapper for an AWT GraphicsDevice allowing it to be
handled in a toolkit-independent manner. */
-
public class AWTGraphicsDevice extends DefaultGraphicsDevice implements Cloneable {
private GraphicsDevice device;
- private String subType;
- protected AWTGraphicsDevice(GraphicsDevice device, int unitID) {
+ public AWTGraphicsDevice(GraphicsDevice device, int unitID) {
super(NativeWindowFactory.TYPE_AWT, device.getIDstring(), unitID);
this.device = device;
- this.subType = null;
}
- public static AbstractGraphicsDevice createDevice(GraphicsDevice awtDevice, int unitID) {
- if(null==awtDevice) {
- awtDevice = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
- unitID = AbstractGraphicsDevice.DEFAULT_UNIT;
- }
- return new AWTGraphicsDevice(awtDevice, unitID);
+ public static AWTGraphicsDevice createDefault() {
+ GraphicsDevice awtDevice = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
+ return new AWTGraphicsDevice(awtDevice, AbstractGraphicsDevice.DEFAULT_UNIT);
}
- @Override
+ @Override
public Object clone() {
return super.clone();
}
@@ -74,26 +68,9 @@ public class AWTGraphicsDevice extends DefaultGraphicsDevice implements Cloneabl
return device;
}
- /**
- * In case the native handle was specified, e.g. using X11,
- * we shall be able to mark it.<br>
- * This will also set the subType, queried with {@link #getSubType()}
- * and reset the ToolkitLock type with {@link NativeWindowFactory#createDefaultToolkitLock(java.lang.String, long)}
- * and {@link #setToolkitLock(javax.media.nativewindow.ToolkitLock)}.
- */
- public void setSubType(String subType, long handle) {
- this.handle = handle;
- this.subType = subType;
- setToolkitLock( NativeWindowFactory.createDefaultToolkitLock(subType, handle) );
- }
-
- public String getSubType() {
- return subType;
- }
-
- @Override
+ @Override
public String toString() {
- return getClass().getSimpleName()+"[type "+getType()+"[subType "+getSubType()+"], connection "+getConnection()+", unitID "+getUnitID()+", awtDevice "+device+", handle 0x"+Long.toHexString(getHandle())+"]";
+ return getClass().getSimpleName()+"[type "+getType()+", connection "+getConnection()+", unitID "+getUnitID()+", awtDevice "+device+", handle 0x"+Long.toHexString(getHandle())+"]";
}
}
diff --git a/src/nativewindow/classes/javax/media/nativewindow/awt/AWTGraphicsScreen.java b/src/nativewindow/classes/javax/media/nativewindow/awt/AWTGraphicsScreen.java
index 383dcae80..12b880ff7 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/awt/AWTGraphicsScreen.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/awt/AWTGraphicsScreen.java
@@ -42,7 +42,6 @@ package javax.media.nativewindow.awt;
import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;
import javax.media.nativewindow.*;
-import javax.media.nativewindow.AbstractGraphicsDevice;
/** A wrapper for an AWT GraphicsDevice (screen) allowing it to be
handled in a toolkit-independent manner. */
@@ -74,17 +73,15 @@ public class AWTGraphicsScreen extends DefaultGraphicsScreen implements Cloneabl
}
public static AbstractGraphicsScreen createScreenDevice(GraphicsDevice awtDevice, int unitID) {
- AWTGraphicsDevice device = (AWTGraphicsDevice) AWTGraphicsDevice.createDevice(awtDevice, unitID);
- return new AWTGraphicsScreen(device);
+ return new AWTGraphicsScreen(new AWTGraphicsDevice(awtDevice, unitID));
}
public static AbstractGraphicsScreen createScreenDevice(int index, int unitID) {
- GraphicsDevice awtDevice = getScreenDevice(index);
- return createScreenDevice(awtDevice, unitID);
+ return createScreenDevice(getScreenDevice(index), unitID);
}
public static AbstractGraphicsScreen createDefault() {
- return createScreenDevice(-1, AbstractGraphicsDevice.DEFAULT_UNIT);
+ return new AWTGraphicsScreen(AWTGraphicsDevice.createDefault());
}
public Object clone() {
diff --git a/src/newt/classes/jogamp/newt/driver/awt/AWTCanvas.java b/src/newt/classes/jogamp/newt/driver/awt/AWTCanvas.java
index 390d96fde..b63e433f6 100644
--- a/src/newt/classes/jogamp/newt/driver/awt/AWTCanvas.java
+++ b/src/newt/classes/jogamp/newt/driver/awt/AWTCanvas.java
@@ -246,7 +246,9 @@ public class AWTCanvas extends Canvas {
CapabilitiesImmutable capsRequested,
CapabilitiesChooser chooser,
GraphicsDevice device) {
- AbstractGraphicsScreen aScreen = AWTGraphicsScreen.createScreenDevice(device, AbstractGraphicsDevice.DEFAULT_UNIT);
+ final AbstractGraphicsScreen aScreen = null != device ?
+ AWTGraphicsScreen.createScreenDevice(device, AbstractGraphicsDevice.DEFAULT_UNIT):
+ AWTGraphicsScreen.createDefault();
AWTGraphicsConfiguration config = (AWTGraphicsConfiguration)
GraphicsConfigurationFactory.getFactory(AWTGraphicsDevice.class).chooseGraphicsConfiguration(capsChosen,
capsRequested,
diff --git a/src/newt/classes/jogamp/newt/driver/awt/AWTDisplay.java b/src/newt/classes/jogamp/newt/driver/awt/AWTDisplay.java
index 64c741464..f4ee5f2df 100644
--- a/src/newt/classes/jogamp/newt/driver/awt/AWTDisplay.java
+++ b/src/newt/classes/jogamp/newt/driver/awt/AWTDisplay.java
@@ -33,7 +33,6 @@
package jogamp.newt.driver.awt;
-import javax.media.nativewindow.AbstractGraphicsDevice;
import javax.media.nativewindow.awt.AWTGraphicsDevice;
import com.jogamp.newt.NewtFactory;
import jogamp.newt.DisplayImpl;
@@ -43,7 +42,7 @@ public class AWTDisplay extends DisplayImpl {
}
protected void createNativeImpl() {
- aDevice = (AWTGraphicsDevice) AWTGraphicsDevice.createDevice(null, AbstractGraphicsDevice.DEFAULT_UNIT); // default
+ aDevice = AWTGraphicsDevice.createDefault();
}
protected void setAWTGraphicsDevice(AWTGraphicsDevice d) {