aboutsummaryrefslogtreecommitdiffstats
path: root/src/newt/classes/com/sun/javafx/newt/Window.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/newt/classes/com/sun/javafx/newt/Window.java')
-rwxr-xr-xsrc/newt/classes/com/sun/javafx/newt/Window.java56
1 files changed, 53 insertions, 3 deletions
diff --git a/src/newt/classes/com/sun/javafx/newt/Window.java b/src/newt/classes/com/sun/javafx/newt/Window.java
index da31b084c..1f55eee26 100755
--- a/src/newt/classes/com/sun/javafx/newt/Window.java
+++ b/src/newt/classes/com/sun/javafx/newt/Window.java
@@ -182,6 +182,10 @@ public abstract class Window implements NativeWindow
", "+screen+
", wrappedWindow "+getWrappedWindow());
+ sb.append(", SurfaceUpdatedListeners num "+surfaceUpdatedListeners.size()+" [");
+ for (Iterator iter = surfaceUpdatedListeners.iterator(); iter.hasNext(); ) {
+ sb.append(iter.next()+", ");
+ }
sb.append(", WindowListeners num "+windowListeners.size()+" [");
for (Iterator iter = windowListeners.iterator(); iter.hasNext(); ) {
sb.append(iter.next()+", ");
@@ -267,6 +271,9 @@ public abstract class Window implements NativeWindow
if(DEBUG_WINDOW_EVENT) {
System.out.println("Window.destroy() start "+Thread.currentThread().getName());
}
+ synchronized(surfaceUpdatedListeners) {
+ surfaceUpdatedListeners = new ArrayList();
+ }
synchronized(windowListeners) {
windowListeners = new ArrayList();
}
@@ -305,8 +312,6 @@ public abstract class Window implements NativeWindow
return false;
}
- public void surfaceUpdated() {}
-
protected void clearEventMask() {
eventMask=0;
}
@@ -451,6 +456,52 @@ public abstract class Window implements NativeWindow
public abstract boolean setFullscreen(boolean fullscreen);
//
+ // SurfaceUpdatedListener Support
+ //
+ private ArrayList surfaceUpdatedListeners = new ArrayList();
+
+ public void addSurfaceUpdatedListener(SurfaceUpdatedListener l) {
+ if(l == null) {
+ return;
+ }
+ synchronized(surfaceUpdatedListeners) {
+ ArrayList newSurfaceUpdatedListeners = (ArrayList) surfaceUpdatedListeners.clone();
+ newSurfaceUpdatedListeners.add(l);
+ surfaceUpdatedListeners = newSurfaceUpdatedListeners;
+ }
+ }
+
+ public void removeSurfaceUpdatedListener(SurfaceUpdatedListener l) {
+ if (l == null) {
+ return;
+ }
+ synchronized(surfaceUpdatedListeners) {
+ ArrayList newSurfaceUpdatedListeners = (ArrayList) surfaceUpdatedListeners.clone();
+ newSurfaceUpdatedListeners.remove(l);
+ surfaceUpdatedListeners = newSurfaceUpdatedListeners;
+ }
+ }
+
+ public SurfaceUpdatedListener[] getSurfaceUpdatedListener() {
+ synchronized(surfaceUpdatedListeners) {
+ return (SurfaceUpdatedListener[]) surfaceUpdatedListeners.toArray();
+ }
+ }
+
+ public void surfaceUpdated(Object updater) {
+ long when = System.currentTimeMillis();
+
+ ArrayList listeners = null;
+ synchronized(surfaceUpdatedListeners) {
+ listeners = surfaceUpdatedListeners;
+ }
+ for(Iterator i = listeners.iterator(); i.hasNext(); ) {
+ SurfaceUpdatedListener l = (SurfaceUpdatedListener) i.next();
+ l.surfaceUpdated(updater, this, when);
+ }
+ }
+
+ //
// MouseListener Support
//
@@ -805,5 +856,4 @@ public abstract class Window implements NativeWindow
}
return sb.toString();
}
-
}