X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fjexer%2Fio%2FAWTTerminal.java;h=38f6734b96fcea4c8aac2c97cb5e774c636a7caa;hb=a90d3119be3030c35765a00d3cc149f61fd8f69e;hp=27ba80aa12b7180accfd394e9c340627fe32a9f6;hpb=92554d64c21c6a477fd23a06ca3a64a542b622a3;p=nikiroo-utils.git diff --git a/src/jexer/io/AWTTerminal.java b/src/jexer/io/AWTTerminal.java index 27ba80a..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. */ @@ -219,7 +229,7 @@ public final class AWTTerminal implements ComponentListener, KeyListener, System.err.printf(" ctrl: %s\n", ctrl); System.err.printf(" shift: %s\n", shift); System.err.printf(" ch: %s\n", ch); - */ + */ // Special case: not return the bare modifier presses switch (key.getKeyCode()) { @@ -368,6 +378,9 @@ public final class AWTTerminal implements ComponentListener, KeyListener, case 0x0D: keypress = kbEnter; break; + case 0x09: + keypress = kbTab; + break; case 0x7F: keypress = kbDel; break; @@ -396,7 +409,10 @@ public final class AWTTerminal implements ComponentListener, KeyListener, */ @Override public void windowActivated(final WindowEvent event) { - // Ignore + // Force a total repaint + synchronized (screen) { + screen.clearPhysical(); + } } /** @@ -560,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);