apply upstream fixes

This commit is contained in:
yugecin
2017-01-29 22:55:11 +01:00
parent 1745ae73a1
commit c00b2b877a
4 changed files with 16 additions and 19 deletions

View File

@@ -96,7 +96,16 @@ public class TextField extends Component {
}
public void render(Graphics g) {
performKeyRepeat();
if (lastKey != -1) {
if (displayContainer.input.isKeyDown(lastKey)) {
if (repeatTimer < System.currentTimeMillis()) {
repeatTimer = System.currentTimeMillis() + KEY_REPEAT_INTERVAL;
keyPressed(lastKey, lastChar);
}
} else {
lastKey = -1;
}
}
Rectangle oldClip = g.getClip();
g.setWorldClip(x,y,width, height);
@@ -136,20 +145,6 @@ public class TextField extends Component {
g.setClip(oldClip);
}
public void performKeyRepeat() {
if (lastKey == -1) {
return;
}
if (!displayContainer.input.isKeyDown(lastKey)) {
lastKey = -1;
return;
}
if (repeatTimer < System.currentTimeMillis()) {
repeatTimer = System.currentTimeMillis() + KEY_REPEAT_INTERVAL;
keyPressed(lastKey, lastChar);
}
}
public String getText() {
return value;
}