summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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;
+ }
}
//----------------------------------------------------------------------