aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2013-06-24 19:47:06 +0200
committerSven Gothel <[email protected]>2013-06-24 19:47:06 +0200
commit415f5c29ffae7cf5a26737da38e31cb84b652539 (patch)
tree5edca20e94fcb6dc5acefb22dc74b659c8ae3431 /src
parent45952a0fa4c30e9fcd49414581e4c81688c50e48 (diff)
NEWT: Don't invoke external keyboardFocusHandler for auto-repeat keys (NewtCanvasAWT, ..)
.. otherwise an auto repeated key would cause fast focus traversal, not intended.
Diffstat (limited to 'src')
-rw-r--r--src/newt/classes/com/jogamp/newt/Window.java6
-rw-r--r--src/newt/classes/jogamp/newt/WindowImpl.java6
2 files changed, 8 insertions, 4 deletions
diff --git a/src/newt/classes/com/jogamp/newt/Window.java b/src/newt/classes/com/jogamp/newt/Window.java
index 0bebf330a..f63c03738 100644
--- a/src/newt/classes/com/jogamp/newt/Window.java
+++ b/src/newt/classes/com/jogamp/newt/Window.java
@@ -406,7 +406,11 @@ public interface Window extends NativeWindow, WindowClosingProtocol {
* Sets a {@link KeyListener} allowing focus traversal with a covered window toolkit like AWT.
* <p>
* The {@link KeyListener} methods are invoked prior to all other {@link KeyListener}'s
- * allowing to suppress the {@link KeyEvent} via the {@link InputEvent#consumedTag}.
+ * allowing to suppress the {@link KeyEvent} via the {@link InputEvent#consumedTag}
+ * and to perform focus traversal with a 3rd party toolkit.
+ * </p>
+ * <p>
+ * The {@link KeyListener} methods are not invoked for {@link KeyEvent#isAutoRepeat() auto-repeat} events.
* </p>
* @param l
*/
diff --git a/src/newt/classes/jogamp/newt/WindowImpl.java b/src/newt/classes/jogamp/newt/WindowImpl.java
index 1ac97b07c..6787f0ab3 100644
--- a/src/newt/classes/jogamp/newt/WindowImpl.java
+++ b/src/newt/classes/jogamp/newt/WindowImpl.java
@@ -2535,15 +2535,15 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
protected void consumeKeyEvent(KeyEvent e) {
boolean consumedE = false;
- if(null != keyboardFocusHandler) {
+ if( null != keyboardFocusHandler && !e.isAutoRepeat() ) {
consumedE = propagateKeyEvent(e, keyboardFocusHandler);
if(DEBUG_KEY_EVENT) {
- System.err.println("consumeKeyEvent: "+e+", keyboardFocusHandler consumed: "+consumedE);
+ System.err.println("consumeKeyEvent(kfh): "+e+", keyboardFocusHandler consumed: "+consumedE);
}
}
if(DEBUG_KEY_EVENT) {
if( !consumedE ) {
- System.err.println("consumeKeyEvent: "+e);
+ System.err.println("consumeKeyEvent(usr): "+e);
}
}
for(int i = 0; !consumedE && i < keyListeners.size(); i++ ) {