X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fjexer%2Ftterminal%2FECMA48.java;h=d148b39ba00e8d88d906bb9b998e73564903229b;hb=039b29a58df4744e72d88546cac77dcdd9754ad2;hp=df157cf4af9bbdee13e7dcd245e45a1a12c1f767;hpb=e7083f0b935964ca5a04835187397ff117941044;p=fanfix.git diff --git a/src/jexer/tterminal/ECMA48.java b/src/jexer/tterminal/ECMA48.java index df157cf..d148b39 100644 --- a/src/jexer/tterminal/ECMA48.java +++ b/src/jexer/tterminal/ECMA48.java @@ -1096,25 +1096,18 @@ public class ECMA48 implements Runnable { * @param mouse mouse event received from the local user */ public void mouse(final TMouseEvent mouse) { + /* - * TODO: - * - * - Parse the mouse requests from the remote side regarding protocol - * + encoding - * - * - Send mouse events to the other side. - * - * - Handle the cursor (double invert). + System.err.printf("mouse(): protocol %s encoding %s mouse %s\n", + mouseProtocol, mouseEncoding, mouse); */ - // System.err.printf("Mouse: %s\n", mouse); - - /* if (mouseEncoding != MouseEncoding.UTF8) { - // We only support UTF8 encoding, bail out now. - return; + // We will support X10 but only for (160,94) and smaller. + if ((mouse.getX() >= 160) || (mouse.getY() >= 94)) { + return; + } } - */ switch (mouseProtocol) { @@ -1165,7 +1158,9 @@ public class ECMA48 implements Runnable { sb.append((char) 0x1B); sb.append('['); sb.append('M'); - if (mouse.getMouse1()) { + if (mouse.getType() == TMouseEvent.Type.MOUSE_UP) { + sb.append((char) (0x03 + 32)); + } else if (mouse.getMouse1()) { sb.append((char) (0x00 + 32)); } else if (mouse.getMouse2()) { sb.append((char) (0x01 + 32)); @@ -3312,17 +3307,31 @@ public class ECMA48 implements Runnable { * DECSTBM - Set top and bottom margins. */ private void decstbm() { - int top = getCsiParam(0, 1, 1, height) - 1; - int bottom = getCsiParam(1, height, 1, height) - 1; + boolean decPrivateModeFlag = false; - if (top > bottom) { - top = bottom; + for (int i = 0; i < collectBuffer.length(); i++) { + if (collectBuffer.charAt(i) == '?') { + decPrivateModeFlag = true; + break; + } } - scrollRegionTop = top; - scrollRegionBottom = bottom; + if (decPrivateModeFlag) { + // This could be restore DEC private mode values. + // Ignore it. + } else { + // DECSTBM + int top = getCsiParam(0, 1, 1, height) - 1; + int bottom = getCsiParam(1, height, 1, height) - 1; - // Home cursor - cursorPosition(0, 0); + if (top > bottom) { + top = bottom; + } + scrollRegionTop = top; + scrollRegionBottom = bottom; + + // Home cursor + cursorPosition(0, 0); + } } /**