git://git.nikiroo.be
/
fanfix.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix drawing glitch
[fanfix.git]
/
src
/
jexer
/
backend
/
SwingTerminal.java
diff --git
a/src/jexer/backend/SwingTerminal.java
b/src/jexer/backend/SwingTerminal.java
index 43c161f4d6091d16c1ed7ec4bc675d6e2a603c5a..a11c04edab2cd777411e5e8c183a143c5dce09d0 100644
(file)
--- a/
src/jexer/backend/SwingTerminal.java
+++ b/
src/jexer/backend/SwingTerminal.java
@@
-51,8
+51,8
@@
import java.awt.event.WindowListener;
import java.awt.geom.Rectangle2D;
import java.awt.image.BufferedImage;
import java.io.InputStream;
import java.awt.geom.Rectangle2D;
import java.awt.image.BufferedImage;
import java.io.InputStream;
+import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashMap;
-import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import javax.swing.JComponent;
import java.util.List;
import java.util.Map;
import javax.swing.JComponent;
@@
-98,7
+98,7
@@
public class SwingTerminal extends LogicalScreen
/**
* The terminus font resource filename.
*/
/**
* The terminus font resource filename.
*/
- p
rivate
static final String FONTFILE = "terminus-ttf-4.39/TerminusTTF-Bold-4.39.ttf";
+ p
ublic
static final String FONTFILE = "terminus-ttf-4.39/TerminusTTF-Bold-4.39.ttf";
/**
* Cursor style to draw.
/**
* Cursor style to draw.
@@
-411,7
+411,7
@@
public class SwingTerminal extends LogicalScreen
mouse1 = false;
mouse2 = false;
mouse3 = false;
mouse1 = false;
mouse2 = false;
mouse3 = false;
- eventQueue = new
Linked
List<TInputEvent>();
+ eventQueue = new
Array
List<TInputEvent>();
// Add listeners to Swing.
swing.addKeyListener(this);
// Add listeners to Swing.
swing.addKeyListener(this);
@@
-525,7
+525,7
@@
public class SwingTerminal extends LogicalScreen
mouse1 = false;
mouse2 = false;
mouse3 = false;
mouse1 = false;
mouse2 = false;
mouse3 = false;
- eventQueue = new
Linked
List<TInputEvent>();
+ eventQueue = new
Array
List<TInputEvent>();
// Add listeners to Swing.
swing.addKeyListener(this);
// Add listeners to Swing.
swing.addKeyListener(this);
@@
-567,6
+567,7
@@
public class SwingTerminal extends LogicalScreen
&& (swing.getBufferStrategy() != null)
) {
do {
&& (swing.getBufferStrategy() != null)
) {
do {
+ clearPhysical();
do {
drawToSwing();
} while (swing.getBufferStrategy().contentsRestored());
do {
drawToSwing();
} while (swing.getBufferStrategy().contentsRestored());
@@
-714,6
+715,15
@@
public class SwingTerminal extends LogicalScreen
return blinkMillis;
}
return blinkMillis;
}
+ /**
+ * Get the current status of the blink flag.
+ *
+ * @return true if the cursor and blinking text should be visible
+ */
+ public boolean getCursorBlinkVisible() {
+ return cursorBlinkVisible;
+ }
+
/**
* Get the font size in points.
*
/**
* Get the font size in points.
*
@@
-881,7
+891,7
@@
public class SwingTerminal extends LogicalScreen
* @param attr the text attributes
* @return the Swing Color
*/
* @param attr the text attributes
* @return the Swing Color
*/
- p
rivate
Color attrToForegroundColor(final CellAttributes attr) {
+ p
ublic static
Color attrToForegroundColor(final CellAttributes attr) {
int rgb = attr.getForeColorRGB();
if (rgb >= 0) {
int red = (rgb >> 16) & 0xFF;
int rgb = attr.getForeColorRGB();
if (rgb >= 0) {
int red = (rgb >> 16) & 0xFF;
@@
-938,7
+948,7
@@
public class SwingTerminal extends LogicalScreen
* @param attr the text attributes
* @return the Swing Color
*/
* @param attr the text attributes
* @return the Swing Color
*/
- p
rivate
Color attrToBackgroundColor(final CellAttributes attr) {
+ p
ublic static
Color attrToBackgroundColor(final CellAttributes attr) {
int rgb = attr.getBackColorRGB();
if (rgb >= 0) {
int red = (rgb >> 16) & 0xFF;
int rgb = attr.getBackColorRGB();
if (rgb >= 0) {
int red = (rgb >> 16) & 0xFF;
@@
-1101,6
+1111,7
@@
public class SwingTerminal extends LogicalScreen
@Override
public void resizeToScreen() {
swing.setDimensions(textWidth * width, textHeight * height);
@Override
public void resizeToScreen() {
swing.setDimensions(textWidth * width, textHeight * height);
+ clearPhysical();
}
/**
}
/**
@@
-1841,9
+1852,9
@@
public class SwingTerminal extends LogicalScreen
* @param event window event received
*/
public void windowClosing(final WindowEvent event) {
* @param event window event received
*/
public void windowClosing(final WindowEvent event) {
- // Drop a cm
Abor
t and walk away
+ // Drop a cm
BackendDisconnec
t and walk away
synchronized (eventQueue) {
synchronized (eventQueue) {
- eventQueue.add(new TCommandEvent(cm
Abor
t));
+ eventQueue.add(new TCommandEvent(cm
BackendDisconnec
t));
resetBlinkTimer();
}
if (listener != null) {
resetBlinkTimer();
}
if (listener != null) {
@@
-1933,6
+1944,12
@@
public class SwingTerminal extends LogicalScreen
return;
}
return;
}
+ if (sessionInfo == null) {
+ // This is the initial component resize in construction, bail
+ // out.
+ return;
+ }
+
// Drop a new TResizeEvent into the queue
sessionInfo.queryWindowSize();
synchronized (eventQueue) {
// Drop a new TResizeEvent into the queue
sessionInfo.queryWindowSize();
synchronized (eventQueue) {