X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fjexer%2Fbackend%2FSwingTerminal.java;h=6e902195fa59d40a8306fc1f27a713440992c364;hb=3e0743556d1f31723a11a6019b5c2b018b4b2104;hp=c2fbfb437eae6b54f43f4b0a497d703b45f0d950;hpb=d79f1f31b1c036712b4e7f0bbfde980f212c3a3a;p=nikiroo-utils.git diff --git a/src/jexer/backend/SwingTerminal.java b/src/jexer/backend/SwingTerminal.java index c2fbfb4..6e90219 100644 --- 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; - // TODO: is this still necessary? if (gotTerminus == true) { textHeight++; } @@ -1069,9 +1068,9 @@ public final class SwingTerminal extends LogicalScreen // 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; } } @@ -1142,7 +1141,8 @@ public final class SwingTerminal extends LogicalScreen 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()); @@ -1171,7 +1171,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 @@ -1540,8 +1540,10 @@ public final class SwingTerminal extends LogicalScreen synchronized (eventQueue) { eventQueue.add(new TKeypressEvent(keypress)); } - synchronized (listener) { - listener.notifyAll(); + if (listener != null) { + synchronized (listener) { + listener.notifyAll(); + } } } @@ -1576,8 +1578,10 @@ public final class SwingTerminal extends LogicalScreen synchronized (eventQueue) { eventQueue.add(new TCommandEvent(cmAbort)); } - synchronized (listener) { - listener.notifyAll(); + if (listener != null) { + synchronized (listener) { + listener.notifyAll(); + } } } @@ -1664,8 +1668,10 @@ public final class SwingTerminal extends LogicalScreen sessionInfo.getWindowWidth(), sessionInfo.getWindowHeight()); eventQueue.add(windowResize); } - synchronized (listener) { - listener.notifyAll(); + if (listener != null) { + synchronized (listener) { + listener.notifyAll(); + } } } @@ -1700,8 +1706,10 @@ public final class SwingTerminal extends LogicalScreen synchronized (eventQueue) { eventQueue.add(mouseEvent); } - synchronized (listener) { - listener.notifyAll(); + if (listener != null) { + synchronized (listener) { + listener.notifyAll(); + } } } @@ -1726,8 +1734,10 @@ public final class SwingTerminal extends LogicalScreen synchronized (eventQueue) { eventQueue.add(mouseEvent); } - synchronized (listener) { - listener.notifyAll(); + if (listener != null) { + synchronized (listener) { + listener.notifyAll(); + } } } @@ -1789,8 +1799,10 @@ public final class SwingTerminal extends LogicalScreen synchronized (eventQueue) { eventQueue.add(mouseEvent); } - synchronized (listener) { - listener.notifyAll(); + if (listener != null) { + synchronized (listener) { + listener.notifyAll(); + } } } @@ -1834,8 +1846,10 @@ public final class SwingTerminal extends LogicalScreen synchronized (eventQueue) { eventQueue.add(mouseEvent); } - synchronized (listener) { - listener.notifyAll(); + if (listener != null) { + synchronized (listener) { + listener.notifyAll(); + } } } @@ -1878,8 +1892,10 @@ public final class SwingTerminal extends LogicalScreen synchronized (eventQueue) { eventQueue.add(mouseEvent); } - synchronized (listener) { - listener.notifyAll(); + if (listener != null) { + synchronized (listener) { + listener.notifyAll(); + } } }