From 90e136b65a10d8daf8c3a2df6cc193e55a63722c Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Tue, 29 Jan 2013 21:27:57 +0100 Subject: Fix Bug 678: Deliver key-char value for printable chars on all KeyEventListener (-> On Windows as well) The following is observed, where t0 and t1 refer to subsequent different timestamps: NEWT delivery order: PRESSED (t0), RELEASED (t1) and TYPED (t1) WINDOWS delivery order: PRESSED (t0), TYPED (t0) and RELEASED (t1) Windows Auto-Repeat: PRESSED (t0), TYPED (t0) Hence we changed the event reorder-code in NEWT to trigger NEWT-PRESSED on Windows-TYPED for printable chars, assuring key-char values on all listener callbacks. - KeyEvent.getKeyChar(): Removed disclaimer dedicated for Windows - Keyevent.isActionKey(): Completed for all NEWT non-printable action keys; Added static variant - Keyevent.isPrintableKey(): NEW: returns !isModifierKey(keyCode) && !isActionKey(keyCode) ; With static variant - Windows WindowDriver: - EVENT_KEY_PRESSED handles non-printable chars only - EVENT_KEY_TYPE handles printable chars only - Native: VK_DELETE passes keyCode - Unit tests: Wait for completion 1s -> 2s --- .../opengl/test/junit/newt/event/TestNewtKeyCodeModifiersAWT.java | 4 ++-- .../com/jogamp/opengl/test/junit/newt/event/TestNewtKeyCodesAWT.java | 2 +- .../opengl/test/junit/newt/event/TestNewtKeyEventAutoRepeatAWT.java | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src/test/com/jogamp') diff --git a/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtKeyCodeModifiersAWT.java b/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtKeyCodeModifiersAWT.java index 478f6eb8b..ec06379e0 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtKeyCodeModifiersAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtKeyCodeModifiersAWT.java @@ -146,7 +146,7 @@ public class TestNewtKeyCodeModifiersAWT extends UITestCase { AWTRobotUtil.keyPress(0, robot, false, KeyEvent.VK_P, 10); // release+typed P AWTRobotUtil.keyPress(0, robot, false, modifierKey, 100); // release+typed MOD robot.waitForIdle(); - for(int j=0; j < 10 && keyAdapter.getQueueSize() < 3+6; j++) { // wait until events are collected + for(int j=0; j < 20 && keyAdapter.getQueueSize() < 3+6; j++) { // wait until events are collected robot.delay(100); } NEWTKeyUtil.validateKeyAdapterStats(keyAdapter, 3+6, 0); @@ -185,7 +185,7 @@ public class TestNewtKeyCodeModifiersAWT extends UITestCase { AWTRobotUtil.keyPress(0, robot, false, m1k, 10); // release+typed MOD robot.waitForIdle(); - for(int j=0; j < 10 && keyAdapter.getQueueSize() < 3*4; j++) { // wait until events are collected + for(int j=0; j < 20 && keyAdapter.getQueueSize() < 3*4; j++) { // wait until events are collected robot.delay(100); } NEWTKeyUtil.validateKeyAdapterStats(keyAdapter, 3*4, 0); diff --git a/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtKeyCodesAWT.java b/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtKeyCodesAWT.java index e43072961..ef4b17375 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtKeyCodesAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtKeyCodesAWT.java @@ -174,7 +174,7 @@ public class TestNewtKeyCodesAWT extends UITestCase { robot.waitForIdle(); } final int codeCount = codeSeg.max - codeSeg.min + 1; - for(int j=0; j < 10 && keyAdapter.getQueueSize() < 3 * codeCount; j++) { // wait until events are collected + for(int j=0; j < 20 && keyAdapter.getQueueSize() < 3 * codeCount; j++) { // wait until events are collected robot.delay(100); } final ArrayList events = new ArrayList(keyAdapter.getQueued()); diff --git a/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtKeyEventAutoRepeatAWT.java b/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtKeyEventAutoRepeatAWT.java index ca612bac6..00fbc0500 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtKeyEventAutoRepeatAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtKeyEventAutoRepeatAWT.java @@ -189,7 +189,7 @@ public class TestNewtKeyEventAutoRepeatAWT extends UITestCase { robot.waitForIdle(); AWTRobotUtil.keyPress(0, robot, false, java.awt.event.KeyEvent.VK_B, 250); robot.waitForIdle(); - for(int j=0; j < 10 && keyAdapter.getQueueSize() < firstIdx+3; j++) { // wait until events are collected + for(int j=0; j < 20 && keyAdapter.getQueueSize() < firstIdx+3; j++) { // wait until events are collected robot.delay(100); } firstIdx = keyEvents.size(); -- cgit v1.2.3