summaryrefslogtreecommitdiffstats
path: root/src/newt/classes/jogamp
diff options
context:
space:
mode:
Diffstat (limited to 'src/newt/classes/jogamp')
-rw-r--r--src/newt/classes/jogamp/newt/driver/windows/WindowDriver.java22
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;
+ }
}
//----------------------------------------------------------------------