git://git.nikiroo.be
/
nikiroo-utils.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
mouse support inside terminal
[nikiroo-utils.git]
/
src
/
jexer
/
io
/
AWTTerminal.java
diff --git
a/src/jexer/io/AWTTerminal.java
b/src/jexer/io/AWTTerminal.java
index 27ba80aa12b7180accfd394e9c340627fe32a9f6..38f6734b96fcea4c8aac2c97cb5e774c636a7caa 100644
(file)
--- 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;
*/
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.
*/
/**
* 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);
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()) {
// 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 0x0D:
keypress = kbEnter;
break;
+ case 0x09:
+ keypress = kbTab;
+ break;
case 0x7F:
keypress = kbDel;
break;
case 0x7F:
keypress = kbDel;
break;
@@
-396,7
+409,10
@@
public final class AWTTerminal implements ComponentListener, KeyListener,
*/
@Override
public void windowActivated(final WindowEvent event) {
*/
@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());
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);
TMouseEvent mouseEvent = new TMouseEvent(TMouseEvent.Type.MOUSE_MOTION,
x, y, x, y, mouse1, mouse2, mouse3, false, false);