diff options
author | Sven Gothel <[email protected]> | 2009-10-03 21:56:30 -0700 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2009-10-03 21:56:30 -0700 |
commit | bf584fba26561a1905f37251d681ac100d4a0779 (patch) | |
tree | 59df84cac68eb274318d7280c900f5a2b2df714c /src/newt | |
parent | 4d4b7c52d032d0c9302e4e16560f2e874e31b8bc (diff) |
NativeWindow extends SurfaceUpdatedListener for 'surfaceUpdated' propagation. GLDrawableFactory.createGLDrawable() propagates NativeWindow to offscreen NullWindow.
Diffstat (limited to 'src/newt')
3 files changed, 17 insertions, 54 deletions
diff --git a/src/newt/classes/com/sun/javafx/newt/SurfaceUpdatedListener.java b/src/newt/classes/com/sun/javafx/newt/SurfaceUpdatedListener.java deleted file mode 100644 index a1b0918e6..000000000 --- a/src/newt/classes/com/sun/javafx/newt/SurfaceUpdatedListener.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - */ - -package com.sun.javafx.newt; - -import javax.media.nativewindow.NativeWindow; - -public interface SurfaceUpdatedListener extends EventListener { - /** Notification of a surface update event. - * - * @param updater is the caller object who updated the surface, - * e.g. a JOGL GLDrawable. - * @param window the NativeWindow, which surface is updated - * @param when the time in ms, when the surface was updated - */ - public void surfaceUpdated(Object updater, NativeWindow window, long when) ; -} - 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+"]"; } //---------------------------------------------------------------------- |