From 7137cd97012dde699ebd549f543792ca61337cb2 Mon Sep 17 00:00:00 2001 From: Jakub Valtar Date: Mon, 17 Aug 2015 19:17:03 -0400 Subject: [PATCH] Emulate keyTyped for OpenGL sketches --- core/src/processing/opengl/PSurfaceJOGL.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/core/src/processing/opengl/PSurfaceJOGL.java b/core/src/processing/opengl/PSurfaceJOGL.java index cecfd0d0e..02ec8fa76 100644 --- a/core/src/processing/opengl/PSurfaceJOGL.java +++ b/core/src/processing/opengl/PSurfaceJOGL.java @@ -927,6 +927,19 @@ public class PSurfaceJOGL implements PSurface { keyCode); sketch.postEvent(ke); + + if (!isPCodedKey(code) && !isHackyKey(code)) { + if (peAction == KeyEvent.PRESS) { + // Create key typed event + // TODO: combine dead keys with the following key + KeyEvent tke = new KeyEvent(nativeEvent, nativeEvent.getWhen(), + KeyEvent.TYPE, peModifiers, + keyChar, + 0); + + sketch.postEvent(tke); + } + } } private static boolean isPCodedKey(short code) {