From: Kevin Lamonte Date: Sun, 11 Aug 2019 18:17:28 +0000 (-0500) Subject: #37 don't resize except initial and font change X-Git-Url: https://git.nikiroo.be/?a=commitdiff_plain;h=b4570a63cef669dc85335a7f8d571a5eefdfc3c7;p=fanfix-jexer.git #37 don't resize except initial and font change --- diff --git a/src/jexer/backend/SwingTerminal.java b/src/jexer/backend/SwingTerminal.java index f5d1544..d32cf1e 100644 --- a/src/jexer/backend/SwingTerminal.java +++ b/src/jexer/backend/SwingTerminal.java @@ -403,7 +403,7 @@ public class SwingTerminal extends LogicalScreen SwingTerminal.this.setDimensions(sessionInfo. getWindowWidth(), sessionInfo.getWindowHeight()); - SwingTerminal.this.resizeToScreen(); + SwingTerminal.this.resizeToScreen(true); SwingTerminal.this.swing.setVisible(true); } }); @@ -572,8 +572,8 @@ public class SwingTerminal extends LogicalScreen && (swing.getBufferStrategy() != null) ) { do { - clearPhysical(); do { + clearPhysical(); drawToSwing(); } while (swing.getBufferStrategy().contentsRestored()); @@ -761,7 +761,7 @@ public class SwingTerminal extends LogicalScreen swing.setFont(font); glyphCacheBlink = new HashMap(); glyphCache = new HashMap(); - resizeToScreen(); + resizeToScreen(true); } } @@ -1110,13 +1110,24 @@ public class SwingTerminal extends LogicalScreen gotFontDimensions = true; } + /** + * Resize the physical screen to match the logical screen dimensions. + * + * @param resizeComponent if true, resize the Swing component + */ + private void resizeToScreen(final boolean resizeComponent) { + if (resizeComponent) { + swing.setDimensions(textWidth * width, textHeight * height); + } + clearPhysical(); + } + /** * Resize the physical screen to match the logical screen dimensions. */ @Override public void resizeToScreen() { - swing.setDimensions(textWidth * width, textHeight * height); - clearPhysical(); + resizeToScreen(false); } /**