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
TEditor 50% complete
[nikiroo-utils.git]
/
src
/
jexer
/
backend
/
SwingTerminal.java
diff --git
a/src/jexer/backend/SwingTerminal.java
b/src/jexer/backend/SwingTerminal.java
index c2fbfb437eae6b54f43f4b0a497d703b45f0d950..b7a16249d49dda32af22bf5f053c8c02e6f99a3e 100644
(file)
--- a/
src/jexer/backend/SwingTerminal.java
+++ b/
src/jexer/backend/SwingTerminal.java
@@
-500,7
+500,6
@@
public final class SwingTerminal extends LogicalScreen
// monospace.
textHeight = fm.getMaxAscent() + maxDescent - leading;
// monospace.
textHeight = fm.getMaxAscent() + maxDescent - leading;
- // TODO: is this still necessary?
if (gotTerminus == true) {
textHeight++;
}
if (gotTerminus == true) {
textHeight++;
}
@@
-658,6
+657,16
@@
public final class SwingTerminal extends LogicalScreen
}
}
}
}
+ /**
+ * Reset the blink timer.
+ */
+ private void resetBlinkTimer() {
+ // See if it is time to flip the blink time.
+ long nowTime = (new Date()).getTime();
+ lastBlinkTime = nowTime;
+ cursorBlinkVisible = true;
+ }
+
/**
* Paint redraws the whole screen.
*
/**
* Paint redraws the whole screen.
*
@@
-1069,9
+1078,9
@@
public final class SwingTerminal extends LogicalScreen
// Pull the system property for triple buffering.
if (System.getProperty("jexer.Swing.tripleBuffer") != null) {
// Pull the system property for triple buffering.
if (System.getProperty("jexer.Swing.tripleBuffer") != null) {
- if (System.getProperty("jexer.Swing.tripleBuffer").
- equals("false")) {
-
+ if (System.getProperty("jexer.Swing.tripleBuffer").
equals("true")) {
+ SwingComponent.tripleBuffer = true;
+ } else {
SwingComponent.tripleBuffer = false;
}
}
SwingComponent.tripleBuffer = false;
}
}
@@
-1142,7
+1151,8
@@
public final class SwingTerminal extends LogicalScreen
SwingTerminal.this.sessionInfo =
new SwingSessionInfo(SwingTerminal.this.swing,
SwingTerminal.this.textWidth,
SwingTerminal.this.sessionInfo =
new SwingSessionInfo(SwingTerminal.this.swing,
SwingTerminal.this.textWidth,
- SwingTerminal.this.textHeight);
+ SwingTerminal.this.textHeight,
+ windowWidth, windowHeight);
SwingTerminal.this.setDimensions(sessionInfo.getWindowWidth(),
sessionInfo.getWindowHeight());
SwingTerminal.this.setDimensions(sessionInfo.getWindowWidth(),
sessionInfo.getWindowHeight());
@@
-1171,7
+1181,7
@@
public final class SwingTerminal extends LogicalScreen
}
/**
}
/**
- * Public constructor
creates a new JFrame to render to
.
+ * Public constructor
renders to an existing JComponent
.
*
* @param component the Swing component to render to
* @param windowWidth the number of text columns to start with
*
* @param component the Swing component to render to
* @param windowWidth the number of text columns to start with
@@
-1539,9
+1549,12
@@
public final class SwingTerminal extends LogicalScreen
// Save it and we are done.
synchronized (eventQueue) {
eventQueue.add(new TKeypressEvent(keypress));
// Save it and we are done.
synchronized (eventQueue) {
eventQueue.add(new TKeypressEvent(keypress));
+ resetBlinkTimer();
}
}
- synchronized (listener) {
- listener.notifyAll();
+ if (listener != null) {
+ synchronized (listener) {
+ listener.notifyAll();
+ }
}
}
}
}
@@
-1575,9
+1588,12
@@
public final class SwingTerminal extends LogicalScreen
// Drop a cmAbort and walk away
synchronized (eventQueue) {
eventQueue.add(new TCommandEvent(cmAbort));
// Drop a cmAbort and walk away
synchronized (eventQueue) {
eventQueue.add(new TCommandEvent(cmAbort));
+ resetBlinkTimer();
}
}
- synchronized (listener) {
- listener.notifyAll();
+ if (listener != null) {
+ synchronized (listener) {
+ listener.notifyAll();
+ }
}
}
}
}
@@
-1663,9
+1679,12
@@
public final class SwingTerminal extends LogicalScreen
TResizeEvent windowResize = new TResizeEvent(TResizeEvent.Type.SCREEN,
sessionInfo.getWindowWidth(), sessionInfo.getWindowHeight());
eventQueue.add(windowResize);
TResizeEvent windowResize = new TResizeEvent(TResizeEvent.Type.SCREEN,
sessionInfo.getWindowWidth(), sessionInfo.getWindowHeight());
eventQueue.add(windowResize);
+ resetBlinkTimer();
}
}
- synchronized (listener) {
- listener.notifyAll();
+ if (listener != null) {
+ synchronized (listener) {
+ listener.notifyAll();
+ }
}
}
}
}
@@
-1699,9
+1718,12
@@
public final class SwingTerminal extends LogicalScreen
synchronized (eventQueue) {
eventQueue.add(mouseEvent);
synchronized (eventQueue) {
eventQueue.add(mouseEvent);
+ resetBlinkTimer();
}
}
- synchronized (listener) {
- listener.notifyAll();
+ if (listener != null) {
+ synchronized (listener) {
+ listener.notifyAll();
+ }
}
}
}
}
@@
-1725,9
+1747,12
@@
public final class SwingTerminal extends LogicalScreen
synchronized (eventQueue) {
eventQueue.add(mouseEvent);
synchronized (eventQueue) {
eventQueue.add(mouseEvent);
+ resetBlinkTimer();
}
}
- synchronized (listener) {
- listener.notifyAll();
+ if (listener != null) {
+ synchronized (listener) {
+ listener.notifyAll();
+ }
}
}
}
}
@@
-1788,9
+1813,12
@@
public final class SwingTerminal extends LogicalScreen
synchronized (eventQueue) {
eventQueue.add(mouseEvent);
synchronized (eventQueue) {
eventQueue.add(mouseEvent);
+ resetBlinkTimer();
}
}
- synchronized (listener) {
- listener.notifyAll();
+ if (listener != null) {
+ synchronized (listener) {
+ listener.notifyAll();
+ }
}
}
}
}
@@
-1833,9
+1861,12
@@
public final class SwingTerminal extends LogicalScreen
synchronized (eventQueue) {
eventQueue.add(mouseEvent);
synchronized (eventQueue) {
eventQueue.add(mouseEvent);
+ resetBlinkTimer();
}
}
- synchronized (listener) {
- listener.notifyAll();
+ if (listener != null) {
+ synchronized (listener) {
+ listener.notifyAll();
+ }
}
}
}
}
@@
-1877,9
+1908,12
@@
public final class SwingTerminal extends LogicalScreen
synchronized (eventQueue) {
eventQueue.add(mouseEvent);
synchronized (eventQueue) {
eventQueue.add(mouseEvent);
+ resetBlinkTimer();
}
}
- synchronized (listener) {
- listener.notifyAll();
+ if (listener != null) {
+ synchronized (listener) {
+ listener.notifyAll();
+ }
}
}
}
}