X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fjexer%2Fio%2FAWTTerminal.java;h=38f6734b96fcea4c8aac2c97cb5e774c636a7caa;hb=a90d3119be3030c35765a00d3cc149f61fd8f69e;hp=783cffd4ec5f1fba6e6cd2397dd70a37d380a2a5;hpb=e7083f0b935964ca5a04835187397ff117941044;p=fanfix.git diff --git a/src/jexer/io/AWTTerminal.java b/src/jexer/io/AWTTerminal.java index 783cffd..38f6734 100644 --- a/src/jexer/io/AWTTerminal.java +++ b/src/jexer/io/AWTTerminal.java @@ -96,6 +96,16 @@ public final class AWTTerminal implements ComponentListener, KeyListener, */ private Thread readerThread; + /** + * The last reported mouse X position. + */ + 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. */ @@ -566,6 +576,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);