提交 e933aefe 编写于 作者: D dcherepanov

7156194: [macosx] Can't type non-ASCII characters into applets

Reviewed-by: anthony, art
上级 da96d0ce
......@@ -88,13 +88,20 @@ public class CEmbeddedFrame extends EmbeddedFrame {
responder.handleScrollEvent(x, y, modifierFlags, deltaX, deltaY);
}
public void handleKeyEvent(int eventType, int modifierFlags, String characters,
String charsIgnoringMods, boolean isRepeat, short keyCode,
boolean needsKeyTyped) {
responder.handleKeyEvent(eventType, modifierFlags, charsIgnoringMods, keyCode, needsKeyTyped);
}
// REMIND: delete this method once 'deploy' changes for 7156194 is pushed
public void handleKeyEvent(int eventType, int modifierFlags, String characters,
String charsIgnoringMods, boolean isRepeat, short keyCode) {
responder.handleKeyEvent(eventType, modifierFlags, charsIgnoringMods, keyCode);
handleKeyEvent(eventType, modifierFlags, characters, charsIgnoringMods, isRepeat, keyCode, true);
}
public void handleInputEvent(String text) {
new RuntimeException("Not implemented");
responder.handleInputEvent(text);
}
public void handleFocusEvent(boolean focused) {
......
......@@ -117,7 +117,7 @@ final class CPlatformResponder {
* Handles key events.
*/
void handleKeyEvent(int eventType, int modifierFlags, String chars,
short keyCode) {
short keyCode, boolean needsKeyTyped) {
boolean isFlagsChangedEvent =
isNpapiCallback ? (eventType == CocoaConstants.NPCocoaEventFlagsChanged) :
(eventType == CocoaConstants.NSFlagsChanged);
......@@ -173,6 +173,10 @@ final class CPlatformResponder {
peer.dispatchKeyEvent(jeventType, when, jmodifiers,
jkeyCode, javaChar, jkeyLocation);
// Current browser may be sending input events, so don't
// post the KEY_TYPED here.
postsTyped &= needsKeyTyped;
// That's the reaction on the PRESSED (not RELEASED) event as it comes to
// appear in MacOSX.
// Modifier keys (shift, etc) don't want to send TYPED events.
......@@ -185,4 +189,19 @@ final class CPlatformResponder {
KeyEvent.KEY_LOCATION_UNKNOWN);
}
}
void handleInputEvent(String text) {
if (text != null) {
int index = 0, length = text.length();
char c;
while (index < length) {
c = text.charAt(index);
peer.dispatchKeyEvent(KeyEvent.KEY_TYPED,
System.currentTimeMillis(),
0, KeyEvent.VK_UNDEFINED, c,
KeyEvent.KEY_LOCATION_UNKNOWN);
index++;
}
}
}
}
......@@ -199,7 +199,7 @@ public class CPlatformView extends CFRetainedResource {
private void deliverKeyEvent(NSEvent event) {
responder.handleKeyEvent(event.getType(), event.getModifierFlags(),
event.getCharactersIgnoringModifiers(), event.getKeyCode());
event.getCharactersIgnoringModifiers(), event.getKeyCode(), true);
}
private void deliverWindowDidExposeEvent() {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册