aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2012-09-16 21:24:58 +0200
committerSven Gothel <[email protected]>2012-09-16 21:24:58 +0200
commit8777a6f0b8d5aa7c97643c68c4641593c6fa2c46 (patch)
tree47790d95b9f70a72669cc41080dbedf037fa2aba /src
parent646714d3dab87396b9a3119bf90ca26e0b1c97ce (diff)
Complete 646714d3dab87396b9a3119bf90ca26e0b1c97ce / Fix Bug 601: Add missing enqueueKeyEvent(..) in WindowsDriver; Fix API doc typo.
Diffstat (limited to 'src')
-rw-r--r--src/newt/classes/com/jogamp/newt/event/KeyEvent.java2
-rw-r--r--src/newt/classes/jogamp/newt/driver/windows/WindowDriver.java22
2 files changed, 22 insertions, 2 deletions
diff --git a/src/newt/classes/com/jogamp/newt/event/KeyEvent.java b/src/newt/classes/com/jogamp/newt/event/KeyEvent.java
index bd48981da..7daaeada6 100644
--- a/src/newt/classes/com/jogamp/newt/event/KeyEvent.java
+++ b/src/newt/classes/com/jogamp/newt/event/KeyEvent.java
@@ -45,7 +45,7 @@ package com.jogamp.newt.event;
* deliver keyboard events in the above order or skip events,
* the NEWT driver will reorder and inject synthetic events if required.
* <p>
- * Besides regular modifiers like {@link InputEvent##SHIFT_MASK} etc.,
+ * Besides regular modifiers like {@link InputEvent#SHIFT_MASK} etc.,
* the {@link InputEvent#AUTOREPEAT_MASK} bit is added if repetition is detected.
* </p>
*/
diff --git a/src/newt/classes/jogamp/newt/driver/windows/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/windows/WindowDriver.java
index 18cc88472..71437c461 100644
--- a/src/newt/classes/jogamp/newt/driver/windows/WindowDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/windows/WindowDriver.java
@@ -313,7 +313,27 @@ public class WindowDriver extends WindowImpl {
public void enqueueKeyEvent(boolean wait, int eventType, int modifiers, int keyCode, char keyChar) {
// Note that we have to regenerate the keyCode for EVENT_KEY_TYPED on this platform
keyCode = validateKeyCode(eventType, modifiers, keyCode, keyChar);
- super.enqueueKeyEvent(wait, eventType, modifiers, keyCode, keyChar);
+ switch(eventType) {
+ case KeyEvent.EVENT_KEY_RELEASED:
+ // reorder: WINDOWS delivery order is PRESSED, TYPED and RELEASED -> NEWT order: PRESSED, RELEASED and TYPED
+ break;
+ case KeyEvent.EVENT_KEY_PRESSED:
+ if(pressedKeyBalance > 1) {
+ // Auto-Repeat: WINDOWS delivers only PRESSED and TYPED.
+ // Since reordering already injects RELEASE, we only need to set the AUTOREPEAT_MASK.
+ pressedKeyBalance--;
+ autoRepeat |= InputEvent.AUTOREPEAT_MASK;
+ } else {
+ autoRepeat &= ~InputEvent.AUTOREPEAT_MASK;
+ }
+ super.enqueueKeyEvent(wait, eventType, modifiers | autoRepeat, keyCode, (char)-1);
+ break;
+ case KeyEvent.EVENT_KEY_TYPED:
+ modifiers |= autoRepeat;
+ super.enqueueKeyEvent(wait, KeyEvent.EVENT_KEY_RELEASED, modifiers, keyCode, (char)-1);
+ super.enqueueKeyEvent(wait, eventType, modifiers, keyCode, keyChar);
+ break;
+ }
}
//----------------------------------------------------------------------