changeset 143:63f0f0267545

testing key codes
author Carl Byington <carl@five-ten-sg.com>
date Sat, 21 Jun 2014 16:23:57 -0700
parents e66667cc2473
children 03af90a2f0a9
files src/com/five_ten_sg/connectbot/transport/TN5250.java
diffstat 1 files changed, 9 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/com/five_ten_sg/connectbot/transport/TN5250.java	Sat Jun 21 07:32:20 2014 -0700
+++ b/src/com/five_ten_sg/connectbot/transport/TN5250.java	Sat Jun 21 16:23:57 2014 -0700
@@ -62,6 +62,7 @@
     private tnvt       handler = null;
     private Socket     socket;
     private boolean    connected = false;
+    private TerminalKeyListener keyListener = null;
 
     static final Pattern hostmask;
     static {
@@ -146,7 +147,12 @@
         @Override
         public void write(byte[] b) {
             if (bridge.monitor != null) bridge.monitor.hostData(b);
-
+            if (b == 120) {
+                // special case x for testing
+                KeyEvent event = new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_F3);
+                keyListener.onKey(bridge.parent, event.getKeyCode(), event);
+                return;
+            }
             screen52.sendKeys(new String(b));
         }
         @Override
@@ -444,7 +450,8 @@
     }
 
     public TerminalKeyListener getTerminalKeyListener() {
-        return new TerminalKeyListener(manager, bridge, buffer, host.getEncoding());
+        keyListener = new TerminalKeyListener(manager, bridge, buffer, host.getEncoding());
+        return keyListener;
     }
 
 }