aboutsummaryrefslogtreecommitdiffstats
path: root/src/newt/classes/com/jogamp
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2013-01-30 20:41:11 +0100
committerSven Gothel <[email protected]>2013-01-30 20:41:11 +0100
commitcedbdb09c00bb2a32cc065cb75590f3571bb7aa1 (patch)
tree308a5319f05b58ef08d1db4e14f0181bced62111 /src/newt/classes/com/jogamp
parent4d6983ca087feb0544c27326c8bf470444df2eec (diff)
Fix AWTKeyAdapter: Reorder AWT events to NEWT order - also ensuring TYPED is always sent.
This foremost fixes an issue w/ OSX/Java7 and NewtCanvasAWT offscreen CALayer usage, which utilizes AWTKeyAdapter and AWTNewtEventFactory (AWT -> NEWT) key events.
Diffstat (limited to 'src/newt/classes/com/jogamp')
-rw-r--r--src/newt/classes/com/jogamp/newt/event/awt/AWTKeyAdapter.java26
1 files changed, 16 insertions, 10 deletions
diff --git a/src/newt/classes/com/jogamp/newt/event/awt/AWTKeyAdapter.java b/src/newt/classes/com/jogamp/newt/event/awt/AWTKeyAdapter.java
index 7b0f6ba97..64071eed6 100644
--- a/src/newt/classes/com/jogamp/newt/event/awt/AWTKeyAdapter.java
+++ b/src/newt/classes/com/jogamp/newt/event/awt/AWTKeyAdapter.java
@@ -30,6 +30,11 @@ package com.jogamp.newt.event.awt;
import jogamp.newt.awt.event.AWTNewtEventFactory;
+/**
+ * AWT:
+ * printable: PRESSED (t0), TYPED (t0), RELEASED (t1)
+ * non-printable: PRESSED (t0), RELEASED (t1)
+ */
public class AWTKeyAdapter extends AWTAdapter implements java.awt.event.KeyListener
{
public AWTKeyAdapter(com.jogamp.newt.event.KeyListener newtListener) {
@@ -54,8 +59,9 @@ public class AWTKeyAdapter extends AWTAdapter implements java.awt.event.KeyListe
return this;
}
+ @Override
public void keyPressed(java.awt.event.KeyEvent e) {
- com.jogamp.newt.event.KeyEvent event = AWTNewtEventFactory.createKeyEvent(e, newtWindow);
+ final com.jogamp.newt.event.KeyEvent event = AWTNewtEventFactory.createKeyEvent(com.jogamp.newt.event.KeyEvent.EVENT_KEY_PRESSED, e, newtWindow);
if(null!=newtListener) {
((com.jogamp.newt.event.KeyListener)newtListener).keyPressed(event);
} else {
@@ -63,22 +69,22 @@ public class AWTKeyAdapter extends AWTAdapter implements java.awt.event.KeyListe
}
}
+ @Override
public void keyReleased(java.awt.event.KeyEvent e) {
- com.jogamp.newt.event.KeyEvent event = AWTNewtEventFactory.createKeyEvent(e, newtWindow);
+ com.jogamp.newt.event.KeyEvent keyReleaseEvt = AWTNewtEventFactory.createKeyEvent(com.jogamp.newt.event.KeyEvent.EVENT_KEY_RELEASED, e, newtWindow);
+ com.jogamp.newt.event.KeyEvent keyTypedEvt = AWTNewtEventFactory.createKeyEvent(com.jogamp.newt.event.KeyEvent.EVENT_KEY_TYPED, e, newtWindow);
if(null!=newtListener) {
- ((com.jogamp.newt.event.KeyListener)newtListener).keyReleased(event);
+ final com.jogamp.newt.event.KeyListener newtKeyListener = (com.jogamp.newt.event.KeyListener)newtListener;
+ newtKeyListener.keyReleased(keyReleaseEvt);
+ newtKeyListener.keyTyped(keyTypedEvt);
} else {
- enqueueEvent(false, event);
+ enqueueEvent(false, keyReleaseEvt);
+ enqueueEvent(false, keyTypedEvt);
}
}
+ @Override
public void keyTyped(java.awt.event.KeyEvent e) {
- com.jogamp.newt.event.KeyEvent event = AWTNewtEventFactory.createKeyEvent(e, newtWindow);
- if(null!=newtListener) {
- ((com.jogamp.newt.event.KeyListener)newtListener).keyTyped(event);
- } else {
- enqueueEvent(false, event);
- }
}
}