diff options
Diffstat (limited to 'src/nativewindow/classes/javax/media')
4 files changed, 26 insertions, 15 deletions
diff --git a/src/nativewindow/classes/javax/media/nativewindow/AbstractGraphicsConfiguration.java b/src/nativewindow/classes/javax/media/nativewindow/AbstractGraphicsConfiguration.java index 784343c5a..1930bdda3 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/AbstractGraphicsConfiguration.java +++ b/src/nativewindow/classes/javax/media/nativewindow/AbstractGraphicsConfiguration.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2005 Sun Microsystems, Inc. All Rights Reserved. + * Copyright (c) 2010 JogAmp Community. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -50,7 +51,7 @@ public interface AbstractGraphicsConfiguration extends Cloneable { /** * Return the capabilities reflecting this graphics configuration, - * which may differ from the capabilites used to choose this configuration. + * which may differ from the capabilities used to choose this configuration. * * @return An immutable instance of the Capabilities to avoid mutation by * the user. @@ -61,7 +62,7 @@ public interface AbstractGraphicsConfiguration extends Cloneable { * Return the capabilities used to choose this graphics configuration. * * These may be used to reconfigure the NativeWindow in case - * the device changes in a multi screen environment. + * the device changes in a multiple screen environment. * * @return An immutable instance of the Capabilities to avoid mutation by * the user. @@ -69,10 +70,10 @@ public interface AbstractGraphicsConfiguration extends Cloneable { public CapabilitiesImmutable getRequestedCapabilities(); /** - * In case this instance already reflects a native configuration, - * return this one. - * Otherwise return the encapsuled native configuration, - * as it shall be included e.g. in the AWT case. + * In case the implementation utilizes a delegation pattern to wrap abstract toolkits, + * this method shall return the native {@link AbstractGraphicsConfiguration}, + * otherwise this instance. + * @see NativeSurface#getGraphicsConfiguration() */ public AbstractGraphicsConfiguration getNativeGraphicsConfiguration(); } diff --git a/src/nativewindow/classes/javax/media/nativewindow/NativeSurface.java b/src/nativewindow/classes/javax/media/nativewindow/NativeSurface.java index b2a2bc4ee..d0b586f59 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/NativeSurface.java +++ b/src/nativewindow/classes/javax/media/nativewindow/NativeSurface.java @@ -167,6 +167,11 @@ public interface NativeSurface extends SurfaceUpdatedListener { /** * Returns the graphics configuration corresponding to this window. + * <p> + * In case the implementation utilizes a delegation pattern to wrap abstract toolkits, + * this method shall return the native {@link AbstractGraphicsConfiguration}. + * </p> + * @see AbstractGraphicsConfiguration#getNativeGraphicsConfiguration() * @see javax.media.nativewindow.GraphicsConfigurationFactory#chooseGraphicsConfiguration(Capabilities, CapabilitiesChooser, AbstractGraphicsScreen) */ public AbstractGraphicsConfiguration getGraphicsConfiguration(); diff --git a/src/nativewindow/classes/javax/media/nativewindow/ProxySurface.java b/src/nativewindow/classes/javax/media/nativewindow/ProxySurface.java index 7380d19b6..9100beac2 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/ProxySurface.java +++ b/src/nativewindow/classes/javax/media/nativewindow/ProxySurface.java @@ -34,18 +34,18 @@ import com.jogamp.common.util.locks.LockFactory; import com.jogamp.common.util.locks.RecursiveLock; public abstract class ProxySurface implements NativeSurface { + private SurfaceUpdatedHelper surfaceUpdatedHelper = new SurfaceUpdatedHelper(); + private AbstractGraphicsConfiguration config; // control access due to delegation protected RecursiveLock surfaceLock = LockFactory.createRecursiveLock(); - protected AbstractGraphicsConfiguration config; protected long displayHandle; protected int height; protected int scrnIndex; protected int width; - private SurfaceUpdatedHelper surfaceUpdatedHelper = new SurfaceUpdatedHelper(); public ProxySurface(AbstractGraphicsConfiguration cfg) { invalidate(); config = cfg; - displayHandle=cfg.getScreen().getDevice().getHandle(); + displayHandle=cfg.getNativeGraphicsConfiguration().getScreen().getDevice().getHandle(); } void invalidate() { @@ -58,12 +58,16 @@ public abstract class ProxySurface implements NativeSurface { return displayHandle; } - public final AbstractGraphicsConfiguration getGraphicsConfiguration() { + protected final AbstractGraphicsConfiguration getPrivateGraphicsConfiguration() { return config; } + + public final AbstractGraphicsConfiguration getGraphicsConfiguration() { + return config.getNativeGraphicsConfiguration(); + } public final int getScreenIndex() { - return config.getScreen().getIndex(); + return getGraphicsConfiguration().getScreen().getIndex(); } public abstract long getSurfaceHandle(); @@ -107,7 +111,7 @@ public abstract class ProxySurface implements NativeSurface { if ( LOCK_SURFACE_NOT_READY == res ) { try { - final AbstractGraphicsDevice adevice = config.getScreen().getDevice(); + final AbstractGraphicsDevice adevice = getGraphicsConfiguration().getScreen().getDevice(); adevice.lock(); try { res = lockSurfaceImpl(); @@ -129,7 +133,7 @@ public abstract class ProxySurface implements NativeSurface { surfaceLock.validateLocked(); if (surfaceLock.getHoldCount() == 1) { - final AbstractGraphicsDevice adevice = config.getScreen().getDevice(); + final AbstractGraphicsDevice adevice = getGraphicsConfiguration().getScreen().getDevice(); try { unlockSurfaceImpl(); } finally { diff --git a/src/nativewindow/classes/javax/media/nativewindow/awt/AWTGraphicsConfiguration.java b/src/nativewindow/classes/javax/media/nativewindow/awt/AWTGraphicsConfiguration.java index f60fc3312..012c952f1 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/awt/AWTGraphicsConfiguration.java +++ b/src/nativewindow/classes/javax/media/nativewindow/awt/AWTGraphicsConfiguration.java @@ -141,11 +141,12 @@ public class AWTGraphicsConfiguration extends DefaultGraphicsConfiguration imple return super.clone(); } - public GraphicsConfiguration getGraphicsConfiguration() { + /** Return the AWT {@link GraphicsConfiguration}. */ + public GraphicsConfiguration getAWTGraphicsConfiguration() { return config; } - @Override + @Override public AbstractGraphicsConfiguration getNativeGraphicsConfiguration() { return (null!=encapsulated)?encapsulated:this; } |