aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/jogl/classes/com/sun/opengl/impl/GLDrawableFactoryImpl.java32
-rw-r--r--src/jogl/classes/com/sun/opengl/impl/GLDrawableImpl.java2
-rw-r--r--src/nativewindow/classes/com/sun/nativewindow/impl/NullWindow.java15
-rw-r--r--src/nativewindow/classes/com/sun/nativewindow/impl/jawt/JAWTWindow.java2
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/NativeWindow.java11
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/SurfaceUpdatedListener.java (renamed from src/newt/classes/com/sun/javafx/newt/SurfaceUpdatedListener.java)6
-rwxr-xr-xsrc/newt/classes/com/sun/javafx/newt/Window.java8
-rw-r--r--src/newt/classes/com/sun/javafx/newt/opengl/GLWindow.java15
8 files changed, 54 insertions, 37 deletions
diff --git a/src/jogl/classes/com/sun/opengl/impl/GLDrawableFactoryImpl.java b/src/jogl/classes/com/sun/opengl/impl/GLDrawableFactoryImpl.java
index caa250597..66abcf841 100644
--- a/src/jogl/classes/com/sun/opengl/impl/GLDrawableFactoryImpl.java
+++ b/src/jogl/classes/com/sun/opengl/impl/GLDrawableFactoryImpl.java
@@ -44,6 +44,7 @@ import javax.media.nativewindow.*;
import javax.media.opengl.*;
import com.sun.gluegen.runtime.*;
import com.sun.nativewindow.impl.NWReflection;
+import com.sun.nativewindow.impl.NullWindow;
import java.lang.reflect.*;
/** Extends GLDrawableFactory with a few methods for handling
@@ -57,43 +58,48 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory {
//---------------------------------------------------------------------------
// Dispatching GLDrawable construction in respect to the NativeWindow Capabilities
//
- public GLDrawable createGLDrawable(NativeWindow target, GLCapabilitiesChooser chooser) {
- if (target == null) {
+ public GLDrawable createGLDrawable(NativeWindow target0, GLCapabilitiesChooser chooser) {
+ if (target0 == null) {
throw new IllegalArgumentException("Null target");
}
- AbstractGraphicsConfiguration config = target.getGraphicsConfiguration().getNativeGraphicsConfiguration();
- target = NativeWindowFactory.getNativeWindow(target, config);
- GLCapabilities caps = (GLCapabilities) target.getGraphicsConfiguration().getNativeGraphicsConfiguration().getChosenCapabilities();
+ AbstractGraphicsConfiguration config = target0.getGraphicsConfiguration().getNativeGraphicsConfiguration();
+ NativeWindow target1 = NativeWindowFactory.getNativeWindow(target0, config);
+ GLCapabilities caps = (GLCapabilities) target1.getGraphicsConfiguration().getNativeGraphicsConfiguration().getChosenCapabilities();
GLDrawable result = null;
if(caps.isOnscreen()) {
if(caps.isPBuffer()) {
throw new IllegalArgumentException("Onscreen target can't be PBuffer: "+caps);
}
if(DEBUG) {
- System.out.println("GLDrawableFactoryImpl.createGLDrawable -> OnscreenDrawable: "+target);
+ System.out.println("GLDrawableFactoryImpl.createGLDrawable -> OnscreenDrawable: "+target1);
}
- result = createOnscreenDrawable(target);
+ result = createOnscreenDrawable(target1);
} else {
GLCapabilities caps2 = (GLCapabilities) caps.clone();
// OFFSCREEN !DOUBLE_BUFFER
caps2.setDoubleBuffered(false);
if(caps2.isPBuffer() && canCreateGLPbuffer()) {
if(DEBUG) {
- System.out.println("GLDrawableFactoryImpl.createGLDrawable -> PbufferDrawable: "+target);
+ System.out.println("GLDrawableFactoryImpl.createGLDrawable -> PbufferDrawable: "+target1);
}
result = createGLPbufferDrawable(caps2,
chooser,
- target.getWidth(),
- target.getHeight());
+ target1.getWidth(),
+ target1.getHeight());
}
if(null==result) {
if(DEBUG) {
- System.out.println("GLDrawableFactoryImpl.createGLDrawable -> OffScreenDrawable: "+target);
+ System.out.println("GLDrawableFactoryImpl.createGLDrawable -> OffScreenDrawable: "+target1);
}
result = createOffscreenDrawable(caps2,
chooser,
- target.getWidth(),
- target.getHeight());
+ target1.getWidth(),
+ target1.getHeight());
+ }
+ // Set upstream NativeWindow from caller to NullWindow for SurfaceUpdatedListener event
+ NativeWindow nw = result.getNativeWindow();
+ if(nw instanceof NullWindow) {
+ ((NullWindow)nw).setUpstreamNativeWindow(target0);
}
}
if(DEBUG) {
diff --git a/src/jogl/classes/com/sun/opengl/impl/GLDrawableImpl.java b/src/jogl/classes/com/sun/opengl/impl/GLDrawableImpl.java
index dddba9460..020bea9f0 100644
--- a/src/jogl/classes/com/sun/opengl/impl/GLDrawableImpl.java
+++ b/src/jogl/classes/com/sun/opengl/impl/GLDrawableImpl.java
@@ -82,7 +82,7 @@ public abstract class GLDrawableImpl implements GLDrawable {
ctx.getGL().glFinish();
}
}
- component.surfaceUpdated(this);
+ component.surfaceUpdated(this, component, System.currentTimeMillis());
}
protected abstract void swapBuffersImpl();
diff --git a/src/nativewindow/classes/com/sun/nativewindow/impl/NullWindow.java b/src/nativewindow/classes/com/sun/nativewindow/impl/NullWindow.java
index c5a617990..6f568df13 100644
--- a/src/nativewindow/classes/com/sun/nativewindow/impl/NullWindow.java
+++ b/src/nativewindow/classes/com/sun/nativewindow/impl/NullWindow.java
@@ -96,7 +96,17 @@ public class NullWindow implements NativeWindow {
return false;
}
- public void surfaceUpdated(Object updater) { }
+ NativeWindow upstreamNW = null;
+
+ public void setUpstreamNativeWindow(NativeWindow upstream) {
+ upstreamNW = upstream;
+ }
+
+ public void surfaceUpdated(Object updater, NativeWindow window, long when) {
+ if(null!=upstreamNW) {
+ upstreamNW.surfaceUpdated(updater, upstreamNW, when);
+ }
+ }
public long getDisplayHandle() {
return displayHandle;
@@ -142,7 +152,8 @@ public class NullWindow implements NativeWindow {
return "NullWindow[config "+config+
", displayHandle 0x"+Long.toHexString(getDisplayHandle())+
", surfaceHandle 0x"+Long.toHexString(getSurfaceHandle())+
- ", size "+getWidth()+"x"+getHeight()+"]";
+ ", size "+getWidth()+"x"+getHeight()+
+ ", upstream "+upstreamNW+"]";
}
}
diff --git a/src/nativewindow/classes/com/sun/nativewindow/impl/jawt/JAWTWindow.java b/src/nativewindow/classes/com/sun/nativewindow/impl/jawt/JAWTWindow.java
index b4975706d..e821f9b3a 100644
--- a/src/nativewindow/classes/com/sun/nativewindow/impl/jawt/JAWTWindow.java
+++ b/src/nativewindow/classes/com/sun/nativewindow/impl/jawt/JAWTWindow.java
@@ -129,7 +129,7 @@ public abstract class JAWTWindow implements NativeWindow {
return false;
}
- public void surfaceUpdated(Object updater) { }
+ public void surfaceUpdated(Object updater, NativeWindow window, long when) { }
public long getDisplayHandle() {
return config.getScreen().getDevice().getHandle();
diff --git a/src/nativewindow/classes/javax/media/nativewindow/NativeWindow.java b/src/nativewindow/classes/javax/media/nativewindow/NativeWindow.java
index 1b000072e..37606e8d8 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/NativeWindow.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/NativeWindow.java
@@ -52,7 +52,7 @@ package javax.media.nativewindow;
it, and any time it is visible and locked, provide information
such as the window handle.
*/
-public interface NativeWindow {
+public interface NativeWindow extends SurfaceUpdatedListener {
/** Returned by {@link #lockSurface()} if the surface is not ready to be locked. */
public static final int LOCK_SURFACE_NOT_READY = 1;
@@ -123,15 +123,6 @@ public interface NativeWindow {
*/
public boolean surfaceSwap();
- /**
- * Method invoked after the render toolkit (e.g. JOGL)
- * swapped/changed the buffer/surface.
- *
- * @param updater is the caller object who updated the surface,
- * e.g. a JOGL GLDrawable.
- */
- public void surfaceUpdated(Object updater);
-
/**
* render all native window information invalid,
* as if the native window was destroyed
diff --git a/src/newt/classes/com/sun/javafx/newt/SurfaceUpdatedListener.java b/src/nativewindow/classes/javax/media/nativewindow/SurfaceUpdatedListener.java
index a1b0918e6..7be15408c 100644
--- a/src/newt/classes/com/sun/javafx/newt/SurfaceUpdatedListener.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/SurfaceUpdatedListener.java
@@ -31,11 +31,9 @@
*
*/
-package com.sun.javafx.newt;
+package javax.media.nativewindow;
-import javax.media.nativewindow.NativeWindow;
-
-public interface SurfaceUpdatedListener extends EventListener {
+public interface SurfaceUpdatedListener {
/** Notification of a surface update event.
*
* @param updater is the caller object who updated the surface,
diff --git a/src/newt/classes/com/sun/javafx/newt/Window.java b/src/newt/classes/com/sun/javafx/newt/Window.java
index 1f55eee26..3b0c3b970 100755
--- a/src/newt/classes/com/sun/javafx/newt/Window.java
+++ b/src/newt/classes/com/sun/javafx/newt/Window.java
@@ -186,7 +186,7 @@ public abstract class Window implements NativeWindow
for (Iterator iter = surfaceUpdatedListeners.iterator(); iter.hasNext(); ) {
sb.append(iter.next()+", ");
}
- sb.append(", WindowListeners num "+windowListeners.size()+" [");
+ sb.append("], WindowListeners num "+windowListeners.size()+" [");
for (Iterator iter = windowListeners.iterator(); iter.hasNext(); ) {
sb.append(iter.next()+", ");
}
@@ -488,16 +488,14 @@ public abstract class Window implements NativeWindow
}
}
- public void surfaceUpdated(Object updater) {
- long when = System.currentTimeMillis();
-
+ public void surfaceUpdated(Object updater, NativeWindow window, long when) {
ArrayList listeners = null;
synchronized(surfaceUpdatedListeners) {
listeners = surfaceUpdatedListeners;
}
for(Iterator i = listeners.iterator(); i.hasNext(); ) {
SurfaceUpdatedListener l = (SurfaceUpdatedListener) i.next();
- l.surfaceUpdated(updater, this, when);
+ l.surfaceUpdated(updater, window, when);
}
}
diff --git a/src/newt/classes/com/sun/javafx/newt/opengl/GLWindow.java b/src/newt/classes/com/sun/javafx/newt/opengl/GLWindow.java
index 6e9d4aaf6..52f368148 100644
--- a/src/newt/classes/com/sun/javafx/newt/opengl/GLWindow.java
+++ b/src/newt/classes/com/sun/javafx/newt/opengl/GLWindow.java
@@ -366,6 +366,19 @@ public class GLWindow extends Window implements GLAutoDrawable {
return window.isFullscreen();
}
+ public void addSurfaceUpdatedListener(SurfaceUpdatedListener l) {
+ window.addSurfaceUpdatedListener(l);
+ }
+ public void removeSurfaceUpdatedListener(SurfaceUpdatedListener l) {
+ window.removeSurfaceUpdatedListener(l);
+ }
+ public SurfaceUpdatedListener[] getSurfaceUpdatedListener() {
+ return window.getSurfaceUpdatedListener();
+ }
+ public void surfaceUpdated(Object updater, NativeWindow window0, long when) {
+ window.surfaceUpdated(updater, window, when);
+ }
+
public void addMouseListener(MouseListener l) {
window.addMouseListener(l);
}
@@ -403,7 +416,7 @@ public class GLWindow extends Window implements GLAutoDrawable {
}
public String toString() {
- return "NEWT-GLWindow[ "+drawable+", \n\t"+window+", \n\t"+helper+", \n\t"+factory+"]";
+ return "NEWT-GLWindow[ \n\tDrawable: "+drawable+", \n\tWindow: "+window+", \n\tHelper: "+helper+", \n\tFactory: "+factory+"]";
}
//----------------------------------------------------------------------