aboutsummaryrefslogtreecommitdiffstats
path: root/src/nativewindow/classes/jogamp
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2011-11-23 07:44:42 +0100
committerSven Gothel <[email protected]>2011-11-23 07:44:42 +0100
commitbafd9b99816f55c105230a59211caf13f0315910 (patch)
treec805b6385938e2014f504d8d0d025ac799b79c44 /src/nativewindow/classes/jogamp
parent645a863ee5a8efa915dd43abd608248e8cbc13cd (diff)
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.
Diffstat (limited to 'src/nativewindow/classes/jogamp')
-rw-r--r--src/nativewindow/classes/jogamp/nativewindow/WrappedSurface.java2
-rw-r--r--src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTWindow.java18
-rw-r--r--src/nativewindow/classes/jogamp/nativewindow/jawt/macosx/MacOSXJAWTWindow.java4
-rw-r--r--src/nativewindow/classes/jogamp/nativewindow/jawt/windows/Win32SunJDKReflection.java2
-rw-r--r--src/nativewindow/classes/jogamp/nativewindow/jawt/x11/X11JAWTWindow.java5
-rw-r--r--src/nativewindow/classes/jogamp/nativewindow/jawt/x11/X11SunJDKReflection.java2
-rw-r--r--src/nativewindow/classes/jogamp/nativewindow/windows/GDISurface.java2
7 files changed, 20 insertions, 15 deletions
diff --git a/src/nativewindow/classes/jogamp/nativewindow/WrappedSurface.java b/src/nativewindow/classes/jogamp/nativewindow/WrappedSurface.java
index 65ecc48fe..59aa73b6e 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/WrappedSurface.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/WrappedSurface.java
@@ -65,6 +65,6 @@ public class WrappedSurface extends ProxySurface implements SurfaceChangeable {
}
public String toString() {
- return "WrappedSurface[config " + config + ", displayHandle 0x" + Long.toHexString(getDisplayHandle()) + ", surfaceHandle 0x" + Long.toHexString(getSurfaceHandle()) + ", size " + getWidth() + "x" + getHeight() + "]";
+ return "WrappedSurface[config " + getPrivateGraphicsConfiguration() + ", displayHandle 0x" + Long.toHexString(getDisplayHandle()) + ", surfaceHandle 0x" + Long.toHexString(getSurfaceHandle()) + ", size " + getWidth() + "x" + getHeight() + "]";
}
}
diff --git a/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTWindow.java b/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTWindow.java
index 0f97b0b9f..2d695b84d 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTWindow.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTWindow.java
@@ -67,7 +67,7 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface
// lifetime: forever
protected Component component;
- protected AWTGraphicsConfiguration config;
+ private AWTGraphicsConfiguration config; // control access due to delegation
private SurfaceUpdatedHelper surfaceUpdatedHelper = new SurfaceUpdatedHelper();
// lifetime: valid after lock but may change with each 1st lock, purges after invalidate
@@ -273,7 +273,7 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface
if ( LOCK_SURFACE_NOT_READY == res ) {
determineIfApplet();
try {
- final AbstractGraphicsDevice adevice = config.getScreen().getDevice();
+ final AbstractGraphicsDevice adevice = getGraphicsConfiguration().getScreen().getDevice();
adevice.lock();
try {
jawt = fetchJAWTImpl();
@@ -299,7 +299,7 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface
surfaceLock.validateLocked();
if (surfaceLock.getHoldCount() == 1) {
- final AbstractGraphicsDevice adevice = config.getScreen().getDevice();
+ final AbstractGraphicsDevice adevice = getGraphicsConfiguration().getScreen().getDevice();
try {
unlockSurfaceImpl();
} finally {
@@ -329,16 +329,20 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface
return drawable;
}
- public final AbstractGraphicsConfiguration getGraphicsConfiguration() {
+ public final AWTGraphicsConfiguration getPrivateGraphicsConfiguration() {
return config;
}
+
+ public final AbstractGraphicsConfiguration getGraphicsConfiguration() {
+ return config.getNativeGraphicsConfiguration();
+ }
public final long getDisplayHandle() {
- return config.getScreen().getDevice().getHandle();
+ return getGraphicsConfiguration().getScreen().getDevice().getHandle();
}
public final int getScreenIndex() {
- return config.getScreen().getIndex();
+ return getGraphicsConfiguration().getScreen().getIndex();
}
public int getWidth() {
@@ -472,7 +476,7 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface
sb.append(", component NULL");
}
sb.append(", lockedExt "+isSurfaceLockedByOtherThread()+
- ",\n\tconfig "+config+
+ ",\n\tconfig "+getPrivateGraphicsConfiguration()+
",\n\tawtComponent "+getAWTComponent()+"]");
return sb.toString();
diff --git a/src/nativewindow/classes/jogamp/nativewindow/jawt/macosx/MacOSXJAWTWindow.java b/src/nativewindow/classes/jogamp/nativewindow/jawt/macosx/MacOSXJAWTWindow.java
index 70fc1d62f..dfd81d411 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/jawt/macosx/MacOSXJAWTWindow.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/jawt/macosx/MacOSXJAWTWindow.java
@@ -196,9 +196,9 @@ public class MacOSXJAWTWindow extends JAWTWindow implements SurfaceChangeable {
throw new NativeWindowException("Unable to created dummy NSWindow (layered case)");
}
// fix caps reflecting offscreen!
- Capabilities caps = (Capabilities) config.getChosenCapabilities().cloneMutable();
+ Capabilities caps = (Capabilities) getPrivateGraphicsConfiguration().getChosenCapabilities().cloneMutable();
caps.setOnscreen(false);
- config.setChosenCapabilities(caps);
+ getPrivateGraphicsConfiguration().setChosenCapabilities(caps);
}
if(0 == rootSurfaceLayerHandle) {
rootSurfaceLayerHandle = OSXUtil.CreateCALayer();
diff --git a/src/nativewindow/classes/jogamp/nativewindow/jawt/windows/Win32SunJDKReflection.java b/src/nativewindow/classes/jogamp/nativewindow/jawt/windows/Win32SunJDKReflection.java
index 5ad22807f..bf5c18eaf 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/jawt/windows/Win32SunJDKReflection.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/jawt/windows/Win32SunJDKReflection.java
@@ -95,7 +95,7 @@ public class Win32SunJDKReflection {
public static int graphicsConfigurationGetPixelFormatID(AbstractGraphicsConfiguration config) {
try {
if (config instanceof AWTGraphicsConfiguration) {
- return graphicsConfigurationGetPixelFormatID(((AWTGraphicsConfiguration) config).getGraphicsConfiguration());
+ return graphicsConfigurationGetPixelFormatID(((AWTGraphicsConfiguration) config).getAWTGraphicsConfiguration());
}
return 0;
} catch (Exception e) {
diff --git a/src/nativewindow/classes/jogamp/nativewindow/jawt/x11/X11JAWTWindow.java b/src/nativewindow/classes/jogamp/nativewindow/jawt/x11/X11JAWTWindow.java
index 236d380d8..965dc7990 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/jawt/x11/X11JAWTWindow.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/jawt/x11/X11JAWTWindow.java
@@ -61,7 +61,8 @@ public class X11JAWTWindow extends JAWTWindow {
}
protected void validateNative() throws NativeWindowException {
- final AWTGraphicsDevice awtDevice = (AWTGraphicsDevice) config.getScreen().getDevice();
+ // FIXME: REMOVE !!!!!!!!
+ final AWTGraphicsDevice awtDevice = (AWTGraphicsDevice) getPrivateGraphicsConfiguration().getScreen().getDevice();
if(awtDevice.getHandle() != 0) {
// subtype and handle set already, done
@@ -71,7 +72,7 @@ public class X11JAWTWindow extends JAWTWindow {
long displayHandle = 0;
// first try a pre-existing attached native configuration, ie native X11GraphicsDevice
- AbstractGraphicsConfiguration aconfig = (null!=config) ? config.getNativeGraphicsConfiguration() : null;
+ AbstractGraphicsConfiguration aconfig = getGraphicsConfiguration();
AbstractGraphicsScreen ascreen = (null!=aconfig) ? aconfig.getScreen() : null;
AbstractGraphicsDevice adevice = (null!=ascreen) ? ascreen.getDevice() : null; // X11GraphicsDevice
if(null!=adevice) {
diff --git a/src/nativewindow/classes/jogamp/nativewindow/jawt/x11/X11SunJDKReflection.java b/src/nativewindow/classes/jogamp/nativewindow/jawt/x11/X11SunJDKReflection.java
index 6dbf36612..08d471448 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/jawt/x11/X11SunJDKReflection.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/jawt/x11/X11SunJDKReflection.java
@@ -96,7 +96,7 @@ public class X11SunJDKReflection {
public static int graphicsConfigurationGetVisualID(AbstractGraphicsConfiguration config) {
try {
if (config instanceof AWTGraphicsConfiguration) {
- return graphicsConfigurationGetVisualID(((AWTGraphicsConfiguration) config).getGraphicsConfiguration());
+ return graphicsConfigurationGetVisualID(((AWTGraphicsConfiguration) config).getAWTGraphicsConfiguration());
}
return 0;
} catch (Exception e) {
diff --git a/src/nativewindow/classes/jogamp/nativewindow/windows/GDISurface.java b/src/nativewindow/classes/jogamp/nativewindow/windows/GDISurface.java
index 68cf8af45..cbc30afa7 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/windows/GDISurface.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/windows/GDISurface.java
@@ -77,7 +77,7 @@ public class GDISurface extends ProxySurface {
}
public String toString() {
- return "GDISurface[config "+config+
+ return "GDISurface[config "+getPrivateGraphicsConfiguration()+
", displayHandle 0x"+Long.toHexString(getDisplayHandle())+
", windowHandle 0x"+Long.toHexString(windowHandle)+
", surfaceHandle 0x"+Long.toHexString(getSurfaceHandle())+