X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fjexer%2Fio%2FAWTTerminal.java;h=da521ddb0fc3c7fa435bef3ae8aee22d9b3217c3;hb=cf9af8df455c0ea5390e4c0ed2555506a051a379;hp=783cffd4ec5f1fba6e6cd2397dd70a37d380a2a5;hpb=e7083f0b935964ca5a04835187397ff117941044;p=fanfix.git diff --git a/src/jexer/io/AWTTerminal.java b/src/jexer/io/AWTTerminal.java index 783cffd..da521dd 100644 --- a/src/jexer/io/AWTTerminal.java +++ b/src/jexer/io/AWTTerminal.java @@ -92,9 +92,14 @@ public final class AWTTerminal implements ComponentListener, KeyListener, private List eventQueue; /** - * The reader thread. + * The last reported mouse X position. */ - private Thread readerThread; + private int oldMouseX = -1; + + /** + * The last reported mouse Y position. + */ + private int oldMouseY = -1; /** * true if mouse1 was down. Used to report mouse1 on the release event. @@ -202,7 +207,6 @@ public final class AWTTerminal implements ComponentListener, KeyListener, boolean ctrl = false; char ch = ' '; boolean isKey = false; - int fnKey = 0; if (key.isActionKey()) { isKey = true; } else { @@ -376,7 +380,7 @@ public final class AWTTerminal implements ComponentListener, KeyListener, break; default: if (!alt && ctrl && !shift) { - ch = key.getKeyText(key.getKeyCode()).charAt(0); + ch = KeyEvent.getKeyText(key.getKeyCode()).charAt(0); } // Not a special key, put it together keypress = new TKeypress(false, 0, ch, alt, ctrl, shift); @@ -566,6 +570,13 @@ public final class AWTTerminal implements ComponentListener, KeyListener, public void mouseMoved(final MouseEvent mouse) { int x = screen.textColumn(mouse.getX()); int y = screen.textRow(mouse.getY()); + if ((x == oldMouseX) && (y == oldMouseY)) { + // Bail out, we've moved some pixels but not a whole text cell. + return; + } + oldMouseX = x; + oldMouseY = y; + TMouseEvent mouseEvent = new TMouseEvent(TMouseEvent.Type.MOUSE_MOTION, x, y, x, y, mouse1, mouse2, mouse3, false, false);