aboutsummaryrefslogtreecommitdiffstats
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/WindowImpl.java44
-rw-r--r--src/newt/classes/jogamp/newt/awt/event/AWTNewtEventFactory.java377
-rw-r--r--src/newt/classes/jogamp/newt/driver/android/event/AndroidNewtEventFactory.java2
-rw-r--r--src/newt/classes/jogamp/newt/driver/awt/DisplayDriver.java1
-rw-r--r--src/newt/classes/jogamp/newt/driver/linux/LinuxEventDeviceTracker.java6
-rw-r--r--src/newt/classes/jogamp/newt/driver/macosx/WindowDriver.java11
-rw-r--r--src/newt/classes/jogamp/newt/driver/windows/WindowDriver.java15
-rw-r--r--src/newt/classes/jogamp/newt/swt/event/SWTNewtEventFactory.java140
8 files changed, 549 insertions, 47 deletions
diff --git a/src/newt/classes/jogamp/newt/WindowImpl.java b/src/newt/classes/jogamp/newt/WindowImpl.java
index e5dd783ca..01a58a305 100644
--- a/src/newt/classes/jogamp/newt/WindowImpl.java
+++ b/src/newt/classes/jogamp/newt/WindowImpl.java
@@ -2251,41 +2251,45 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
//
// KeyListener/Event Support
//
- protected IntBitfield keyPressedState = new IntBitfield(KeyEvent.VK_CONTEXT_MENU+1);
- protected IntBitfield keyRepeatState = new IntBitfield(KeyEvent.VK_CONTEXT_MENU+1);
+ private static final int keyTrackingRange = 255;
+ private final IntBitfield keyPressedState = new IntBitfield( keyTrackingRange + 1 );
+
+ protected final boolean isKeyCodeTracked(final short keyCode) {
+ return ( 0xFFFF & (int)keyCode ) <= keyTrackingRange;
+ }
/**
- * @param keyCode
- * @return 1 if pressed, 0 if not pressed, -1 if not handled.
+ * @param keyCode the keyCode to set pressed state
+ * @param pressed true if pressed, otherwise false
+ * @return the previus pressed value
*/
- protected final int isKeyPressed(int keyCode) {
- if( 0 <= keyCode && keyCode < keyPressedState.capacity() ) {
- return keyPressedState.get(keyCode) ? 1 : 0;
+ protected final boolean setKeyPressed(short keyCode, boolean pressed) {
+ final int v = 0xFFFF & (int)keyCode;
+ if( v <= keyTrackingRange ) {
+ return keyPressedState.put(v, pressed);
}
- return -1;
+ return false;
}
/**
- * @param keyCode
- * @return 1 if pressed, 0 if not pressed, -1 if not handled.
+ * @param keyCode the keyCode to test pressed state
+ * @return true if pressed, otherwise false
*/
- protected final int isKeyInAutoRepeat(int keyCode) {
- if( 0 <= keyCode && keyCode < keyRepeatState.capacity() ) {
- return keyRepeatState.get(keyCode) ? 1 : 0;
+ protected final boolean isKeyPressed(short keyCode) {
+ final int v = 0xFFFF & (int)keyCode;
+ if( v <= keyTrackingRange ) {
+ return keyPressedState.get(v);
}
- return -1;
- }
- protected final boolean isKeyCodeTracked(int keyCode) {
- return 0 <= keyCode && keyCode < keyRepeatState.capacity();
+ return false;
}
public void sendKeyEvent(short eventType, int modifiers, short keyCode, short keySym, char keyChar) {
// Always add currently pressed mouse buttons to modifier mask
- consumeKeyEvent(new KeyEvent(eventType, this, System.currentTimeMillis(), modifiers | mouseButtonModMask, keyCode, keySym, keyChar) );
+ consumeKeyEvent( KeyEvent.create(eventType, this, System.currentTimeMillis(), modifiers | mouseButtonModMask, keyCode, keySym, keyChar) );
}
public void enqueueKeyEvent(boolean wait, short eventType, int modifiers, short keyCode, short keySym, char keyChar) {
// Always add currently pressed mouse buttons to modifier mask
- enqueueEvent(wait, new KeyEvent(eventType, this, System.currentTimeMillis(), modifiers | mouseButtonModMask, keyCode, keySym, keyChar) );
+ enqueueEvent(wait, KeyEvent.create(eventType, this, System.currentTimeMillis(), modifiers | mouseButtonModMask, keyCode, keySym, keyChar) );
}
@Override
@@ -2400,7 +2404,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
// Synthesize deprecated event KeyEvent.EVENT_KEY_TYPED
final KeyEvent eTyped;
if( KeyEvent.EVENT_KEY_RELEASED == e.getEventType() && e.isPrintableKey() && !e.isAutoRepeat() ) {
- eTyped = new KeyEvent(KeyEvent.EVENT_KEY_TYPED, e.getSource(), e.getWhen(), e.getModifiers(), e.getKeyCode(), e.getKeySymbol(), e.getKeyChar());
+ eTyped = KeyEvent.create(KeyEvent.EVENT_KEY_TYPED, e.getSource(), e.getWhen(), e.getModifiers(), e.getKeyCode(), e.getKeySymbol(), e.getKeyChar());
} else {
eTyped = null;
}
diff --git a/src/newt/classes/jogamp/newt/awt/event/AWTNewtEventFactory.java b/src/newt/classes/jogamp/newt/awt/event/AWTNewtEventFactory.java
index b90c2106e..ccbdc07bf 100644
--- a/src/newt/classes/jogamp/newt/awt/event/AWTNewtEventFactory.java
+++ b/src/newt/classes/jogamp/newt/awt/event/AWTNewtEventFactory.java
@@ -176,6 +176,14 @@ public class AWTNewtEventFactory {
}
}
+ public static final short awtButton2Newt(int awtButton) {
+ if( 0 < awtButton && awtButton <= com.jogamp.newt.event.MouseEvent.BUTTON_NUMBER ) {
+ return (short)awtButton;
+ } else {
+ return (short)0;
+ }
+ }
+
/**
* Converts the specified set of AWT event modifiers and extended event
* modifiers to the equivalent NEWT event modifiers.
@@ -223,12 +231,365 @@ public class AWTNewtEventFactory {
return newtMods;
}
- public static final short awtButton2Newt(int awtButton) {
- if( 0 < awtButton && awtButton <= com.jogamp.newt.event.MouseEvent.BUTTON_NUMBER ) {
- return (short)awtButton;
- } else {
- return (short)0;
+ public static short awtKeyCode2NewtKeyCode(final int awtKeyCode) {
+ final short defNEWTKeyCode = (short)awtKeyCode;
+ switch (awtKeyCode) {
+ case java.awt.event.KeyEvent.VK_HOME : return com.jogamp.newt.event.KeyEvent.VK_HOME;
+ case java.awt.event.KeyEvent.VK_END : return com.jogamp.newt.event.KeyEvent.VK_END;
+ case java.awt.event.KeyEvent.VK_FINAL : return com.jogamp.newt.event.KeyEvent.VK_FINAL;
+ case java.awt.event.KeyEvent.VK_PRINTSCREEN : return com.jogamp.newt.event.KeyEvent.VK_PRINTSCREEN;
+ case java.awt.event.KeyEvent.VK_BACK_SPACE : return com.jogamp.newt.event.KeyEvent.VK_BACK_SPACE;
+ case java.awt.event.KeyEvent.VK_TAB : return com.jogamp.newt.event.KeyEvent.VK_TAB;
+ case java.awt.event.KeyEvent.VK_ENTER : return com.jogamp.newt.event.KeyEvent.VK_ENTER;
+ case java.awt.event.KeyEvent.VK_PAGE_DOWN : return com.jogamp.newt.event.KeyEvent.VK_PAGE_DOWN;
+ case java.awt.event.KeyEvent.VK_CLEAR : return com.jogamp.newt.event.KeyEvent.VK_CLEAR;
+ case java.awt.event.KeyEvent.VK_SHIFT : return com.jogamp.newt.event.KeyEvent.VK_SHIFT;
+ case java.awt.event.KeyEvent.VK_PAGE_UP : return com.jogamp.newt.event.KeyEvent.VK_PAGE_UP;
+ case java.awt.event.KeyEvent.VK_CONTROL : return com.jogamp.newt.event.KeyEvent.VK_CONTROL;
+ case java.awt.event.KeyEvent.VK_ALT : return com.jogamp.newt.event.KeyEvent.VK_ALT;
+ case java.awt.event.KeyEvent.VK_ALT_GRAPH : return com.jogamp.newt.event.KeyEvent.VK_ALT_GRAPH;
+ case java.awt.event.KeyEvent.VK_CAPS_LOCK : return com.jogamp.newt.event.KeyEvent.VK_CAPS_LOCK;
+ case java.awt.event.KeyEvent.VK_PAUSE : return com.jogamp.newt.event.KeyEvent.VK_PAUSE;
+ case java.awt.event.KeyEvent.VK_SCROLL_LOCK : return com.jogamp.newt.event.KeyEvent.VK_SCROLL_LOCK;
+ case java.awt.event.KeyEvent.VK_CANCEL : return com.jogamp.newt.event.KeyEvent.VK_CANCEL;
+ case java.awt.event.KeyEvent.VK_INSERT : return com.jogamp.newt.event.KeyEvent.VK_INSERT;
+ case java.awt.event.KeyEvent.VK_ESCAPE : return com.jogamp.newt.event.KeyEvent.VK_ESCAPE;
+ case java.awt.event.KeyEvent.VK_CONVERT : return com.jogamp.newt.event.KeyEvent.VK_CONVERT;
+ case java.awt.event.KeyEvent.VK_NONCONVERT : return com.jogamp.newt.event.KeyEvent.VK_NONCONVERT;
+ case java.awt.event.KeyEvent.VK_ACCEPT : return com.jogamp.newt.event.KeyEvent.VK_ACCEPT;
+ case java.awt.event.KeyEvent.VK_MODECHANGE : return com.jogamp.newt.event.KeyEvent.VK_MODECHANGE;
+ case java.awt.event.KeyEvent.VK_SPACE : return com.jogamp.newt.event.KeyEvent.VK_SPACE;
+ case java.awt.event.KeyEvent.VK_EXCLAMATION_MARK: return com.jogamp.newt.event.KeyEvent.VK_EXCLAMATION_MARK;
+ case java.awt.event.KeyEvent.VK_QUOTEDBL : return com.jogamp.newt.event.KeyEvent.VK_QUOTEDBL;
+ case java.awt.event.KeyEvent.VK_NUMBER_SIGN : return com.jogamp.newt.event.KeyEvent.VK_NUMBER_SIGN;
+ case java.awt.event.KeyEvent.VK_DOLLAR : return com.jogamp.newt.event.KeyEvent.VK_DOLLAR;
+ // case 0x25 : return com.jogamp.newt.event.KeyEvent.VK_PERCENT;
+ case java.awt.event.KeyEvent.VK_AMPERSAND : return com.jogamp.newt.event.KeyEvent.VK_AMPERSAND;
+ case java.awt.event.KeyEvent.VK_QUOTE : return com.jogamp.newt.event.KeyEvent.VK_QUOTE;
+ case java.awt.event.KeyEvent.VK_LEFT_PARENTHESIS : return com.jogamp.newt.event.KeyEvent.VK_LEFT_PARENTHESIS;
+ case java.awt.event.KeyEvent.VK_RIGHT_PARENTHESIS: return com.jogamp.newt.event.KeyEvent.VK_RIGHT_PARENTHESIS;
+ case java.awt.event.KeyEvent.VK_ASTERISK : return com.jogamp.newt.event.KeyEvent.VK_ASTERISK;
+ case java.awt.event.KeyEvent.VK_PLUS : return com.jogamp.newt.event.KeyEvent.VK_PLUS;
+ case java.awt.event.KeyEvent.VK_COMMA : return com.jogamp.newt.event.KeyEvent.VK_COMMA;
+ case java.awt.event.KeyEvent.VK_MINUS : return com.jogamp.newt.event.KeyEvent.VK_MINUS;
+ case java.awt.event.KeyEvent.VK_PERIOD : return com.jogamp.newt.event.KeyEvent.VK_PERIOD;
+ case java.awt.event.KeyEvent.VK_SLASH : return com.jogamp.newt.event.KeyEvent.VK_SLASH;
+ case java.awt.event.KeyEvent.VK_0 : return com.jogamp.newt.event.KeyEvent.VK_0;
+ case java.awt.event.KeyEvent.VK_1 : return com.jogamp.newt.event.KeyEvent.VK_1;
+ case java.awt.event.KeyEvent.VK_2 : return com.jogamp.newt.event.KeyEvent.VK_2;
+ case java.awt.event.KeyEvent.VK_3 : return com.jogamp.newt.event.KeyEvent.VK_3;
+ case java.awt.event.KeyEvent.VK_4 : return com.jogamp.newt.event.KeyEvent.VK_4;
+ case java.awt.event.KeyEvent.VK_5 : return com.jogamp.newt.event.KeyEvent.VK_5;
+ case java.awt.event.KeyEvent.VK_6 : return com.jogamp.newt.event.KeyEvent.VK_6;
+ case java.awt.event.KeyEvent.VK_7 : return com.jogamp.newt.event.KeyEvent.VK_7;
+ case java.awt.event.KeyEvent.VK_8 : return com.jogamp.newt.event.KeyEvent.VK_8;
+ case java.awt.event.KeyEvent.VK_9 : return com.jogamp.newt.event.KeyEvent.VK_9;
+ case java.awt.event.KeyEvent.VK_COLON : return com.jogamp.newt.event.KeyEvent.VK_COLON;
+ case java.awt.event.KeyEvent.VK_SEMICOLON : return com.jogamp.newt.event.KeyEvent.VK_SEMICOLON;
+ case java.awt.event.KeyEvent.VK_LESS : return com.jogamp.newt.event.KeyEvent.VK_LESS;
+ case java.awt.event.KeyEvent.VK_EQUALS : return com.jogamp.newt.event.KeyEvent.VK_EQUALS;
+ case java.awt.event.KeyEvent.VK_GREATER : return com.jogamp.newt.event.KeyEvent.VK_GREATER;
+ case 0x3f : return com.jogamp.newt.event.KeyEvent.VK_QUESTIONMARK;
+ case java.awt.event.KeyEvent.VK_AT : return com.jogamp.newt.event.KeyEvent.VK_AT;
+ case java.awt.event.KeyEvent.VK_A : return com.jogamp.newt.event.KeyEvent.VK_A;
+ case java.awt.event.KeyEvent.VK_B : return com.jogamp.newt.event.KeyEvent.VK_B;
+ case java.awt.event.KeyEvent.VK_C : return com.jogamp.newt.event.KeyEvent.VK_C;
+ case java.awt.event.KeyEvent.VK_D : return com.jogamp.newt.event.KeyEvent.VK_D;
+ case java.awt.event.KeyEvent.VK_E : return com.jogamp.newt.event.KeyEvent.VK_E;
+ case java.awt.event.KeyEvent.VK_F : return com.jogamp.newt.event.KeyEvent.VK_F;
+ case java.awt.event.KeyEvent.VK_G : return com.jogamp.newt.event.KeyEvent.VK_G;
+ case java.awt.event.KeyEvent.VK_H : return com.jogamp.newt.event.KeyEvent.VK_H;
+ case java.awt.event.KeyEvent.VK_I : return com.jogamp.newt.event.KeyEvent.VK_I;
+ case java.awt.event.KeyEvent.VK_J : return com.jogamp.newt.event.KeyEvent.VK_J;
+ case java.awt.event.KeyEvent.VK_K : return com.jogamp.newt.event.KeyEvent.VK_K;
+ case java.awt.event.KeyEvent.VK_L : return com.jogamp.newt.event.KeyEvent.VK_L;
+ case java.awt.event.KeyEvent.VK_M : return com.jogamp.newt.event.KeyEvent.VK_M;
+ case java.awt.event.KeyEvent.VK_N : return com.jogamp.newt.event.KeyEvent.VK_N;
+ case java.awt.event.KeyEvent.VK_O : return com.jogamp.newt.event.KeyEvent.VK_O;
+ case java.awt.event.KeyEvent.VK_P : return com.jogamp.newt.event.KeyEvent.VK_P;
+ case java.awt.event.KeyEvent.VK_Q : return com.jogamp.newt.event.KeyEvent.VK_Q;
+ case java.awt.event.KeyEvent.VK_R : return com.jogamp.newt.event.KeyEvent.VK_R;
+ case java.awt.event.KeyEvent.VK_S : return com.jogamp.newt.event.KeyEvent.VK_S;
+ case java.awt.event.KeyEvent.VK_T : return com.jogamp.newt.event.KeyEvent.VK_T;
+ case java.awt.event.KeyEvent.VK_U : return com.jogamp.newt.event.KeyEvent.VK_U;
+ case java.awt.event.KeyEvent.VK_V : return com.jogamp.newt.event.KeyEvent.VK_V;
+ case java.awt.event.KeyEvent.VK_W : return com.jogamp.newt.event.KeyEvent.VK_W;
+ case java.awt.event.KeyEvent.VK_X : return com.jogamp.newt.event.KeyEvent.VK_X;
+ case java.awt.event.KeyEvent.VK_Y : return com.jogamp.newt.event.KeyEvent.VK_Y;
+ case java.awt.event.KeyEvent.VK_Z : return com.jogamp.newt.event.KeyEvent.VK_Z;
+ case java.awt.event.KeyEvent.VK_OPEN_BRACKET : return com.jogamp.newt.event.KeyEvent.VK_OPEN_BRACKET;
+ case java.awt.event.KeyEvent.VK_BACK_SLASH : return com.jogamp.newt.event.KeyEvent.VK_BACK_SLASH;
+ case java.awt.event.KeyEvent.VK_CLOSE_BRACKET : return com.jogamp.newt.event.KeyEvent.VK_CLOSE_BRACKET;
+ case java.awt.event.KeyEvent.VK_CIRCUMFLEX : return com.jogamp.newt.event.KeyEvent.VK_CIRCUMFLEX;
+ case java.awt.event.KeyEvent.VK_UNDERSCORE : return com.jogamp.newt.event.KeyEvent.VK_UNDERSCORE;
+ case java.awt.event.KeyEvent.VK_BACK_QUOTE : return com.jogamp.newt.event.KeyEvent.VK_BACK_QUOTE;
+ case java.awt.event.KeyEvent.VK_F1 : return com.jogamp.newt.event.KeyEvent.VK_F1;
+ case java.awt.event.KeyEvent.VK_F2 : return com.jogamp.newt.event.KeyEvent.VK_F2;
+ case java.awt.event.KeyEvent.VK_F3 : return com.jogamp.newt.event.KeyEvent.VK_F3;
+ case java.awt.event.KeyEvent.VK_F4 : return com.jogamp.newt.event.KeyEvent.VK_F4;
+ case java.awt.event.KeyEvent.VK_F5 : return com.jogamp.newt.event.KeyEvent.VK_F5;
+ case java.awt.event.KeyEvent.VK_F6 : return com.jogamp.newt.event.KeyEvent.VK_F6;
+ case java.awt.event.KeyEvent.VK_F7 : return com.jogamp.newt.event.KeyEvent.VK_F7;
+ case java.awt.event.KeyEvent.VK_F8 : return com.jogamp.newt.event.KeyEvent.VK_F8;
+ case java.awt.event.KeyEvent.VK_F9 : return com.jogamp.newt.event.KeyEvent.VK_F9;
+ case java.awt.event.KeyEvent.VK_F10 : return com.jogamp.newt.event.KeyEvent.VK_F10;
+ case java.awt.event.KeyEvent.VK_F11 : return com.jogamp.newt.event.KeyEvent.VK_F11;
+ case java.awt.event.KeyEvent.VK_F12 : return com.jogamp.newt.event.KeyEvent.VK_F12;
+ case java.awt.event.KeyEvent.VK_F13 : return com.jogamp.newt.event.KeyEvent.VK_F13;
+ case java.awt.event.KeyEvent.VK_F14 : return com.jogamp.newt.event.KeyEvent.VK_F14;
+ case java.awt.event.KeyEvent.VK_F15 : return com.jogamp.newt.event.KeyEvent.VK_F15;
+ case java.awt.event.KeyEvent.VK_F16 : return com.jogamp.newt.event.KeyEvent.VK_F16;
+ case java.awt.event.KeyEvent.VK_F17 : return com.jogamp.newt.event.KeyEvent.VK_F17;
+ case java.awt.event.KeyEvent.VK_F18 : return com.jogamp.newt.event.KeyEvent.VK_F18;
+ case java.awt.event.KeyEvent.VK_F19 : return com.jogamp.newt.event.KeyEvent.VK_F19;
+ case java.awt.event.KeyEvent.VK_F20 : return com.jogamp.newt.event.KeyEvent.VK_F20;
+ case java.awt.event.KeyEvent.VK_F21 : return com.jogamp.newt.event.KeyEvent.VK_F21;
+ case java.awt.event.KeyEvent.VK_F22 : return com.jogamp.newt.event.KeyEvent.VK_F22;
+ case java.awt.event.KeyEvent.VK_F23 : return com.jogamp.newt.event.KeyEvent.VK_F23;
+ case java.awt.event.KeyEvent.VK_F24 : return com.jogamp.newt.event.KeyEvent.VK_F24;
+ case java.awt.event.KeyEvent.VK_BRACELEFT : return com.jogamp.newt.event.KeyEvent.VK_LEFT_BRACE;
+ case 0x7c : return com.jogamp.newt.event.KeyEvent.VK_PIPE;
+ case java.awt.event.KeyEvent.VK_BRACERIGHT : return com.jogamp.newt.event.KeyEvent.VK_RIGHT_BRACE;
+ case java.awt.event.KeyEvent.VK_DEAD_TILDE : return com.jogamp.newt.event.KeyEvent.VK_TILDE;
+ case java.awt.event.KeyEvent.VK_DELETE : return com.jogamp.newt.event.KeyEvent.VK_DELETE;
+ case java.awt.event.KeyEvent.VK_NUMPAD0 : return com.jogamp.newt.event.KeyEvent.VK_NUMPAD0;
+ case java.awt.event.KeyEvent.VK_NUMPAD1 : return com.jogamp.newt.event.KeyEvent.VK_NUMPAD1;
+ case java.awt.event.KeyEvent.VK_NUMPAD2 : return com.jogamp.newt.event.KeyEvent.VK_NUMPAD2;
+ case java.awt.event.KeyEvent.VK_NUMPAD3 : return com.jogamp.newt.event.KeyEvent.VK_NUMPAD3;
+ case java.awt.event.KeyEvent.VK_NUMPAD4 : return com.jogamp.newt.event.KeyEvent.VK_NUMPAD4;
+ case java.awt.event.KeyEvent.VK_NUMPAD5 : return com.jogamp.newt.event.KeyEvent.VK_NUMPAD5;
+ case java.awt.event.KeyEvent.VK_NUMPAD6 : return com.jogamp.newt.event.KeyEvent.VK_NUMPAD6;
+ case java.awt.event.KeyEvent.VK_NUMPAD7 : return com.jogamp.newt.event.KeyEvent.VK_NUMPAD7;
+ case java.awt.event.KeyEvent.VK_NUMPAD8 : return com.jogamp.newt.event.KeyEvent.VK_NUMPAD8;
+ case java.awt.event.KeyEvent.VK_NUMPAD9 : return com.jogamp.newt.event.KeyEvent.VK_NUMPAD9;
+ case java.awt.event.KeyEvent.VK_DECIMAL : return com.jogamp.newt.event.KeyEvent.VK_DECIMAL;
+ case java.awt.event.KeyEvent.VK_SEPARATOR : return com.jogamp.newt.event.KeyEvent.VK_SEPARATOR;
+ case java.awt.event.KeyEvent.VK_ADD : return com.jogamp.newt.event.KeyEvent.VK_ADD;
+ case java.awt.event.KeyEvent.VK_SUBTRACT : return com.jogamp.newt.event.KeyEvent.VK_SUBTRACT;
+ case java.awt.event.KeyEvent.VK_MULTIPLY : return com.jogamp.newt.event.KeyEvent.VK_MULTIPLY;
+ case java.awt.event.KeyEvent.VK_DIVIDE : return com.jogamp.newt.event.KeyEvent.VK_DIVIDE;
+ case java.awt.event.KeyEvent.VK_NUM_LOCK : return com.jogamp.newt.event.KeyEvent.VK_NUM_LOCK;
+ case java.awt.event.KeyEvent.VK_KP_LEFT : return com.jogamp.newt.event.KeyEvent.VK_KP_LEFT;
+ case java.awt.event.KeyEvent.VK_KP_UP : return com.jogamp.newt.event.KeyEvent.VK_KP_UP;
+ case java.awt.event.KeyEvent.VK_KP_RIGHT : return com.jogamp.newt.event.KeyEvent.VK_KP_RIGHT;
+ case java.awt.event.KeyEvent.VK_KP_DOWN : return com.jogamp.newt.event.KeyEvent.VK_KP_DOWN;
+ case java.awt.event.KeyEvent.VK_LEFT : return com.jogamp.newt.event.KeyEvent.VK_LEFT;
+ case java.awt.event.KeyEvent.VK_UP : return com.jogamp.newt.event.KeyEvent.VK_UP;
+ case java.awt.event.KeyEvent.VK_RIGHT : return com.jogamp.newt.event.KeyEvent.VK_RIGHT;
+ case java.awt.event.KeyEvent.VK_DOWN : return com.jogamp.newt.event.KeyEvent.VK_DOWN;
+ case java.awt.event.KeyEvent.VK_CONTEXT_MENU : return com.jogamp.newt.event.KeyEvent.VK_CONTEXT_MENU;
+ case java.awt.event.KeyEvent.VK_WINDOWS : return com.jogamp.newt.event.KeyEvent.VK_WINDOWS;
+ case java.awt.event.KeyEvent.VK_META : return com.jogamp.newt.event.KeyEvent.VK_META;
+ case java.awt.event.KeyEvent.VK_HELP : return com.jogamp.newt.event.KeyEvent.VK_HELP;
+ case java.awt.event.KeyEvent.VK_COMPOSE : return com.jogamp.newt.event.KeyEvent.VK_COMPOSE;
+ case java.awt.event.KeyEvent.VK_BEGIN : return com.jogamp.newt.event.KeyEvent.VK_BEGIN;
+ case java.awt.event.KeyEvent.VK_STOP : return com.jogamp.newt.event.KeyEvent.VK_STOP;
+ case java.awt.event.KeyEvent.VK_INVERTED_EXCLAMATION_MARK: return com.jogamp.newt.event.KeyEvent.VK_INVERTED_EXCLAMATION_MARK;
+ case java.awt.event.KeyEvent.VK_EURO_SIGN : return com.jogamp.newt.event.KeyEvent.VK_EURO_SIGN;
+ case java.awt.event.KeyEvent.VK_CUT : return com.jogamp.newt.event.KeyEvent.VK_CUT;
+ case java.awt.event.KeyEvent.VK_COPY : return com.jogamp.newt.event.KeyEvent.VK_COPY;
+ case java.awt.event.KeyEvent.VK_PASTE : return com.jogamp.newt.event.KeyEvent.VK_PASTE;
+ case java.awt.event.KeyEvent.VK_UNDO : return com.jogamp.newt.event.KeyEvent.VK_UNDO;
+ case java.awt.event.KeyEvent.VK_AGAIN : return com.jogamp.newt.event.KeyEvent.VK_AGAIN;
+ case java.awt.event.KeyEvent.VK_FIND : return com.jogamp.newt.event.KeyEvent.VK_FIND;
+ case java.awt.event.KeyEvent.VK_PROPS : return com.jogamp.newt.event.KeyEvent.VK_PROPS;
+ case java.awt.event.KeyEvent.VK_INPUT_METHOD_ON_OFF: return com.jogamp.newt.event.KeyEvent.VK_INPUT_METHOD_ON_OFF;
+ case java.awt.event.KeyEvent.VK_CODE_INPUT : return com.jogamp.newt.event.KeyEvent.VK_CODE_INPUT;
+ case java.awt.event.KeyEvent.VK_ROMAN_CHARACTERS: return com.jogamp.newt.event.KeyEvent.VK_ROMAN_CHARACTERS;
+ case java.awt.event.KeyEvent.VK_ALL_CANDIDATES: return com.jogamp.newt.event.KeyEvent.VK_ALL_CANDIDATES;
+ case java.awt.event.KeyEvent.VK_PREVIOUS_CANDIDATE: return com.jogamp.newt.event.KeyEvent.VK_PREVIOUS_CANDIDATE;
+ case java.awt.event.KeyEvent.VK_ALPHANUMERIC : return com.jogamp.newt.event.KeyEvent.VK_ALPHANUMERIC;
+ case java.awt.event.KeyEvent.VK_KATAKANA : return com.jogamp.newt.event.KeyEvent.VK_KATAKANA;
+ case java.awt.event.KeyEvent.VK_HIRAGANA : return com.jogamp.newt.event.KeyEvent.VK_HIRAGANA;
+ case java.awt.event.KeyEvent.VK_FULL_WIDTH : return com.jogamp.newt.event.KeyEvent.VK_FULL_WIDTH;
+ case java.awt.event.KeyEvent.VK_HALF_WIDTH : return com.jogamp.newt.event.KeyEvent.VK_HALF_WIDTH;
+ case java.awt.event.KeyEvent.VK_JAPANESE_KATAKANA: return com.jogamp.newt.event.KeyEvent.VK_JAPANESE_KATAKANA;
+ case java.awt.event.KeyEvent.VK_JAPANESE_HIRAGANA: return com.jogamp.newt.event.KeyEvent.VK_JAPANESE_HIRAGANA;
+ case java.awt.event.KeyEvent.VK_JAPANESE_ROMAN: return com.jogamp.newt.event.KeyEvent.VK_JAPANESE_ROMAN;
+ case java.awt.event.KeyEvent.VK_KANA_LOCK : return com.jogamp.newt.event.KeyEvent.VK_KANA_LOCK;
+ }
+ return defNEWTKeyCode;
+ }
+
+ public static int newtKeyCode2AWTKeyCode(final short newtKeyCode) {
+ final int defAwtKeyCode = 0xFFFF & (int)newtKeyCode;
+ switch (newtKeyCode) {
+ case com.jogamp.newt.event.KeyEvent.VK_HOME : return java.awt.event.KeyEvent.VK_HOME;
+ case com.jogamp.newt.event.KeyEvent.VK_END : return java.awt.event.KeyEvent.VK_END;
+ case com.jogamp.newt.event.KeyEvent.VK_FINAL : return java.awt.event.KeyEvent.VK_FINAL;
+ case com.jogamp.newt.event.KeyEvent.VK_PRINTSCREEN : return java.awt.event.KeyEvent.VK_PRINTSCREEN;
+ case com.jogamp.newt.event.KeyEvent.VK_BACK_SPACE : return java.awt.event.KeyEvent.VK_BACK_SPACE;
+ case com.jogamp.newt.event.KeyEvent.VK_TAB : return java.awt.event.KeyEvent.VK_TAB;
+ case com.jogamp.newt.event.KeyEvent.VK_ENTER : return java.awt.event.KeyEvent.VK_ENTER;
+ case com.jogamp.newt.event.KeyEvent.VK_PAGE_DOWN : return java.awt.event.KeyEvent.VK_PAGE_DOWN;
+ case com.jogamp.newt.event.KeyEvent.VK_CLEAR : return java.awt.event.KeyEvent.VK_CLEAR;
+ case com.jogamp.newt.event.KeyEvent.VK_SHIFT : return java.awt.event.KeyEvent.VK_SHIFT;
+ case com.jogamp.newt.event.KeyEvent.VK_PAGE_UP : return java.awt.event.KeyEvent.VK_PAGE_UP;
+ case com.jogamp.newt.event.KeyEvent.VK_CONTROL : return java.awt.event.KeyEvent.VK_CONTROL;
+ case com.jogamp.newt.event.KeyEvent.VK_ALT : return java.awt.event.KeyEvent.VK_ALT;
+ // FIXME: On X11 it results to 0xff7e w/ AWTRobot, which is wrong. 0xffea Alt_R is expected AFAIK.
+ case com.jogamp.newt.event.KeyEvent.VK_ALT_GRAPH : return java.awt.event.KeyEvent.VK_ALT_GRAPH;
+ case com.jogamp.newt.event.KeyEvent.VK_CAPS_LOCK : return java.awt.event.KeyEvent.VK_CAPS_LOCK;
+ case com.jogamp.newt.event.KeyEvent.VK_PAUSE : return java.awt.event.KeyEvent.VK_PAUSE;
+ case com.jogamp.newt.event.KeyEvent.VK_SCROLL_LOCK : return java.awt.event.KeyEvent.VK_SCROLL_LOCK;
+ case com.jogamp.newt.event.KeyEvent.VK_CANCEL : return java.awt.event.KeyEvent.VK_CANCEL;
+ case com.jogamp.newt.event.KeyEvent.VK_INSERT : return java.awt.event.KeyEvent.VK_INSERT;
+ case com.jogamp.newt.event.KeyEvent.VK_ESCAPE : return java.awt.event.KeyEvent.VK_ESCAPE;
+ case com.jogamp.newt.event.KeyEvent.VK_CONVERT : return java.awt.event.KeyEvent.VK_CONVERT;
+ case com.jogamp.newt.event.KeyEvent.VK_NONCONVERT : return java.awt.event.KeyEvent.VK_NONCONVERT;
+ case com.jogamp.newt.event.KeyEvent.VK_ACCEPT : return java.awt.event.KeyEvent.VK_ACCEPT;
+ case com.jogamp.newt.event.KeyEvent.VK_MODECHANGE : return java.awt.event.KeyEvent.VK_MODECHANGE;
+ case com.jogamp.newt.event.KeyEvent.VK_SPACE : return java.awt.event.KeyEvent.VK_SPACE;
+ case com.jogamp.newt.event.KeyEvent.VK_EXCLAMATION_MARK: return java.awt.event.KeyEvent.VK_EXCLAMATION_MARK;
+ case com.jogamp.newt.event.KeyEvent.VK_QUOTEDBL : return java.awt.event.KeyEvent.VK_QUOTEDBL;
+ case com.jogamp.newt.event.KeyEvent.VK_NUMBER_SIGN : return java.awt.event.KeyEvent.VK_NUMBER_SIGN;
+ case com.jogamp.newt.event.KeyEvent.VK_DOLLAR : return java.awt.event.KeyEvent.VK_DOLLAR;
+ case com.jogamp.newt.event.KeyEvent.VK_PERCENT : return defAwtKeyCode;
+ case com.jogamp.newt.event.KeyEvent.VK_AMPERSAND : return java.awt.event.KeyEvent.VK_AMPERSAND;
+ case com.jogamp.newt.event.KeyEvent.VK_QUOTE : return java.awt.event.KeyEvent.VK_QUOTE;
+ case com.jogamp.newt.event.KeyEvent.VK_LEFT_PARENTHESIS : return java.awt.event.KeyEvent.VK_LEFT_PARENTHESIS;
+ case com.jogamp.newt.event.KeyEvent.VK_RIGHT_PARENTHESIS: return java.awt.event.KeyEvent.VK_RIGHT_PARENTHESIS;
+ case com.jogamp.newt.event.KeyEvent.VK_ASTERISK : return java.awt.event.KeyEvent.VK_ASTERISK;
+ case com.jogamp.newt.event.KeyEvent.VK_PLUS : return java.awt.event.KeyEvent.VK_PLUS;
+ case com.jogamp.newt.event.KeyEvent.VK_COMMA : return java.awt.event.KeyEvent.VK_COMMA;
+ case com.jogamp.newt.event.KeyEvent.VK_MINUS : return java.awt.event.KeyEvent.VK_MINUS;
+ case com.jogamp.newt.event.KeyEvent.VK_PERIOD : return java.awt.event.KeyEvent.VK_PERIOD;
+ case com.jogamp.newt.event.KeyEvent.VK_SLASH : return java.awt.event.KeyEvent.VK_SLASH;
+ case com.jogamp.newt.event.KeyEvent.VK_0 : return java.awt.event.KeyEvent.VK_0;
+ case com.jogamp.newt.event.KeyEvent.VK_1 : return java.awt.event.KeyEvent.VK_1;
+ case com.jogamp.newt.event.KeyEvent.VK_2 : return java.awt.event.KeyEvent.VK_2;
+ case com.jogamp.newt.event.KeyEvent.VK_3 : return java.awt.event.KeyEvent.VK_3;
+ case com.jogamp.newt.event.KeyEvent.VK_4 : return java.awt.event.KeyEvent.VK_4;
+ case com.jogamp.newt.event.KeyEvent.VK_5 : return java.awt.event.KeyEvent.VK_5;
+ case com.jogamp.newt.event.KeyEvent.VK_6 : return java.awt.event.KeyEvent.VK_6;
+ case com.jogamp.newt.event.KeyEvent.VK_7 : return java.awt.event.KeyEvent.VK_7;
+ case com.jogamp.newt.event.KeyEvent.VK_8 : return java.awt.event.KeyEvent.VK_8;
+ case com.jogamp.newt.event.KeyEvent.VK_9 : return java.awt.event.KeyEvent.VK_9;
+ case com.jogamp.newt.event.KeyEvent.VK_COLON : return java.awt.event.KeyEvent.VK_COLON;
+ case com.jogamp.newt.event.KeyEvent.VK_SEMICOLON : return java.awt.event.KeyEvent.VK_SEMICOLON;
+ case com.jogamp.newt.event.KeyEvent.VK_LESS : return java.awt.event.KeyEvent.VK_LESS;
+ case com.jogamp.newt.event.KeyEvent.VK_EQUALS : return java.awt.event.KeyEvent.VK_EQUALS;
+ case com.jogamp.newt.event.KeyEvent.VK_GREATER : return java.awt.event.KeyEvent.VK_GREATER;
+ case com.jogamp.newt.event.KeyEvent.VK_QUESTIONMARK : return defAwtKeyCode;
+ case com.jogamp.newt.event.KeyEvent.VK_AT : return java.awt.event.KeyEvent.VK_AT;
+ case com.jogamp.newt.event.KeyEvent.VK_A : return java.awt.event.KeyEvent.VK_A;
+ case com.jogamp.newt.event.KeyEvent.VK_B : return java.awt.event.KeyEvent.VK_B;
+ case com.jogamp.newt.event.KeyEvent.VK_C : return java.awt.event.KeyEvent.VK_C;
+ case com.jogamp.newt.event.KeyEvent.VK_D : return java.awt.event.KeyEvent.VK_D;
+ case com.jogamp.newt.event.KeyEvent.VK_E : return java.awt.event.KeyEvent.VK_E;
+ case com.jogamp.newt.event.KeyEvent.VK_F : return java.awt.event.KeyEvent.VK_F;
+ case com.jogamp.newt.event.KeyEvent.VK_G : return java.awt.event.KeyEvent.VK_G;
+ case com.jogamp.newt.event.KeyEvent.VK_H : return java.awt.event.KeyEvent.VK_H;
+ case com.jogamp.newt.event.KeyEvent.VK_I : return java.awt.event.KeyEvent.VK_I;
+ case com.jogamp.newt.event.KeyEvent.VK_J : return java.awt.event.KeyEvent.VK_J;
+ case com.jogamp.newt.event.KeyEvent.VK_K : return java.awt.event.KeyEvent.VK_K;
+ case com.jogamp.newt.event.KeyEvent.VK_L : return java.awt.event.KeyEvent.VK_L;
+ case com.jogamp.newt.event.KeyEvent.VK_M : return java.awt.event.KeyEvent.VK_M;
+ case com.jogamp.newt.event.KeyEvent.VK_N : return java.awt.event.KeyEvent.VK_N;
+ case com.jogamp.newt.event.KeyEvent.VK_O : return java.awt.event.KeyEvent.VK_O;
+ case com.jogamp.newt.event.KeyEvent.VK_P : return java.awt.event.KeyEvent.VK_P;
+ case com.jogamp.newt.event.KeyEvent.VK_Q : return java.awt.event.KeyEvent.VK_Q;
+ case com.jogamp.newt.event.KeyEvent.VK_R : return java.awt.event.KeyEvent.VK_R;
+ case com.jogamp.newt.event.KeyEvent.VK_S : return java.awt.event.KeyEvent.VK_S;
+ case com.jogamp.newt.event.KeyEvent.VK_T : return java.awt.event.KeyEvent.VK_T;
+ case com.jogamp.newt.event.KeyEvent.VK_U : return java.awt.event.KeyEvent.VK_U;
+ case com.jogamp.newt.event.KeyEvent.VK_V : return java.awt.event.KeyEvent.VK_V;
+ case com.jogamp.newt.event.KeyEvent.VK_W : return java.awt.event.KeyEvent.VK_W;
+ case com.jogamp.newt.event.KeyEvent.VK_X : return java.awt.event.KeyEvent.VK_X;
+ case com.jogamp.newt.event.KeyEvent.VK_Y : return java.awt.event.KeyEvent.VK_Y;
+ case com.jogamp.newt.event.KeyEvent.VK_Z : return java.awt.event.KeyEvent.VK_Z;
+ case com.jogamp.newt.event.KeyEvent.VK_OPEN_BRACKET : return java.awt.event.KeyEvent.VK_OPEN_BRACKET;
+ case com.jogamp.newt.event.KeyEvent.VK_BACK_SLASH : return java.awt.event.KeyEvent.VK_BACK_SLASH;
+ case com.jogamp.newt.event.KeyEvent.VK_CLOSE_BRACKET : return java.awt.event.KeyEvent.VK_CLOSE_BRACKET;
+ case com.jogamp.newt.event.KeyEvent.VK_CIRCUMFLEX : return java.awt.event.KeyEvent.VK_CIRCUMFLEX;
+ case com.jogamp.newt.event.KeyEvent.VK_UNDERSCORE : return java.awt.event.KeyEvent.VK_UNDERSCORE;
+ case com.jogamp.newt.event.KeyEvent.VK_BACK_QUOTE : return java.awt.event.KeyEvent.VK_BACK_QUOTE;
+ case com.jogamp.newt.event.KeyEvent.VK_F1 : return java.awt.event.KeyEvent.VK_F1;
+ case com.jogamp.newt.event.KeyEvent.VK_F2 : return java.awt.event.KeyEvent.VK_F2;
+ case com.jogamp.newt.event.KeyEvent.VK_F3 : return java.awt.event.KeyEvent.VK_F3;
+ case com.jogamp.newt.event.KeyEvent.VK_F4 : return java.awt.event.KeyEvent.VK_F4;
+ case com.jogamp.newt.event.KeyEvent.VK_F5 : return java.awt.event.KeyEvent.VK_F5;
+ case com.jogamp.newt.event.KeyEvent.VK_F6 : return java.awt.event.KeyEvent.VK_F6;
+ case com.jogamp.newt.event.KeyEvent.VK_F7 : return java.awt.event.KeyEvent.VK_F7;
+ case com.jogamp.newt.event.KeyEvent.VK_F8 : return java.awt.event.KeyEvent.VK_F8;
+ case com.jogamp.newt.event.KeyEvent.VK_F9 : return java.awt.event.KeyEvent.VK_F9;
+ case com.jogamp.newt.event.KeyEvent.VK_F10 : return java.awt.event.KeyEvent.VK_F10;
+ case com.jogamp.newt.event.KeyEvent.VK_F11 : return java.awt.event.KeyEvent.VK_F11;
+ case com.jogamp.newt.event.KeyEvent.VK_F12 : return java.awt.event.KeyEvent.VK_F12;
+ case com.jogamp.newt.event.KeyEvent.VK_F13 : return java.awt.event.KeyEvent.VK_F13;
+ case com.jogamp.newt.event.KeyEvent.VK_F14 : return java.awt.event.KeyEvent.VK_F14;
+ case com.jogamp.newt.event.KeyEvent.VK_F15 : return java.awt.event.KeyEvent.VK_F15;
+ case com.jogamp.newt.event.KeyEvent.VK_F16 : return java.awt.event.KeyEvent.VK_F16;
+ case com.jogamp.newt.event.KeyEvent.VK_F17 : return java.awt.event.KeyEvent.VK_F17;
+ case com.jogamp.newt.event.KeyEvent.VK_F18 : return java.awt.event.KeyEvent.VK_F18;
+ case com.jogamp.newt.event.KeyEvent.VK_F19 : return java.awt.event.KeyEvent.VK_F19;
+ case com.jogamp.newt.event.KeyEvent.VK_F20 : return java.awt.event.KeyEvent.VK_F20;
+ case com.jogamp.newt.event.KeyEvent.VK_F21 : return java.awt.event.KeyEvent.VK_F21;
+ case com.jogamp.newt.event.KeyEvent.VK_F22 : return java.awt.event.KeyEvent.VK_F22;
+ case com.jogamp.newt.event.KeyEvent.VK_F23 : return java.awt.event.KeyEvent.VK_F23;
+ case com.jogamp.newt.event.KeyEvent.VK_F24 : return java.awt.event.KeyEvent.VK_F24;
+ case com.jogamp.newt.event.KeyEvent.VK_LEFT_BRACE : return java.awt.event.KeyEvent.VK_BRACELEFT;
+ case com.jogamp.newt.event.KeyEvent.VK_PIPE : return defAwtKeyCode;
+ case com.jogamp.newt.event.KeyEvent.VK_RIGHT_BRACE : return java.awt.event.KeyEvent.VK_BRACERIGHT;
+ case com.jogamp.newt.event.KeyEvent.VK_TILDE : return java.awt.event.KeyEvent.VK_DEAD_TILDE;
+ case com.jogamp.newt.event.KeyEvent.VK_DELETE : return java.awt.event.KeyEvent.VK_DELETE;
+ case com.jogamp.newt.event.KeyEvent.VK_NUMPAD0 : return java.awt.event.KeyEvent.VK_NUMPAD0;
+ case com.jogamp.newt.event.KeyEvent.VK_NUMPAD1 : return java.awt.event.KeyEvent.VK_NUMPAD1;
+ case com.jogamp.newt.event.KeyEvent.VK_NUMPAD2 : return java.awt.event.KeyEvent.VK_NUMPAD2;
+ case com.jogamp.newt.event.KeyEvent.VK_NUMPAD3 : return java.awt.event.KeyEvent.VK_NUMPAD3;
+ case com.jogamp.newt.event.KeyEvent.VK_NUMPAD4 : return java.awt.event.KeyEvent.VK_NUMPAD4;
+ case com.jogamp.newt.event.KeyEvent.VK_NUMPAD5 : return java.awt.event.KeyEvent.VK_NUMPAD5;
+ case com.jogamp.newt.event.KeyEvent.VK_NUMPAD6 : return java.awt.event.KeyEvent.VK_NUMPAD6;
+ case com.jogamp.newt.event.KeyEvent.VK_NUMPAD7 : return java.awt.event.KeyEvent.VK_NUMPAD7;
+ case com.jogamp.newt.event.KeyEvent.VK_NUMPAD8 : return java.awt.event.KeyEvent.VK_NUMPAD8;
+ case com.jogamp.newt.event.KeyEvent.VK_NUMPAD9 : return java.awt.event.KeyEvent.VK_NUMPAD9;
+ case com.jogamp.newt.event.KeyEvent.VK_DECIMAL : return java.awt.event.KeyEvent.VK_DECIMAL;
+ case com.jogamp.newt.event.KeyEvent.VK_SEPARATOR : return java.awt.event.KeyEvent.VK_SEPARATOR;
+ case com.jogamp.newt.event.KeyEvent.VK_ADD : return java.awt.event.KeyEvent.VK_ADD;
+ case com.jogamp.newt.event.KeyEvent.VK_SUBTRACT : return java.awt.event.KeyEvent.VK_SUBTRACT;
+ case com.jogamp.newt.event.KeyEvent.VK_MULTIPLY : return java.awt.event.KeyEvent.VK_MULTIPLY;
+ case com.jogamp.newt.event.KeyEvent.VK_DIVIDE : return java.awt.event.KeyEvent.VK_DIVIDE;
+ case com.jogamp.newt.event.KeyEvent.VK_NUM_LOCK : return java.awt.event.KeyEvent.VK_NUM_LOCK;
+ case com.jogamp.newt.event.KeyEvent.VK_KP_LEFT : return java.awt.event.KeyEvent.VK_KP_LEFT;
+ case com.jogamp.newt.event.KeyEvent.VK_KP_UP : return java.awt.event.KeyEvent.VK_KP_UP;
+ case com.jogamp.newt.event.KeyEvent.VK_KP_RIGHT : return java.awt.event.KeyEvent.VK_KP_RIGHT;
+ case com.jogamp.newt.event.KeyEvent.VK_KP_DOWN : return java.awt.event.KeyEvent.VK_KP_DOWN;
+ case com.jogamp.newt.event.KeyEvent.VK_LEFT : return java.awt.event.KeyEvent.VK_LEFT;
+ case com.jogamp.newt.event.KeyEvent.VK_UP : return java.awt.event.KeyEvent.VK_UP;
+ case com.jogamp.newt.event.KeyEvent.VK_RIGHT : return java.awt.event.KeyEvent.VK_RIGHT;
+ case com.jogamp.newt.event.KeyEvent.VK_DOWN : return java.awt.event.KeyEvent.VK_DOWN;
+ case com.jogamp.newt.event.KeyEvent.VK_CONTEXT_MENU : return java.awt.event.KeyEvent.VK_CONTEXT_MENU;
+ case com.jogamp.newt.event.KeyEvent.VK_WINDOWS : return java.awt.event.KeyEvent.VK_WINDOWS;
+ case com.jogamp.newt.event.KeyEvent.VK_META : return java.awt.event.KeyEvent.VK_META;
+ case com.jogamp.newt.event.KeyEvent.VK_HELP : return java.awt.event.KeyEvent.VK_HELP;
+ case com.jogamp.newt.event.KeyEvent.VK_COMPOSE : return java.awt.event.KeyEvent.VK_COMPOSE;
+ case com.jogamp.newt.event.KeyEvent.VK_BEGIN : return java.awt.event.KeyEvent.VK_BEGIN;
+ case com.jogamp.newt.event.KeyEvent.VK_STOP : return java.awt.event.KeyEvent.VK_STOP;
+ case com.jogamp.newt.event.KeyEvent.VK_INVERTED_EXCLAMATION_MARK: return java.awt.event.KeyEvent.VK_INVERTED_EXCLAMATION_MARK;
+ case com.jogamp.newt.event.KeyEvent.VK_EURO_SIGN : return java.awt.event.KeyEvent.VK_EURO_SIGN;
+ case com.jogamp.newt.event.KeyEvent.VK_CUT : return java.awt.event.KeyEvent.VK_CUT;
+ case com.jogamp.newt.event.KeyEvent.VK_COPY : return java.awt.event.KeyEvent.VK_COPY;
+ case com.jogamp.newt.event.KeyEvent.VK_PASTE : return java.awt.event.KeyEvent.VK_PASTE;
+ case com.jogamp.newt.event.KeyEvent.VK_UNDO : return java.awt.event.KeyEvent.VK_UNDO;
+ case com.jogamp.newt.event.KeyEvent.VK_AGAIN : return java.awt.event.KeyEvent.VK_AGAIN;
+ case com.jogamp.newt.event.KeyEvent.VK_FIND : return java.awt.event.KeyEvent.VK_FIND;
+ case com.jogamp.newt.event.KeyEvent.VK_PROPS : return java.awt.event.KeyEvent.VK_PROPS;
+ case com.jogamp.newt.event.KeyEvent.VK_INPUT_METHOD_ON_OFF: return java.awt.event.KeyEvent.VK_INPUT_METHOD_ON_OFF;
+ case com.jogamp.newt.event.KeyEvent.VK_CODE_INPUT : return java.awt.event.KeyEvent.VK_CODE_INPUT;
+ case com.jogamp.newt.event.KeyEvent.VK_ROMAN_CHARACTERS: return java.awt.event.KeyEvent.VK_ROMAN_CHARACTERS;
+ case com.jogamp.newt.event.KeyEvent.VK_ALL_CANDIDATES: return java.awt.event.KeyEvent.VK_ALL_CANDIDATES;
+ case com.jogamp.newt.event.KeyEvent.VK_PREVIOUS_CANDIDATE: return java.awt.event.KeyEvent.VK_PREVIOUS_CANDIDATE;
+ case com.jogamp.newt.event.KeyEvent.VK_ALPHANUMERIC : return java.awt.event.KeyEvent.VK_ALPHANUMERIC;
+ case com.jogamp.newt.event.KeyEvent.VK_KATAKANA : return java.awt.event.KeyEvent.VK_KATAKANA;
+ case com.jogamp.newt.event.KeyEvent.VK_HIRAGANA : return java.awt.event.KeyEvent.VK_HIRAGANA;
+ case com.jogamp.newt.event.KeyEvent.VK_FULL_WIDTH : return java.awt.event.KeyEvent.VK_FULL_WIDTH;
+ case com.jogamp.newt.event.KeyEvent.VK_HALF_WIDTH : return java.awt.event.KeyEvent.VK_HALF_WIDTH;
+ case com.jogamp.newt.event.KeyEvent.VK_JAPANESE_KATAKANA: return java.awt.event.KeyEvent.VK_JAPANESE_KATAKANA;
+ case com.jogamp.newt.event.KeyEvent.VK_JAPANESE_HIRAGANA: return java.awt.event.KeyEvent.VK_JAPANESE_HIRAGANA;
+ case com.jogamp.newt.event.KeyEvent.VK_JAPANESE_ROMAN: return java.awt.event.KeyEvent.VK_JAPANESE_ROMAN;
+ case com.jogamp.newt.event.KeyEvent.VK_KANA_LOCK : return java.awt.event.KeyEvent.VK_KANA_LOCK;
}
+ return defAwtKeyCode;
}
public static final com.jogamp.newt.event.WindowEvent createWindowEvent(java.awt.event.WindowEvent event, com.jogamp.newt.Window newtSource) {
@@ -289,11 +650,11 @@ public class AWTNewtEventFactory {
public static final com.jogamp.newt.event.KeyEvent createKeyEvent(short newtType, java.awt.event.KeyEvent event, com.jogamp.newt.Window newtSource) {
if( (short)0 != newtType ) {
- final short keyCode = (short)event.getKeyCode();
- return new com.jogamp.newt.event.KeyEvent(
+ final short newtKeyCode = awtKeyCode2NewtKeyCode( event.getKeyCode() );
+ return com.jogamp.newt.event.KeyEvent.create(
newtType, (null==newtSource)?(Object)event.getComponent():(Object)newtSource, event.getWhen(),
awtModifiers2Newt(event.getModifiers(), event.getModifiersEx()),
- keyCode, keyCode, event.getKeyChar());
+ newtKeyCode, newtKeyCode, event.getKeyChar());
}
return null; // no mapping ..
}
diff --git a/src/newt/classes/jogamp/newt/driver/android/event/AndroidNewtEventFactory.java b/src/newt/classes/jogamp/newt/driver/android/event/AndroidNewtEventFactory.java
index 9638e6a7c..364a348ee 100644
--- a/src/newt/classes/jogamp/newt/driver/android/event/AndroidNewtEventFactory.java
+++ b/src/newt/classes/jogamp/newt/driver/android/event/AndroidNewtEventFactory.java
@@ -216,7 +216,7 @@ public class AndroidNewtEventFactory {
final long unixTime = System.currentTimeMillis() + ( aEvent.getEventTime() - android.os.SystemClock.uptimeMillis() );
final int newtMods = aKeyModifiers2Newt(aEvent.getMetaState());
- return new com.jogamp.newt.event.KeyEvent(
+ return com.jogamp.newt.event.KeyEvent.create(
newtType, src, unixTime, newtMods, newtKeyCode, newtKeyCode, (char) aEvent.getUnicodeChar());
}
return null;
diff --git a/src/newt/classes/jogamp/newt/driver/awt/DisplayDriver.java b/src/newt/classes/jogamp/newt/driver/awt/DisplayDriver.java
index ead567d82..4139951aa 100644
--- a/src/newt/classes/jogamp/newt/driver/awt/DisplayDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/awt/DisplayDriver.java
@@ -38,7 +38,6 @@ import com.jogamp.nativewindow.awt.AWTGraphicsDevice;
import com.jogamp.newt.NewtFactory;
import com.jogamp.newt.util.EDTUtil;
-import jogamp.newt.DefaultEDTUtil;
import jogamp.newt.DisplayImpl;
public class DisplayDriver extends DisplayImpl {
diff --git a/src/newt/classes/jogamp/newt/driver/linux/LinuxEventDeviceTracker.java b/src/newt/classes/jogamp/newt/driver/linux/LinuxEventDeviceTracker.java
index 80b1b6687..fc8c5adc6 100644
--- a/src/newt/classes/jogamp/newt/driver/linux/LinuxEventDeviceTracker.java
+++ b/src/newt/classes/jogamp/newt/driver/linux/LinuxEventDeviceTracker.java
@@ -311,7 +311,7 @@ public class LinuxEventDeviceTracker implements WindowListener {
}
private char NewtVKey2Unicode(short VK){
- if( KeyEvent.isPrintableKey(VK) ){
+ if( KeyEvent.isPrintableKey(VK, false) ){
return (char)VK;
}
return 0;
@@ -479,9 +479,9 @@ public class LinuxEventDeviceTracker implements WindowListener {
case 39:
return KeyEvent.VK_SEMICOLON;
case 40: // apostrophe
- return KeyEvent.VK_DEAD_ACUTE;
+ return KeyEvent.VK_QUOTE;
case 41: // grave
- return KeyEvent.VK_DEAD_GRAVE;
+ return KeyEvent.VK_BACK_QUOTE;
case 42: // left shift
return KeyEvent.VK_SHIFT;
diff --git a/src/newt/classes/jogamp/newt/driver/macosx/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/macosx/WindowDriver.java
index b1d18e487..bb72350e3 100644
--- a/src/newt/classes/jogamp/newt/driver/macosx/WindowDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/macosx/WindowDriver.java
@@ -51,7 +51,6 @@ import jogamp.newt.driver.DriverUpdatePosition;
import com.jogamp.newt.event.InputEvent;
import com.jogamp.newt.event.KeyEvent;
-import com.jogamp.newt.event.UTFKeyUtil;
public class WindowDriver extends WindowImpl implements MutableSurface, DriverClearFocus, DriverUpdatePosition {
@@ -412,7 +411,7 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl
final short keyCode = MacKeyUtil.validateKeyCode(_keyCode, keyChar);
final short keySym;
{
- short _keySym = KeyEvent.NULL_CHAR != keySymChar ? UTFKeyUtil.utf16ToVKey(keySymChar) : KeyEvent.VK_UNDEFINED;
+ short _keySym = KeyEvent.NULL_CHAR != keySymChar ? KeyEvent.utf16ToVKey(keySymChar) : KeyEvent.VK_UNDEFINED;
keySym = KeyEvent.VK_UNDEFINED != _keySym ? _keySym : keyCode;
}
/* {
@@ -421,7 +420,7 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl
", keyCode 0x"+Integer.toHexString(_keyCode)+" -> 0x"+Integer.toHexString(keyCode)+
", keySymChar '"+keySymChar+"', 0x"+Integer.toHexString(keySymChar)+" -> 0x"+Integer.toHexString(keySym)+
", mods "+toHexString(modifiers)+
- ", was: pressed "+isKeyPressed(keyCode)+", repeat "+isKeyInAutoRepeat(keyCode)+", isModifierKeyCode "+isModifierKeyCode);
+ ", was: pressed "+isKeyPressed(keyCode)+", isModifierKeyCode "+isModifierKeyCode);
} */
// 1:1 Order: OSX and NEWT delivery order is PRESSED, RELEASED and TYPED
@@ -429,15 +428,13 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl
switch(eventType) {
case KeyEvent.EVENT_KEY_RELEASED:
if( isKeyCodeTracked(keyCode) ) {
- keyRepeatState.put(keyCode, false); // prev == true -> AR out
- keyPressedState.put(keyCode, false);
+ setKeyPressed(keyCode, false);
}
break;
case KeyEvent.EVENT_KEY_PRESSED:
if( isKeyCodeTracked(keyCode) ) {
- if( keyPressedState.put(keyCode, true) ) {
+ if( setKeyPressed(keyCode, true) ) {
// key was already pressed
- keyRepeatState.put(keyCode, true); // prev == false -> AR in
modifiers |= InputEvent.AUTOREPEAT_MASK;
super.enqueueKeyEvent(wait, KeyEvent.EVENT_KEY_RELEASED, modifiers, keyCode, keySym, keyChar); // RELEASED
}
diff --git a/src/newt/classes/jogamp/newt/driver/windows/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/windows/WindowDriver.java
index e7a8d5a33..ad7e1e8f3 100644
--- a/src/newt/classes/jogamp/newt/driver/windows/WindowDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/windows/WindowDriver.java
@@ -261,13 +261,17 @@ public class WindowDriver extends WindowImpl {
// nop - using event driven insetsChange(..)
}
+ private short repeatedKey = KeyEvent.VK_UNDEFINED;
+
private final boolean handlePressTypedAutoRepeat(boolean isModifierKey, int modifiers, short keyCode, short keySym, char keyChar) {
- if( isKeyCodeTracked(keyCode) && keyPressedState.put(keyCode, true) ) {
- final boolean preKeyRepeatState = keyRepeatState.put(keyCode, true);
+ if( setKeyPressed(keyCode, true) ) {
+ // AR: Key was already pressed: Either [enter | within] AR mode
+ final boolean withinAR = repeatedKey == keyCode;
+ repeatedKey = keyCode;
if( !isModifierKey ) {
// AR: Key was already pressed: Either [enter | within] AR mode
modifiers |= InputEvent.AUTOREPEAT_MASK;
- if( preKeyRepeatState ) {
+ if( withinAR ) {
// AR: Within AR mode
super.sendKeyEvent(KeyEvent.EVENT_KEY_PRESSED, modifiers, keyCode, keySym, keyChar);
} // else { AR: Enter AR mode - skip already send PRESSED ; or ALT }
@@ -289,11 +293,12 @@ public class WindowDriver extends WindowImpl {
switch(eventType) {
case KeyEvent.EVENT_KEY_RELEASED:
if( isKeyCodeTracked(keyCode) ) {
- if( keyRepeatState.put(keyCode, false) && !isModifierKey ) {
+ if( repeatedKey == keyCode && !isModifierKey ) {
// AR out - send out missing PRESSED
super.sendKeyEvent(KeyEvent.EVENT_KEY_PRESSED, modifiers | InputEvent.AUTOREPEAT_MASK, keyCode, keySym, keyChar);
}
- keyPressedState.put(keyCode, false);
+ setKeyPressed(keyCode, false);
+ repeatedKey = KeyEvent.VK_UNDEFINED;
}
super.sendKeyEvent(KeyEvent.EVENT_KEY_RELEASED, modifiers, keyCode, keySym, keyChar);
break;
diff --git a/src/newt/classes/jogamp/newt/swt/event/SWTNewtEventFactory.java b/src/newt/classes/jogamp/newt/swt/event/SWTNewtEventFactory.java
index 1ebb714fa..5e240636d 100644
--- a/src/newt/classes/jogamp/newt/swt/event/SWTNewtEventFactory.java
+++ b/src/newt/classes/jogamp/newt/swt/event/SWTNewtEventFactory.java
@@ -68,6 +68,141 @@ public class SWTNewtEventFactory {
return newtMods;
}
+ public static short swtKeyCode2NewtKeyCode(final int swtKeyCode) {
+ final short defNEWTKeyCode = (short)swtKeyCode;
+ switch (swtKeyCode) {
+ case SWT.HOME : return com.jogamp.newt.event.KeyEvent.VK_HOME;
+ case SWT.END : return com.jogamp.newt.event.KeyEvent.VK_END;
+ case SWT.PRINT_SCREEN : return com.jogamp.newt.event.KeyEvent.VK_PRINTSCREEN;
+ case SWT.BS : return com.jogamp.newt.event.KeyEvent.VK_BACK_SPACE;
+ case SWT.TAB : return com.jogamp.newt.event.KeyEvent.VK_TAB;
+ case SWT.LF : return com.jogamp.newt.event.KeyEvent.VK_ENTER;
+ case SWT.PAGE_DOWN : return com.jogamp.newt.event.KeyEvent.VK_PAGE_DOWN;
+ case SWT.PAGE_UP : return com.jogamp.newt.event.KeyEvent.VK_PAGE_UP;
+ case SWT.CONTROL : return com.jogamp.newt.event.KeyEvent.VK_CONTROL;
+ case SWT.CAPS_LOCK : return com.jogamp.newt.event.KeyEvent.VK_CAPS_LOCK;
+ case SWT.PAUSE : return com.jogamp.newt.event.KeyEvent.VK_PAUSE;
+ case SWT.SCROLL_LOCK : return com.jogamp.newt.event.KeyEvent.VK_SCROLL_LOCK;
+ case SWT.CANCEL : return com.jogamp.newt.event.KeyEvent.VK_CANCEL;
+ case SWT.INSERT : return com.jogamp.newt.event.KeyEvent.VK_INSERT;
+ case SWT.ESC : return com.jogamp.newt.event.KeyEvent.VK_ESCAPE;
+ case SWT.SPACE : return com.jogamp.newt.event.KeyEvent.VK_SPACE;
+ case SWT.F1 : return com.jogamp.newt.event.KeyEvent.VK_F1;
+ case SWT.F2 : return com.jogamp.newt.event.KeyEvent.VK_F2;
+ case SWT.F3 : return com.jogamp.newt.event.KeyEvent.VK_F3;
+ case SWT.F4 : return com.jogamp.newt.event.KeyEvent.VK_F4;
+ case SWT.F5 : return com.jogamp.newt.event.KeyEvent.VK_F5;
+ case SWT.F6 : return com.jogamp.newt.event.KeyEvent.VK_F6;
+ case SWT.F7 : return com.jogamp.newt.event.KeyEvent.VK_F7;
+ case SWT.F8 : return com.jogamp.newt.event.KeyEvent.VK_F8;
+ case SWT.F9 : return com.jogamp.newt.event.KeyEvent.VK_F9;
+ case SWT.F10 : return com.jogamp.newt.event.KeyEvent.VK_F10;
+ case SWT.F11 : return com.jogamp.newt.event.KeyEvent.VK_F11;
+ case SWT.F12 : return com.jogamp.newt.event.KeyEvent.VK_F12;
+ case SWT.F13 : return com.jogamp.newt.event.KeyEvent.VK_F13;
+ case SWT.F14 : return com.jogamp.newt.event.KeyEvent.VK_F14;
+ case SWT.F15 : return com.jogamp.newt.event.KeyEvent.VK_F15;
+ case SWT.F16 : return com.jogamp.newt.event.KeyEvent.VK_F16;
+ case SWT.F17 : return com.jogamp.newt.event.KeyEvent.VK_F17;
+ case SWT.F18 : return com.jogamp.newt.event.KeyEvent.VK_F18;
+ case SWT.F19 : return com.jogamp.newt.event.KeyEvent.VK_F19;
+ case SWT.F20 : return com.jogamp.newt.event.KeyEvent.VK_F20;
+ case SWT.DEL : return com.jogamp.newt.event.KeyEvent.VK_DELETE;
+ case SWT.KEYPAD_0 : return com.jogamp.newt.event.KeyEvent.VK_NUMPAD0;
+ case SWT.KEYPAD_1 : return com.jogamp.newt.event.KeyEvent.VK_NUMPAD1;
+ case SWT.KEYPAD_2 : return com.jogamp.newt.event.KeyEvent.VK_NUMPAD2;
+ case SWT.KEYPAD_3 : return com.jogamp.newt.event.KeyEvent.VK_NUMPAD3;
+ case SWT.KEYPAD_4 : return com.jogamp.newt.event.KeyEvent.VK_NUMPAD4;
+ case SWT.KEYPAD_5 : return com.jogamp.newt.event.KeyEvent.VK_NUMPAD5;
+ case SWT.KEYPAD_6 : return com.jogamp.newt.event.KeyEvent.VK_NUMPAD6;
+ case SWT.KEYPAD_7 : return com.jogamp.newt.event.KeyEvent.VK_NUMPAD7;
+ case SWT.KEYPAD_8 : return com.jogamp.newt.event.KeyEvent.VK_NUMPAD8;
+ case SWT.KEYPAD_9 : return com.jogamp.newt.event.KeyEvent.VK_NUMPAD9;
+ case SWT.KEYPAD_DECIMAL: return com.jogamp.newt.event.KeyEvent.VK_DECIMAL;
+ case SWT.KEYPAD_ADD : return com.jogamp.newt.event.KeyEvent.VK_ADD;
+ case SWT.KEYPAD_SUBTRACT: return com.jogamp.newt.event.KeyEvent.VK_SUBTRACT;
+ case SWT.KEYPAD_MULTIPLY: return com.jogamp.newt.event.KeyEvent.VK_MULTIPLY;
+ case SWT.KEYPAD_DIVIDE : return com.jogamp.newt.event.KeyEvent.VK_DIVIDE;
+ case SWT.NUM_LOCK : return com.jogamp.newt.event.KeyEvent.VK_NUM_LOCK;
+ case SWT.ARROW_LEFT : return com.jogamp.newt.event.KeyEvent.VK_LEFT;
+ case SWT.ARROW_UP : return com.jogamp.newt.event.KeyEvent.VK_UP;
+ case SWT.ARROW_RIGHT : return com.jogamp.newt.event.KeyEvent.VK_RIGHT;
+ case SWT.ARROW_DOWN : return com.jogamp.newt.event.KeyEvent.VK_DOWN;
+ case SWT.HELP : return com.jogamp.newt.event.KeyEvent.VK_HELP;
+ }
+ return defNEWTKeyCode;
+ }
+
+ public static int newtKeyCode2SWTKeyCode(final short newtKeyCode) {
+ final int defSWTKeyCode = 0xFFFF & (int)newtKeyCode;
+ switch (newtKeyCode) {
+ case com.jogamp.newt.event.KeyEvent.VK_HOME : return SWT.HOME;
+ case com.jogamp.newt.event.KeyEvent.VK_END : return SWT.END;
+ case com.jogamp.newt.event.KeyEvent.VK_PRINTSCREEN : return SWT.PRINT_SCREEN;
+ case com.jogamp.newt.event.KeyEvent.VK_BACK_SPACE : return SWT.BS;
+ case com.jogamp.newt.event.KeyEvent.VK_TAB : return SWT.TAB;
+ case com.jogamp.newt.event.KeyEvent.VK_ENTER : return SWT.LF;
+ case com.jogamp.newt.event.KeyEvent.VK_PAGE_DOWN : return SWT.PAGE_DOWN;
+ case com.jogamp.newt.event.KeyEvent.VK_PAGE_UP : return SWT.PAGE_UP;
+ case com.jogamp.newt.event.KeyEvent.VK_CONTROL : return SWT.CONTROL;
+ case com.jogamp.newt.event.KeyEvent.VK_CAPS_LOCK : return SWT.CAPS_LOCK;
+ case com.jogamp.newt.event.KeyEvent.VK_PAUSE : return SWT.PAUSE;
+ case com.jogamp.newt.event.KeyEvent.VK_SCROLL_LOCK : return SWT.SCROLL_LOCK;
+ case com.jogamp.newt.event.KeyEvent.VK_CANCEL : return SWT.CANCEL;
+ case com.jogamp.newt.event.KeyEvent.VK_INSERT : return SWT.INSERT;
+ case com.jogamp.newt.event.KeyEvent.VK_ESCAPE : return SWT.ESC;
+ case com.jogamp.newt.event.KeyEvent.VK_SPACE : return SWT.SPACE;
+ case com.jogamp.newt.event.KeyEvent.VK_F1 : return SWT.F1;
+ case com.jogamp.newt.event.KeyEvent.VK_F2 : return SWT.F2;
+ case com.jogamp.newt.event.KeyEvent.VK_F3 : return SWT.F3;
+ case com.jogamp.newt.event.KeyEvent.VK_F4 : return SWT.F4;
+ case com.jogamp.newt.event.KeyEvent.VK_F5 : return SWT.F5;
+ case com.jogamp.newt.event.KeyEvent.VK_F6 : return SWT.F6;
+ case com.jogamp.newt.event.KeyEvent.VK_F7 : return SWT.F7;
+ case com.jogamp.newt.event.KeyEvent.VK_F8 : return SWT.F8;
+ case com.jogamp.newt.event.KeyEvent.VK_F9 : return SWT.F9;
+ case com.jogamp.newt.event.KeyEvent.VK_F10 : return SWT.F10;
+ case com.jogamp.newt.event.KeyEvent.VK_F11 : return SWT.F11;
+ case com.jogamp.newt.event.KeyEvent.VK_F12 : return SWT.F12;
+ case com.jogamp.newt.event.KeyEvent.VK_F13 : return SWT.F13;
+ case com.jogamp.newt.event.KeyEvent.VK_F14 : return SWT.F14;
+ case com.jogamp.newt.event.KeyEvent.VK_F15 : return SWT.F15;
+ case com.jogamp.newt.event.KeyEvent.VK_F16 : return SWT.F16;
+ case com.jogamp.newt.event.KeyEvent.VK_F17 : return SWT.F17;
+ case com.jogamp.newt.event.KeyEvent.VK_F18 : return SWT.F18;
+ case com.jogamp.newt.event.KeyEvent.VK_F19 : return SWT.F19;
+ case com.jogamp.newt.event.KeyEvent.VK_F20 : return SWT.F20;
+ case com.jogamp.newt.event.KeyEvent.VK_DELETE : return SWT.DEL;
+ case com.jogamp.newt.event.KeyEvent.VK_NUMPAD0 : return SWT.KEYPAD_0;
+ case com.jogamp.newt.event.KeyEvent.VK_NUMPAD1 : return SWT.KEYPAD_1;
+ case com.jogamp.newt.event.KeyEvent.VK_NUMPAD2 : return SWT.KEYPAD_2;
+ case com.jogamp.newt.event.KeyEvent.VK_NUMPAD3 : return SWT.KEYPAD_3;
+ case com.jogamp.newt.event.KeyEvent.VK_NUMPAD4 : return SWT.KEYPAD_4;
+ case com.jogamp.newt.event.KeyEvent.VK_NUMPAD5 : return SWT.KEYPAD_5;
+ case com.jogamp.newt.event.KeyEvent.VK_NUMPAD6 : return SWT.KEYPAD_6;
+ case com.jogamp.newt.event.KeyEvent.VK_NUMPAD7 : return SWT.KEYPAD_7;
+ case com.jogamp.newt.event.KeyEvent.VK_NUMPAD8 : return SWT.KEYPAD_8;
+ case com.jogamp.newt.event.KeyEvent.VK_NUMPAD9 : return SWT.KEYPAD_9;
+ case com.jogamp.newt.event.KeyEvent.VK_DECIMAL : return SWT.KEYPAD_DECIMAL;
+ case com.jogamp.newt.event.KeyEvent.VK_ADD : return SWT.KEYPAD_ADD;
+ case com.jogamp.newt.event.KeyEvent.VK_SUBTRACT : return SWT.KEYPAD_SUBTRACT;
+ case com.jogamp.newt.event.KeyEvent.VK_MULTIPLY : return SWT.KEYPAD_MULTIPLY;
+ case com.jogamp.newt.event.KeyEvent.VK_DIVIDE : return SWT.KEYPAD_DIVIDE;
+ case com.jogamp.newt.event.KeyEvent.VK_NUM_LOCK : return SWT.NUM_LOCK;
+ case com.jogamp.newt.event.KeyEvent.VK_KP_LEFT :
+ case com.jogamp.newt.event.KeyEvent.VK_LEFT : return SWT.ARROW_LEFT;
+ case com.jogamp.newt.event.KeyEvent.VK_KP_UP :
+ case com.jogamp.newt.event.KeyEvent.VK_UP : return SWT.ARROW_UP;
+ case com.jogamp.newt.event.KeyEvent.VK_KP_RIGHT :
+ case com.jogamp.newt.event.KeyEvent.VK_RIGHT : return SWT.ARROW_RIGHT;
+ case com.jogamp.newt.event.KeyEvent.VK_KP_DOWN :
+ case com.jogamp.newt.event.KeyEvent.VK_DOWN : return SWT.ARROW_DOWN;
+ case com.jogamp.newt.event.KeyEvent.VK_HELP : return SWT.HELP;
+ }
+ return defSWTKeyCode;
+ }
+
+
public static final com.jogamp.newt.event.InputEvent createInputEvent(org.eclipse.swt.widgets.Event event, Object source) {
com.jogamp.newt.event.InputEvent res = createMouseEvent(event, source);
if(null == res) {
@@ -126,10 +261,11 @@ public class SWTNewtEventFactory {
}
final short type = eventTypeSWT2NEWT(event.type);
if( (short)0 != type ) {
- return new com.jogamp.newt.event.KeyEvent(
+ final short newtKeyCode = swtKeyCode2NewtKeyCode( event.keyCode );
+ return com.jogamp.newt.event.KeyEvent.create(
type, (null==source)?(Object)event.data:source, (0xFFFFFFFFL & (long)event.time),
swtModifiers2Newt(event.stateMask, false),
- (short)event.keyCode, (short)event.keyCode, event.character);
+ newtKeyCode, newtKeyCode, event.character);
}
return null; // no mapping ..
}