changeset 175:2a7199ad90be

send cursor movement caused by user keystrokes to the monitor
author Carl Byington <carl@five-ten-sg.com>
date Wed, 02 Jul 2014 10:13:15 -0700
parents b010f9dc801f
children 6e07ea418b90
files src/com/five_ten_sg/connectbot/service/TerminalMonitor.java src/com/five_ten_sg/connectbot/transport/AbsTransport.java src/com/five_ten_sg/connectbot/transport/TN5250.java src/de/mud/terminal/vt320.java
diffstat 4 files changed, 102 insertions(+), 52 deletions(-) [+]
line wrap: on
line diff
--- a/src/com/five_ten_sg/connectbot/service/TerminalMonitor.java	Tue Jul 01 20:53:08 2014 -0700
+++ b/src/com/five_ten_sg/connectbot/service/TerminalMonitor.java	Wed Jul 02 10:13:15 2014 -0700
@@ -424,7 +424,7 @@
     public synchronized void depress(int vk_key) {
         Log.i(TAG, String.format("depress() %d", vk_key));
         Integer x = keymap.get(new Integer(vk_key));
-        if (x != null) buffer.keyPressed(x, ' ', 0);
+        if (x != null) buffer.keyDepressed(x, ' ', 0);
     }
 
     public synchronized void switchSession() {
--- a/src/com/five_ten_sg/connectbot/transport/AbsTransport.java	Tue Jul 01 20:53:08 2014 -0700
+++ b/src/com/five_ten_sg/connectbot/transport/AbsTransport.java	Wed Jul 02 10:13:15 2014 -0700
@@ -145,8 +145,6 @@
             super.setCursorPosition(c, l);
         }
 
-        // monitor setField()
-
     };
 
 
--- a/src/com/five_ten_sg/connectbot/transport/TN5250.java	Tue Jul 01 20:53:08 2014 -0700
+++ b/src/com/five_ten_sg/connectbot/transport/TN5250.java	Wed Jul 02 10:13:15 2014 -0700
@@ -101,6 +101,18 @@
             mnemonics.put(KEY_F10         , "[pf10]");
             mnemonics.put(KEY_F11         , "[pf11]");
             mnemonics.put(KEY_F12         , "[pf12]");
+            mnemonics.put(KEY_F13         , "[pf13]");
+            mnemonics.put(KEY_F14         , "[pf14]");
+            mnemonics.put(KEY_F15         , "[pf15]");
+            mnemonics.put(KEY_F16         , "[pf16]");
+            mnemonics.put(KEY_F17         , "[pf17]");
+            mnemonics.put(KEY_F18         , "[pf18]");
+            mnemonics.put(KEY_F19         , "[pf19]");
+            mnemonics.put(KEY_F20         , "[pf20]");
+            mnemonics.put(KEY_F21         , "[pf21]");
+            mnemonics.put(KEY_F22         , "[pf22]");
+            mnemonics.put(KEY_F23         , "[pf23]");
+            mnemonics.put(KEY_F24         , "[pf24]");
             mnemonics.put(KEY_UP          , "[up]");
             mnemonics.put(KEY_DOWN        , "[down]");
             mnemonics.put(KEY_LEFT        , "[left]");
@@ -146,6 +158,15 @@
             screen52.setField(l, c, data);
         }
 
+        // monitor simulating key depress
+        @Override
+        public void keyDepressed(int keyCode, char keyChar, int modifiers) {
+            if (mnemonics.containsKey(keyCode)) {
+                String s = mnemonics.get(keyCode);
+                if (s != "") screen52.sendKeys(s);
+            }
+        }
+
         // terminal key listener found special key, send notification to monitor
         @Override
         public void monitorKey(boolean down) {
@@ -156,19 +177,20 @@
         @Override
         public void write(byte[] b) {
             screen52.sendKeys(new String(b));
+            testChanged();
         }
         @Override
         public void write(int b) {
             if (controls.containsKey(b)) keyPressed(controls.get(b), ' ', 0);
             else                         screen52.sendKeys(new String(new byte[] {(byte)b}));
+            testChanged();
         }
         @Override
         public void keyPressed(int keyCode, char keyChar, int modifiers) {
-            if (mnemonics.containsKey(keyCode)) {
-                String s = mnemonics.get(keyCode);
-                if (s != "") screen52.sendKeys(s);
-            }
+            keyDepressed(keyCode, keyChar, modifiers);
+            testChanged();
         }
+
         // 5250 writing to the screen
         // test for changed screen contents
         @Override
--- a/src/de/mud/terminal/vt320.java	Tue Jul 01 20:53:08 2014 -0700
+++ b/src/de/mud/terminal/vt320.java	Wed Jul 02 10:13:15 2014 -0700
@@ -82,6 +82,10 @@
         // do nothing
     }
 
+    public void keyDepressed(int keyCode, char keyChar, int modifiers) {
+        keyPressed(keyCode, keyChar, modifiers);
+    }
+
     /**
      * Play the beep sound ...
      */
@@ -715,51 +719,63 @@
     private final static int TSTATE_TITLE = 18; /* xterm title */
 
     /* Keys we support */
