summaryrefslogtreecommitdiffstats
path: root/src/test/com
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2013-07-03 23:06:43 +0200
committerSven Gothel <[email protected]>2013-07-03 23:06:43 +0200
commit4e6c2aadd7d652db3ba1f35eef1a3d61d6e692d0 (patch)
tree5dc85b39b77b8d4841b2dd75c0d626938c1bb49e /src/test/com
parent3856dcc14f0f27a37930ec3f085746ed91d72cff (diff)
Revise commit 4c34f5980bddcdc84b10cb3bcbb96b365b9d471e (Bug 767): TAB, BS and CR/ENTER are printable for NEWT KeyEvent and font handling. Fix regression.
- Original behavior was treating CR/ENTER them as printable, lets keep it this way. - KeyEvent: Query these 3 whitespaces upfront, no need to incl. them in 'nonPrintableKeys'. - Fix regression: Native VK_ENTER was not change in commit 4c34f5980bddcdc84b10cb3bcbb96b365b9d471e.
Diffstat (limited to 'src/test/com')
-rw-r--r--src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextRendererListenerBase01.java30
1 files changed, 16 insertions, 14 deletions
diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextRendererListenerBase01.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextRendererListenerBase01.java
index 31377025a..1dc104cbb 100644
--- a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextRendererListenerBase01.java
+++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextRendererListenerBase01.java
@@ -269,27 +269,27 @@ public abstract class GPUTextRendererListenerBase01 extends GPURendererListenerB
}
public class KeyAction implements KeyListener {
- public void keyPressed(KeyEvent arg0) {
+ public void keyPressed(KeyEvent e) {
if(userInput) {
return;
}
-
- if(arg0.getKeyCode() == KeyEvent.VK_3) {
+ final short s = e.getKeySymbol();
+ if(s == KeyEvent.VK_3) {
fontIncr(10);
}
- else if(arg0.getKeyCode() == KeyEvent.VK_4) {
+ else if(s == KeyEvent.VK_4) {
fontIncr(-10);
}
- else if(arg0.getKeyCode() == KeyEvent.VK_H) {
+ else if(s == KeyEvent.VK_H) {
switchHeadBox();
}
- else if(arg0.getKeyCode() == KeyEvent.VK_F) {
+ else if(s == KeyEvent.VK_F) {
drawFPS = !drawFPS;
}
- else if(arg0.getKeyCode() == KeyEvent.VK_SPACE) {
+ else if(s == KeyEvent.VK_SPACE) {
nextFontSet();
}
- else if(arg0.getKeyCode() == KeyEvent.VK_I) {
+ else if(s == KeyEvent.VK_I) {
userInput = true;
setIgnoreInput(true);
}
@@ -300,15 +300,17 @@ public abstract class GPUTextRendererListenerBase01 extends GPURendererListenerB
return;
}
if(userInput) {
- char c = e.getKeyChar();
-
- if(c == 0x0d) {
+ final short k = e.getKeySymbol();
+ if( KeyEvent.VK_ENTER == k ) {
userInput = false;
setIgnoreInput(false);
- } else if(c == 0x08 && userString.length()>0) {
+ } else if( KeyEvent.VK_BACK_SPACE == k && userString.length()>0) {
userString.deleteCharAt(userString.length()-1);
- } else if( font.isPrintableChar( c ) ) {
- userString.append(c);
+ } else {
+ final char c = e.getKeyChar();
+ if( font.isPrintableChar( c ) ) {
+ userString.append(c);
+ }
}
}
}