diff options
author | Sven Gothel <[email protected]> | 2012-09-16 21:24:58 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2012-09-16 21:24:58 +0200 |
commit | 8777a6f0b8d5aa7c97643c68c4641593c6fa2c46 (patch) | |
tree | 47790d95b9f70a72669cc41080dbedf037fa2aba /src/newt/classes/jogamp | |
parent | 646714d3dab87396b9a3119bf90ca26e0b1c97ce (diff) |
Complete 646714d3dab87396b9a3119bf90ca26e0b1c97ce / Fix Bug 601: Add missing enqueueKeyEvent(..) in WindowsDriver; Fix API doc typo.
Diffstat (limited to 'src/newt/classes/jogamp')
-rw-r--r-- | src/newt/classes/jogamp/newt/driver/windows/WindowDriver.java | 22 |
1 files changed, 21 insertions, 1 deletions
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; + } } //---------------------------------------------------------------------- |