diff options
author | Sven Gothel <[email protected]> | 2011-11-09 20:07:58 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2011-11-09 20:07:58 +0100 |
commit | 8f5465396fe429ce6b7ecae808416691271c7867 (patch) | |
tree | c66604588e9047efd66add049975139698542b66 /src | |
parent | 30445211aab2edbb709dbda9d5b619a0f1a15a51 (diff) |
NativeWindow: SurfaceChangeable::setSize() -> surfaceSizeChanged() to avoid conflicts with setSize()
This fixes the NEWT OffscreenWindow conflict w/ setSize()
which represents the action of changing the window's size.
SurfaceChangeable's surfaceSizeChanged() merily notifies the actual size.
JAWTWindow: Remove setSize() since it propagates the surface size upstream only.
MacOSXJAWTWindow is not SurfaceChangeable complete (no surfaceSizeChanged).
Diffstat (limited to 'src')
16 files changed, 24 insertions, 19 deletions
diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java b/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java index 79d96bdb6..decc74258 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java @@ -268,7 +268,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { protected NativeSurface createOffscreenSurfaceImpl(AbstractGraphicsDevice device, GLCapabilitiesImmutable capsChosen, GLCapabilitiesImmutable capsRequested, GLCapabilitiesChooser chooser, int width, int height) { WrappedSurface ns = new WrappedSurface(EGLGraphicsConfigurationFactory.createOffscreenGraphicsConfiguration(device, capsChosen, capsRequested, chooser)); - ns.setSize(width, height); + ns.surfaceSizeChanged(width, height); return ns; } diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawableFactory.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawableFactory.java index e08461527..f02649949 100644 --- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawableFactory.java +++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawableFactory.java @@ -331,7 +331,7 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl { protected NativeSurface createOffscreenSurfaceImpl(AbstractGraphicsDevice device,GLCapabilitiesImmutable capsChosen, GLCapabilitiesImmutable capsRequested, GLCapabilitiesChooser chooser, int width, int height) { AbstractGraphicsScreen screen = DefaultGraphicsScreen.createDefault(NativeWindowFactory.TYPE_MACOSX); WrappedSurface ns = new WrappedSurface(MacOSXCGLGraphicsConfigurationFactory.chooseGraphicsConfigurationStatic(capsChosen, capsRequested, chooser, screen, true)); - ns.setSize(width, height); + ns.surfaceSizeChanged(width, height); return ns; } diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsDummyWGLDrawable.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsDummyWGLDrawable.java index 3d0cce725..966ad867f 100644 --- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsDummyWGLDrawable.java +++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsDummyWGLDrawable.java @@ -84,7 +84,7 @@ public class WindowsDummyWGLDrawable extends WindowsWGLDrawable { GLCapabilities caps = new GLCapabilities(glp); WindowsWGLGraphicsConfiguration cfg = WindowsWGLGraphicsConfigurationFactory.createDefaultGraphicsConfiguration(caps, absScreen); GDISurface ns = new GDISurface(cfg, windowHandle); - ns.setSize(width, height); + ns.surfaceSizeChanged(width, height); return new WindowsDummyWGLDrawable(factory, ns, handleWindowLifecycle); } diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsPbufferWGLDrawable.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsPbufferWGLDrawable.java index 7181a5d3c..cda839967 100644 --- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsPbufferWGLDrawable.java +++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsPbufferWGLDrawable.java @@ -255,7 +255,7 @@ public class WindowsPbufferWGLDrawable extends WindowsWGLDrawable { width = tmp[0]; wglExt.wglQueryPbufferARB( buffer, WGLExt.WGL_PBUFFER_HEIGHT_ARB, tmp, 0 ); height = tmp[0]; - ((SurfaceChangeable)ns).setSize(width, height); + ((SurfaceChangeable)ns).surfaceSizeChanged(width, height); } private static String wglGetLastError() { diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java index 2c9d72fb3..772dbbd00 100644 --- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java +++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java @@ -489,7 +489,7 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl { AbstractGraphicsScreen screen = DefaultGraphicsScreen.createDefault(NativeWindowFactory.TYPE_WINDOWS); WrappedSurface ns = new WrappedSurface(WindowsWGLGraphicsConfigurationFactory.chooseGraphicsConfigurationStatic( capsChosen, capsRequested, chooser, screen) ); - ns.setSize(width, height); + ns.surfaceSizeChanged(width, height); return ns; } diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11DummyGLXDrawable.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11DummyGLXDrawable.java index 68bdb4ab8..720a1c293 100644 --- a/src/jogl/classes/jogamp/opengl/x11/glx/X11DummyGLXDrawable.java +++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11DummyGLXDrawable.java @@ -59,7 +59,7 @@ public class X11DummyGLXDrawable extends X11OnscreenGLXDrawable { dummyWindow = X11Util.CreateDummyWindow(dpy, scrn, visualID, f_dim, f_dim); ns.setSurfaceHandle( dummyWindow ); - ns.setSize(f_dim, f_dim); + ns.surfaceSizeChanged(f_dim, f_dim); updateHandle(); } diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXDrawable.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXDrawable.java index eb286cdf0..c3d2530f2 100644 --- a/src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXDrawable.java +++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXDrawable.java @@ -85,7 +85,7 @@ public class X11ExternalGLXDrawable extends X11GLXDrawable { } WrappedSurface ns = new WrappedSurface(cfg); ns.setSurfaceHandle(drawable); - ns.setSize(w, h); + ns.surfaceSizeChanged(w, h); return new X11ExternalGLXDrawable(factory, ns); } diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java index 51316dc77..d040775ed 100644 --- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java +++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java @@ -423,7 +423,7 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { WrappedSurface ns = new WrappedSurface( X11GLXGraphicsConfigurationFactory.chooseGraphicsConfigurationStatic(capsChosen, capsRequested, chooser, screen) ); if(ns != null) { - ns.setSize(width, height); + ns.surfaceSizeChanged(width, height); } return ns; } diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11PbufferGLXDrawable.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11PbufferGLXDrawable.java index 885890892..7bfffd091 100644 --- a/src/jogl/classes/jogamp/opengl/x11/glx/X11PbufferGLXDrawable.java +++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11PbufferGLXDrawable.java @@ -132,7 +132,7 @@ public class X11PbufferGLXDrawable extends X11GLXDrawable { int width = tmp[0]; GLX.glXQueryDrawable(display, pbuffer, GLX.GLX_HEIGHT, tmp, 0); int height = tmp[0]; - ((SurfaceChangeable)ns).setSize(width, height); + ((SurfaceChangeable)ns).surfaceSizeChanged(width, height); } public int getFloatingPointMode() { diff --git a/src/nativewindow/classes/javax/media/nativewindow/ProxySurface.java b/src/nativewindow/classes/javax/media/nativewindow/ProxySurface.java index e21c746ad..7380d19b6 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/ProxySurface.java +++ b/src/nativewindow/classes/javax/media/nativewindow/ProxySurface.java @@ -76,7 +76,7 @@ public abstract class ProxySurface implements NativeSurface { return height; } - public void setSize(int width, int height) { + public void surfaceSizeChanged(int width, int height) { this.width = width; this.height = height; } diff --git a/src/nativewindow/classes/javax/media/nativewindow/SurfaceChangeable.java b/src/nativewindow/classes/javax/media/nativewindow/SurfaceChangeable.java index fc32b57b3..956e68e61 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/SurfaceChangeable.java +++ b/src/nativewindow/classes/javax/media/nativewindow/SurfaceChangeable.java @@ -41,8 +41,14 @@ package javax.media.nativewindow; public interface SurfaceChangeable { + /** Sets the surface handle which is created outside of this implementation */ public void setSurfaceHandle(long surfaceHandle); - public void setSize(int width, int height); + + /** + * The surface's size has been determined or changed. + * Implementation shall update the stored surface size with the given ones. + */ + public void surfaceSizeChanged(int width, int height); } diff --git a/src/nativewindow/classes/jogamp/nativewindow/WrappedSurface.java b/src/nativewindow/classes/jogamp/nativewindow/WrappedSurface.java index 0460ccb56..c4c33707d 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/WrappedSurface.java +++ b/src/nativewindow/classes/jogamp/nativewindow/WrappedSurface.java @@ -34,7 +34,7 @@ import javax.media.nativewindow.ProxySurface; import javax.media.nativewindow.SurfaceChangeable; -public class WrappedSurface extends ProxySurface implements SurfaceChangeable { +public class WrappedSurface extends ProxySurface implements SurfaceChangeable { protected long surfaceHandle; public WrappedSurface(AbstractGraphicsConfiguration cfg) { diff --git a/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTWindow.java b/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTWindow.java index 151099f26..c8ce13b40 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTWindow.java +++ b/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTWindow.java @@ -235,10 +235,6 @@ public abstract class JAWTWindow implements NativeWindow { return config.getScreen().getIndex(); } - public final void setSize(int width, int height) { - component.setSize(width, height); - } - public final int getWidth() { return component.getWidth(); } diff --git a/src/nativewindow/classes/jogamp/nativewindow/jawt/macosx/MacOSXJAWTWindow.java b/src/nativewindow/classes/jogamp/nativewindow/jawt/macosx/MacOSXJAWTWindow.java index 5ac42e21b..ec070e404 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/jawt/macosx/MacOSXJAWTWindow.java +++ b/src/nativewindow/classes/jogamp/nativewindow/jawt/macosx/MacOSXJAWTWindow.java @@ -47,7 +47,6 @@ import java.security.PrivilegedAction; import javax.media.nativewindow.AbstractGraphicsConfiguration; import javax.media.nativewindow.Capabilities; import javax.media.nativewindow.NativeSurface; -import javax.media.nativewindow.SurfaceChangeable; import javax.media.nativewindow.NativeWindow; import javax.media.nativewindow.NativeWindowException; import javax.media.nativewindow.util.Point; @@ -61,7 +60,7 @@ import jogamp.nativewindow.jawt.JAWT_DrawingSurfaceInfo; import jogamp.nativewindow.jawt.JAWT_Rectangle; import jogamp.nativewindow.macosx.OSXUtil; -public class MacOSXJAWTWindow extends JAWTWindow implements SurfaceChangeable { +public class MacOSXJAWTWindow extends JAWTWindow { public MacOSXJAWTWindow(Object comp, AbstractGraphicsConfiguration config) { super(comp, config); isOffscreenLayerSurface = JAWTUtil.isCachedJAWTUsingOffscreenLayer(); diff --git a/src/newt/classes/jogamp/newt/OffscreenWindow.java b/src/newt/classes/jogamp/newt/OffscreenWindow.java index d6402c6bb..e923c37a9 100644 --- a/src/newt/classes/jogamp/newt/OffscreenWindow.java +++ b/src/newt/classes/jogamp/newt/OffscreenWindow.java @@ -67,6 +67,10 @@ public class OffscreenWindow extends WindowImpl implements SurfaceChangeable { // nop } + public void surfaceSizeChanged(int width, int height) { + sizeChanged(false, width, height, false); + } + @Override public synchronized void destroy() { super.destroy(); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWT02GLn.java b/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWT02GLn.java index 3e153214b..b2a7e9a5e 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWT02GLn.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWT02GLn.java @@ -156,7 +156,7 @@ public class TestSWT02GLn extends UITestCase { ProxySurface proxySurface = factory.createProxySurface(device, nativeWindowHandle, caps, null); Assert.assertNotNull( proxySurface ); - proxySurface.setSize( 640, 480 ); + proxySurface.surfaceSizeChanged( 640, 480 ); System.err.println("*** ProxySurface: " + proxySurface); final GLDrawable drawable = factory.createGLDrawable(proxySurface); Assert.assertNotNull( drawable ); |