diff options
author | Sven Gothel <[email protected]> | 2013-03-21 17:38:26 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2013-03-21 17:38:26 +0100 |
commit | 98f6f99ddc6643cfa540d6c85c64c7f8510cc1ea (patch) | |
tree | a64af443e28b916c56fab435a0b3da967226a727 /src/newt/classes/jogamp | |
parent | 9dcd8bba63cfbcd6e72c855065cf4dafdbcf037e (diff) |
NEWTEvent: Add isConsumed() and setConsumed(boolean) methods to simply usage, using the existing consumedTag attachment for compatibility and efficiency.
Diffstat (limited to 'src/newt/classes/jogamp')
-rw-r--r-- | src/newt/classes/jogamp/newt/WindowImpl.java | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/src/newt/classes/jogamp/newt/WindowImpl.java b/src/newt/classes/jogamp/newt/WindowImpl.java index 45100421a..e8dc0d7d7 100644 --- a/src/newt/classes/jogamp/newt/WindowImpl.java +++ b/src/newt/classes/jogamp/newt/WindowImpl.java @@ -2194,8 +2194,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer if(DEBUG_MOUSE_EVENT) { System.err.println("consumeMouseEvent: event: "+e); } - boolean consumed = false; - for(int i = 0; !consumed && i < mouseListeners.size(); i++ ) { + for(int i = 0; !e.isConsumed() && i < mouseListeners.size(); i++ ) { MouseListener l = mouseListeners.get(i); switch(e.getEventType()) { case MouseEvent.EVENT_MOUSE_CLICKED: @@ -2225,7 +2224,6 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer default: throw new NativeWindowException("Unexpected mouse event type " + e.getEventType()); } - consumed = NEWTEvent.consumedTag == e.getAttachment(); } } @@ -2354,7 +2352,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer default: throw new NativeWindowException("Unexpected key event type " + e.getEventType()); } - return NEWTEvent.consumedTag == e.getAttachment(); + return e.isConsumed(); } @SuppressWarnings("deprecation") @@ -2460,8 +2458,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer if(DEBUG_IMPLEMENTATION) { System.err.println("consumeWindowEvent: "+e+", visible "+isVisible()+" "+getX()+"/"+getY()+" "+getWidth()+"x"+getHeight()); } - boolean consumed = false; - for(int i = 0; !consumed && i < windowListeners.size(); i++ ) { + for(int i = 0; !e.isConsumed() && i < windowListeners.size(); i++ ) { WindowListener l = windowListeners.get(i); switch(e.getEventType()) { case WindowEvent.EVENT_WINDOW_RESIZED: @@ -2490,7 +2487,6 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer new NativeWindowException("Unexpected window event type " + e.getEventType()); } - consumed = NEWTEvent.consumedTag == e.getAttachment(); } } |