-    public final static int KEY_PAUSE = 1;
-    public final static int KEY_F1 = 2;
-    public final static int KEY_F2 = 3;
-    public final static int KEY_F3 = 4;
-    public final static int KEY_F4 = 5;
-    public final static int KEY_F5 = 6;
-    public final static int KEY_F6 = 7;
-    public final static int KEY_F7 = 8;
-    public final static int KEY_F8 = 9;
-    public final static int KEY_F9 = 10;
-    public final static int KEY_F10 = 11;
-    public final static int KEY_F11 = 12;
-    public final static int KEY_F12 = 13;
-    public final static int KEY_UP = 14;
-    public final static int KEY_DOWN = 15 ;
-    public final static int KEY_LEFT = 16;
-    public final static int KEY_RIGHT = 17;
-    public final static int KEY_PAGE_DOWN = 18;
-    public final static int KEY_PAGE_UP = 19;
-    public final static int KEY_INSERT = 20;
-    public final static int KEY_DELETE = 21;
-    public final static int KEY_BACK_SPACE = 22;
-    public final static int KEY_HOME = 23;
-    public final static int KEY_END = 24;
-    public final static int KEY_NUM_LOCK = 25;
-    public final static int KEY_CAPS_LOCK = 26;
-    public final static int KEY_SHIFT = 27;
-    public final static int KEY_CONTROL = 28;
-    public final static int KEY_ALT = 29;
-    public final static int KEY_ENTER = 30;
-    public final static int KEY_NUMPAD0 = 31;
-    public final static int KEY_NUMPAD1 = 32;
-    public final static int KEY_NUMPAD2 = 33;
-    public final static int KEY_NUMPAD3 = 34;
-    public final static int KEY_NUMPAD4 = 35;
-    public final static int KEY_NUMPAD5 = 36;
-    public final static int KEY_NUMPAD6 = 37;
-    public final static int KEY_NUMPAD7 = 38;
-    public final static int KEY_NUMPAD8 = 39;
-    public final static int KEY_NUMPAD9 = 40;
-    public final static int KEY_DECIMAL = 41;
-    public final static int KEY_ADD     = 42;
-    public final static int KEY_ESCAPE  = 43;
-    public final static int KEY_TAB     = 44;
-    public final static int KEY_SYSREQ  = 45;   // only used by tn5250
+    public final static int KEY_PAUSE      = 1;
+    public final static int KEY_F1         = 2;
+    public final static int KEY_F2         = 3;
+    public final static int KEY_F3         = 4;
+    public final static int KEY_F4         = 5;
+    public final static int KEY_F5         = 6;
+    public final static int KEY_F6         = 7;
+    public final static int KEY_F7         = 8;
+    public final static int KEY_F8         = 9;
+    public final static int KEY_F9         = 10;
+    public final static int KEY_F10        = 11;
+    public final static int KEY_F11        = 12;
+    public final static int KEY_F12        = 13;
+    public final static int KEY_F13        = 14;    // only used by tn5250
+    public final static int KEY_F14        = 15;    // only used by tn5250
+    public final static int KEY_F15        = 16;    // only used by tn5250
+    public final static int KEY_F16        = 17;    // only used by tn5250
+    public final static int KEY_F17        = 18;    // only used by tn5250
+    public final static int KEY_F18        = 19;    // only used by tn5250
+    public final static int KEY_F19        = 20;    // only used by tn5250
+    public final static int KEY_F20        = 21;    // only used by tn5250
+    public final static int KEY_F21        = 22;    // only used by tn5250
+    public final static int KEY_F22        = 23;    // only used by tn5250
+    public final static int KEY_F23        = 24;    // only used by tn5250
+    public final static int KEY_F24        = 25;    // only used by tn5250
+    public final static int KEY_UP         = 26;
+    public final static int KEY_DOWN       = 27;
+    public final static int KEY_LEFT       = 28;
+    public final static int KEY_RIGHT      = 29;
+    public final static int KEY_PAGE_DOWN  = 30;
+    public final static int KEY_PAGE_UP    = 31;
+    public final static int KEY_INSERT     = 32;
+    public final static int KEY_DELETE     = 33;
+    public final static int KEY_BACK_SPACE = 34;
+    public final static int KEY_HOME       = 35;
+    public final static int KEY_END        = 36;
+    public final static int KEY_NUM_LOCK   = 37;
+    public final static int KEY_CAPS_LOCK  = 38;
+    public final static int KEY_SHIFT      = 39;
+    public final static int KEY_CONTROL    = 40;
+    public final static int KEY_ALT        = 41;
+    public final static int KEY_ENTER      = 42;
+    public final static int KEY_NUMPAD0    = 43;
+    public final static int KEY_NUMPAD1    = 44;
+    public final static int KEY_NUMPAD2    = 45;
+    public final static int KEY_NUMPAD3    = 46;
+    public final static int KEY_NUMPAD4    = 47;
+    public final static int KEY_NUMPAD5    = 48;
+    public final static int KEY_NUMPAD6    = 49;
+    public final static int KEY_NUMPAD7    = 50;
+    public final static int KEY_NUMPAD8    = 51;
+    public final static int KEY_NUMPAD9    = 52;
+    public final static int KEY_DECIMAL    = 53;
+    public final static int KEY_ADD        = 54;
+    public final static int KEY_ESCAPE     = 55;
+    public final static int KEY_TAB        = 56;
+    public final static int KEY_SYSREQ     = 57;    // only used by tn5250
 
     public final static int DELETE_IS_DEL = 0;
     public final static int DELETE_IS_BACKSPACE = 1;
@@ -1046,6 +1062,20 @@
                 writeSpecial(fmap[12]);
                 break;
 
+            case KEY_F13:
+            case KEY_F14:
+            case KEY_F15:
+            case KEY_F16:
+            case KEY_F17:
+            case KEY_F18:
+            case KEY_F19:
+            case KEY_F20:
+            case KEY_F21:
+            case KEY_F22:
+            case KEY_F23:
+            case KEY_F24:
+                break;
+
             case KEY_UP:
                 writeSpecial(KeyUp[xind]);
                 break;