X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fjexer%2FTTerminalWindow.java;h=d703b676007be0d256bc889bd1fa885addfc539c;hb=03ae544a1639c127ebec9a46635f2ad465713908;hp=818a52f6eb6bbccc20dfc45042cad9653ba1b7be;hpb=5fc7bf09f3c9987287f34f9035b522b0e5e9de13;p=fanfix.git diff --git a/src/jexer/TTerminalWindow.java b/src/jexer/TTerminalWindow.java index 818a52f..d703b67 100644 --- a/src/jexer/TTerminalWindow.java +++ b/src/jexer/TTerminalWindow.java @@ -550,13 +550,17 @@ public class TTerminalWindow extends TScrollableWindow return; } - if (mouse.isMouseWheelUp()) { - verticalDecrement(); - return; - } - if (mouse.isMouseWheelDown()) { - verticalIncrement(); - return; + // If the emulator is tracking mouse buttons, it needs to see wheel + // events. + if (emulator.getMouseProtocol() == ECMA48.MouseProtocol.OFF) { + if (mouse.isMouseWheelUp()) { + verticalDecrement(); + return; + } + if (mouse.isMouseWheelDown()) { + verticalIncrement(); + return; + } } if (mouseOnEmulator(mouse)) { synchronized (emulator) { @@ -763,20 +767,8 @@ public class TTerminalWindow extends TScrollableWindow newStatusBar(i18n.getString("statusBarRunning")); // Pass the correct text cell width/height to the emulator - int textWidth = 16; - int textHeight = 20; - if (getScreen() instanceof SwingTerminal) { - SwingTerminal terminal = (SwingTerminal) getScreen(); - - textWidth = terminal.getTextWidth(); - textHeight = terminal.getTextHeight(); - } else if (getScreen() instanceof ECMA48Terminal) { - ECMA48Terminal terminal = (ECMA48Terminal) getScreen(); - textWidth = terminal.getTextWidth(); - textHeight = terminal.getTextHeight(); - } - emulator.setTextWidth(textWidth); - emulator.setTextHeight(textHeight); + emulator.setTextWidth(getScreen().getTextWidth()); + emulator.setTextHeight(getScreen().getTextHeight()); } /** @@ -957,15 +949,12 @@ public class TTerminalWindow extends TScrollableWindow private void putDoubleWidthCharXY(final DisplayLine line, final int x, final int y, final Cell cell) { - int textWidth = 16; - int textHeight = 20; + int textWidth = getScreen().getTextWidth(); + int textHeight = getScreen().getTextHeight(); boolean cursorBlinkVisible = true; if (getScreen() instanceof SwingTerminal) { SwingTerminal terminal = (SwingTerminal) getScreen(); - - textWidth = terminal.getTextWidth(); - textHeight = terminal.getTextHeight(); cursorBlinkVisible = terminal.getCursorBlinkVisible(); } else if (getScreen() instanceof ECMA48Terminal) { ECMA48Terminal terminal = (ECMA48Terminal) getScreen(); @@ -977,9 +966,6 @@ public class TTerminalWindow extends TScrollableWindow putCharXY(x + 1, y, ' ', cell); return; } - - textWidth = terminal.getTextWidth(); - textHeight = terminal.getTextHeight(); cursorBlinkVisible = blinkState; } else { // We don't know how to dray glyphs to this screen, draw them as