*
* TODO: This isn't actually true, there could be paste events
* of only one character. Change this to check if the event was a clipboard
* event.
*/
inputElement.addEventListener(EVENT_TEXTINPUT, new EventListener() {
@Override
public void handleEvent(Event event) {
/*
* TODO: figure out best event to listen to. Tried "input",
* but see http://code.google.com/p/chromium/issues/detail?id=76516
*/
String text = ((TextEvent) event).getData();
if (text.length() <= 1) {
return;
}
setInputText("");
activeInputScheme.handleEvent(SignalEventUtils.create(event), text);
}
}, false);
if (BrowserUtils.isFirefox()) {
inputElement.addEventListener(Event.INPUT, new EventListener() {
@Override
public void handleEvent(Event event) {
/*
* TODO: FF doesn't support textInput, and Chrome's input
* is buggy.
*/
String text = getInputText();
if (text.length() <= 1) {
return;
}
setInputText("");
activeInputScheme.handleEvent(SignalEventUtils.create(event), text);
event.preventDefault();
event.stopPropagation();
}
}, false);
}
EventListener signalEventListener = new EventListener() {
@Override
public void handleEvent(Event event) {
SignalEvent signalEvent = SignalEventUtils.create(event);
if (signalEvent != null) {
processSignalEvent(signalEvent);