diff options
author | Sven Gothel <[email protected]> | 2010-06-11 00:14:35 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2010-06-11 00:14:35 +0200 |
commit | c0ece5ebd634662f99f3217bb749e2c4795f9de6 (patch) | |
tree | ecf5a08e0b62cff0b00137ab2298e70afa846a68 /src | |
parent | 856a6e9ff524692bb4e2ac7b2f754bc7fee5f849 (diff) |
NEWT Add: add<type>Listener(int index, <type>Listener l) ; get<type>Listener(int index) ; NEWTEvent attachments
NEWT Add:
add<type>Listener(int index, <type>Listener l) ;
get<type>Listener(int index) ;
NEWTEvent attachments for listener to listener communication
via object passing. This methodology is similar to the 'Atom'
attachment of native systems.
It is preferred to a 'consume()/isConsumed()' pattern,
since it is less flexible and would 'endanger' system events.
TODO: <type>Listener[] get<type>Listeners() doesn't work and was always buggy.
Diffstat (limited to 'src')
-rw-r--r-- | src/jogl/classes/com/jogamp/opengl/impl/GLDrawableHelper.java | 9 | ||||
-rwxr-xr-x | src/newt/classes/com/jogamp/newt/Window.java | 2 |
2 files changed, 9 insertions, 2 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/GLDrawableHelper.java b/src/jogl/classes/com/jogamp/opengl/impl/GLDrawableHelper.java index 8cc12ca89..fcd662048 100644 --- a/src/jogl/classes/com/jogamp/opengl/impl/GLDrawableHelper.java +++ b/src/jogl/classes/com/jogamp/opengl/impl/GLDrawableHelper.java @@ -66,8 +66,15 @@ public class GLDrawableHelper { } public synchronized void addGLEventListener(GLEventListener listener) { + addGLEventListener(-1, listener); + } + + public synchronized void addGLEventListener(int index, GLEventListener listener) { + if(0>index) { + index = listeners.size(); + } List newListeners = (List) ((ArrayList) listeners).clone(); - newListeners.add(listener); + newListeners.add(index, listener); listeners = newListeners; } diff --git a/src/newt/classes/com/jogamp/newt/Window.java b/src/newt/classes/com/jogamp/newt/Window.java index 9e338c94b..045a5eb72 100755 --- a/src/newt/classes/com/jogamp/newt/Window.java +++ b/src/newt/classes/com/jogamp/newt/Window.java @@ -1164,7 +1164,7 @@ public abstract class Window implements NativeWindow } } - public MouseListener getWindowListener(int index) { + public MouseListener getMouseListener(int index) { synchronized(mouseListeners) { if(0>index) { index = mouseListeners.size()-1; |