summaryrefslogtreecommitdiffstats
path: root/src/newt/classes
diff options
context:
space:
mode:
Diffstat (limited to 'src/newt/classes')
-rw-r--r--src/newt/classes/com/jogamp/newt/Window.java33
-rw-r--r--src/newt/classes/com/jogamp/newt/opengl/GLWindow.java12
-rw-r--r--src/newt/classes/jogamp/newt/WindowImpl.java65
3 files changed, 12 insertions, 98 deletions
diff --git a/src/newt/classes/com/jogamp/newt/Window.java b/src/newt/classes/com/jogamp/newt/Window.java
index a78f81668..ae6bd2b8c 100644
--- a/src/newt/classes/com/jogamp/newt/Window.java
+++ b/src/newt/classes/com/jogamp/newt/Window.java
@@ -35,7 +35,6 @@ import jogamp.newt.Debug;
import javax.media.nativewindow.CapabilitiesChooser;
import javax.media.nativewindow.CapabilitiesImmutable;
import javax.media.nativewindow.NativeWindow;
-import javax.media.nativewindow.SurfaceUpdatedListener;
import javax.media.nativewindow.WindowClosingProtocol;
/**
@@ -328,38 +327,6 @@ public interface Window extends NativeWindow, WindowClosingProtocol {
//
- // SurfaceUpdateListener
- //
-
- /**
- * Appends the given {@link com.jogamp.newt.event.SurfaceUpdatedListener} to the end of
- * the list.
- */
- void addSurfaceUpdatedListener(SurfaceUpdatedListener l);
-
- /**
- *
- * Inserts the given {@link com.jogamp.newt.event.SurfaceUpdatedListener} at the
- * specified position in the list.<br>
- *
- * @param index Position where the listener will be inserted.
- * Should be within (0 <= index && index <= size()).
- * An index value of -1 is interpreted as the end of the list, size().
- * @param l The listener object to be inserted
- * @throws IndexOutOfBoundsException If the index is not within (0 <= index && index <= size()), or -1
- */
- void addSurfaceUpdatedListener(int index, SurfaceUpdatedListener l) throws IndexOutOfBoundsException;
-
- void removeAllSurfaceUpdatedListener();
-
- void removeSurfaceUpdatedListener(SurfaceUpdatedListener l);
-
- SurfaceUpdatedListener getSurfaceUpdatedListener(int index);
-
- SurfaceUpdatedListener[] getSurfaceUpdatedListeners();
-
-
- //
// WindowListener
//
diff --git a/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java b/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java
index 2cd8c2ced..e9ac272c8 100644
--- a/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java
+++ b/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java
@@ -753,18 +753,6 @@ public class GLWindow implements GLAutoDrawable, Window, NEWTEventConsumer, FPSC
window.runOnEDTIfAvail(wait, task);
}
- public final SurfaceUpdatedListener getSurfaceUpdatedListener(int index) {
- return window.getSurfaceUpdatedListener(index);
- }
-
- public final SurfaceUpdatedListener[] getSurfaceUpdatedListeners() {
- return window.getSurfaceUpdatedListeners();
- }
-
- public final void removeAllSurfaceUpdatedListener() {
- window.removeAllSurfaceUpdatedListener();
- }
-
public final void removeSurfaceUpdatedListener(SurfaceUpdatedListener l) {
window.removeSurfaceUpdatedListener(l);
}
diff --git a/src/newt/classes/jogamp/newt/WindowImpl.java b/src/newt/classes/jogamp/newt/WindowImpl.java
index 7df326e8e..aadb89679 100644
--- a/src/newt/classes/jogamp/newt/WindowImpl.java
+++ b/src/newt/classes/jogamp/newt/WindowImpl.java
@@ -72,6 +72,8 @@ import javax.media.nativewindow.util.InsetsImmutable;
import javax.media.nativewindow.util.Point;
import javax.media.nativewindow.util.Rectangle;
+import jogamp.nativewindow.SurfaceUpdatedHelper;
+
public abstract class WindowImpl implements Window, NEWTEventConsumer
{
public static final boolean DEBUG_TEST_REPARENT_INCOMPATIBLE = Debug.isPropertyDefined("newt.test.Window.reparent.incompatible", true);
@@ -109,9 +111,8 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
private RequestFocusAction requestFocusAction = new RequestFocusAction();
private FocusRunnable focusAction = null;
- private Object surfaceUpdatedListenersLock = new Object();
- private ArrayList<SurfaceUpdatedListener> surfaceUpdatedListeners = new ArrayList<SurfaceUpdatedListener>();
-
+ private SurfaceUpdatedHelper surfaceUpdatedHelper = new SurfaceUpdatedHelper();
+
private Object childWindowsLock = new Object();
private ArrayList<NativeWindow> childWindows = new ArrayList<NativeWindow>();
@@ -1487,9 +1488,9 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
"\n, WrappedWindow "+getWrappedWindow()+
"\n, ChildWindows "+childWindows.size());
- sb.append(", SurfaceUpdatedListeners num "+surfaceUpdatedListeners.size()+" [");
- for (int i = 0; i < surfaceUpdatedListeners.size(); i++ ) {
- sb.append(surfaceUpdatedListeners.get(i)+", ");
+ sb.append(", SurfaceUpdatedListeners num "+surfaceUpdatedHelper.size()+" [");
+ for (int i = 0; i < surfaceUpdatedHelper.size(); i++ ) {
+ sb.append(surfaceUpdatedHelper.get(i)+", ");
}
sb.append("], WindowListeners num "+windowListeners.size()+" [");
for (int i = 0; i < windowListeners.size(); i++ ) {
@@ -1824,62 +1825,20 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
//
// SurfaceUpdatedListener Support
//
-
public void addSurfaceUpdatedListener(SurfaceUpdatedListener l) {
- addSurfaceUpdatedListener(-1, l);
+ surfaceUpdatedHelper.addSurfaceUpdatedListener(l);
}
- public void addSurfaceUpdatedListener(int index, SurfaceUpdatedListener l)
- throws IndexOutOfBoundsException
- {
- if(l == null) {
- return;
- }
- synchronized(surfaceUpdatedListenersLock) {
- if(0>index) {
- index = surfaceUpdatedListeners.size();
- }
- surfaceUpdatedListeners.add(index, l);
- }
+ public void addSurfaceUpdatedListener(int index, SurfaceUpdatedListener l) throws IndexOutOfBoundsException {
+ surfaceUpdatedHelper.addSurfaceUpdatedListener(index, l);
}
public void removeSurfaceUpdatedListener(SurfaceUpdatedListener l) {
- if (l == null) {
- return;
- }
- synchronized(surfaceUpdatedListenersLock) {
- surfaceUpdatedListeners.remove(l);
- }
- }
-
- public void removeAllSurfaceUpdatedListener() {
- synchronized(surfaceUpdatedListenersLock) {
- surfaceUpdatedListeners = new ArrayList<SurfaceUpdatedListener>();
- }
- }
-
- public SurfaceUpdatedListener getSurfaceUpdatedListener(int index) {
- synchronized(surfaceUpdatedListenersLock) {
- if(0>index) {
- index = surfaceUpdatedListeners.size()-1;
- }
- return surfaceUpdatedListeners.get(index);
- }
- }
-
- public SurfaceUpdatedListener[] getSurfaceUpdatedListeners() {
- synchronized(surfaceUpdatedListenersLock) {
- return (SurfaceUpdatedListener[]) surfaceUpdatedListeners.toArray();
- }
+ surfaceUpdatedHelper.removeSurfaceUpdatedListener(l);
}
public void surfaceUpdated(Object updater, NativeSurface ns, long when) {
- synchronized(surfaceUpdatedListenersLock) {
- for(int i = 0; i < surfaceUpdatedListeners.size(); i++ ) {
- SurfaceUpdatedListener l = surfaceUpdatedListeners.get(i);
- l.surfaceUpdated(updater, ns, when);
- }
- }
+ surfaceUpdatedHelper.surfaceUpdated(updater, ns, when);
}
//