summaryrefslogtreecommitdiffstats
path: root/src/newt/classes
diff options
context:
space:
mode:
authorSteve Vaughan <[email protected]>2010-11-17 01:11:09 -0500
committerSteve Vaughan <[email protected]>2010-11-17 01:11:09 -0500
commite491306690f5c1e281bb4f673481dc890fef5217 (patch)
tree79204e5f039f02cc433736715d15d998ef7dcb91 /src/newt/classes
parent483d47795fd1b4bd4cf892960ced8e961f7a8a3c (diff)
Implement CapabilitiesImmutable to indicate that getRequestedCapabilities() and getChosenCapabilities() return immutable instances. Add cloneCapabilities() to create a mutable clone of an immutable set of capabilities.
Diffstat (limited to 'src/newt/classes')
-rw-r--r--src/newt/classes/com/jogamp/newt/Window.java16
-rw-r--r--src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java3
-rw-r--r--src/newt/classes/com/jogamp/newt/impl/WindowImpl.java7
-rw-r--r--src/newt/classes/com/jogamp/newt/opengl/GLWindow.java4
4 files changed, 19 insertions, 11 deletions
diff --git a/src/newt/classes/com/jogamp/newt/Window.java b/src/newt/classes/com/jogamp/newt/Window.java
index 9307ea7f7..13cc0e098 100644
--- a/src/newt/classes/com/jogamp/newt/Window.java
+++ b/src/newt/classes/com/jogamp/newt/Window.java
@@ -33,11 +33,10 @@ import com.jogamp.newt.event.KeyListener;
import com.jogamp.newt.event.MouseListener;
import com.jogamp.newt.event.ScreenModeListener;
import com.jogamp.newt.impl.Debug;
-import javax.media.nativewindow.Capabilities;
+import javax.media.nativewindow.CapabilitiesImmutable;
import javax.media.nativewindow.NativeWindow;
import javax.media.nativewindow.SurfaceUpdatedListener;
import javax.media.nativewindow.util.Insets;
-import javax.media.nativewindow.util.Point;
/**
* Specifying the public Window functionality for the
@@ -80,11 +79,18 @@ public interface Window extends NativeWindow, ScreenModeListener {
Screen getScreen();
/**
- * @return The requested capabilities
+ * Gets an immutable set of requested capabilities.
+ *
+ * @return the requested capabilities
*/
- Capabilities getRequestedCapabilities();
+ CapabilitiesImmutable getRequestedCapabilities();
- Capabilities getChosenCapabilities();
+ /**
+ * Gets an immutable set of chosen capabilities.
+ *
+ * @return the chosen capabilities
+ */
+ CapabilitiesImmutable getChosenCapabilities();
/**
* Destroy the Window and it's children, incl. native destruction.<br>
diff --git a/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java b/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java
index a0ab5f9f6..29e8c91b4 100644
--- a/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java
+++ b/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java
@@ -168,7 +168,8 @@ public class NewtCanvasAWT extends java.awt.Canvas {
newtChild.setFocusAction(null); // no AWT focus traversal ..
if(add) {
- nativeWindow = NewtFactoryAWT.getNativeWindow(this, newtChild.getRequestedCapabilities());
+ nativeWindow = NewtFactoryAWT.getNativeWindow(this,
+ newtChild.getRequestedCapabilities().cloneCapabilites());
if(null!=nativeWindow) {
if(DEBUG) {
System.err.println("NewtCanvasAWT.reparentWindow: "+newtChild);
diff --git a/src/newt/classes/com/jogamp/newt/impl/WindowImpl.java b/src/newt/classes/com/jogamp/newt/impl/WindowImpl.java
index 9f744be82..572ed5bb7 100644
--- a/src/newt/classes/com/jogamp/newt/impl/WindowImpl.java
+++ b/src/newt/classes/com/jogamp/newt/impl/WindowImpl.java
@@ -57,6 +57,7 @@ import java.lang.reflect.Method;
import javax.media.nativewindow.AbstractGraphicsConfiguration;
import javax.media.nativewindow.AbstractGraphicsDevice;
import javax.media.nativewindow.Capabilities;
+import javax.media.nativewindow.CapabilitiesImmutable;
import javax.media.nativewindow.NativeSurface;
import javax.media.nativewindow.NativeWindow;
import javax.media.nativewindow.NativeWindowException;
@@ -1145,12 +1146,12 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer, ScreenMod
return reparentActionStrategy;
}
- public final Capabilities getChosenCapabilities() {
+ public final CapabilitiesImmutable getChosenCapabilities() {
return config.getNativeGraphicsConfiguration().getChosenCapabilities();
}
- public final Capabilities getRequestedCapabilities() {
- return (Capabilities)caps.clone();
+ public final CapabilitiesImmutable getRequestedCapabilities() {
+ return caps;
}
public String getTitle() {
diff --git a/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java b/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java
index 72963eaa3..54fcfe85e 100644
--- a/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java
+++ b/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java
@@ -141,7 +141,7 @@ public class GLWindow implements GLAutoDrawable, Window {
// Window Access
//
- public final Capabilities getChosenCapabilities() {
+ public final CapabilitiesImmutable getChosenCapabilities() {
if (drawable == null) {
return window.getChosenCapabilities();
}
@@ -149,7 +149,7 @@ public class GLWindow implements GLAutoDrawable, Window {
return drawable.getChosenGLCapabilities();
}
- public final Capabilities getRequestedCapabilities() {
+ public final CapabilitiesImmutable getRequestedCapabilities() {
return window.getRequestedCapabilities();
}