changeset 424:09c1d3aae3f0

updateDirty before testChanged, try to eliminate sending duplicate screenChanged to the monitor
author Carl Byington <carl@five-ten-sg.com>
date Fri, 31 Oct 2014 12:40:09 -0700
parents 76efe8fa29b9
children b284b8f9e535
files src/com/five_ten_sg/connectbot/service/TerminalMonitor.java src/org/tn5250j/framework/tn5250/Screen5250.java src/org/tn5250j/framework/tn5250/tnvt.java
diffstat 3 files changed, 21 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/src/com/five_ten_sg/connectbot/service/TerminalMonitor.java	Fri Oct 31 08:58:00 2014 -0700
+++ b/src/com/five_ten_sg/connectbot/service/TerminalMonitor.java	Fri Oct 31 12:40:09 2014 -0700
@@ -42,6 +42,21 @@
     public  static final char MONITOR_CMD_SWITCHSESSION = 10;
     public  static final char MONITOR_CMD_CURSORREQUEST = 11;
 
+    public  static final String[] commands = {
+        "cmd_init",
+        "cmd_activate",
+        "cmd_keystate",
+        "cmd_cursormove",
+        "cmd_screenchange",
+        "cmd_fieldvalue/setfield",
+        "cmd_getfield",
+        "cmd_screenwatch",
+        "cmd_depress",
+        "cmd_showurl",
+        "cmd_switchsession",
+        "cmd_cursorrequest"
+    };
+
     public  static final char CURSOR_REQUESTED      = 0;
     public  static final char CURSOR_SCREEN_CHANGE  = 1;
     public  static final char CURSOR_USER_KEY       = 2;
@@ -330,8 +345,9 @@
             if (monitor_out != null) {
                 c[0] = (char)(c.length - 1);    // number of chars following
                 c[1] = cmd;
-                //Log.i(TAG, String.format("sending %d command", (int)cmd));
+                Log.i(TAG, String.format("sending %s", commands[cmd]));
                 monitor_out.write(charsToBytes(c));
+                monitor_out.flush();
             }
             else {
                 c[1] = cmd;
--- a/src/org/tn5250j/framework/tn5250/Screen5250.java	Fri Oct 31 08:58:00 2014 -0700
+++ b/src/org/tn5250j/framework/tn5250/Screen5250.java	Fri Oct 31 12:40:09 2014 -0700
@@ -3450,7 +3450,7 @@
     private void xx_flush() {
         if (xx_length > 0) {
             char[] p = new char[xx_length];
-            System.arraycopy(xx_pending, 0, p, xx_length);
+            System.arraycopy(xx_pending, 0, p, 0, xx_length);
             Log.i(TAG, String.format("row %d col %d %s", getRow(xx_position), getCol(xx_position), new String(p)));
         }
         xx_length = 0;
--- a/src/org/tn5250j/framework/tn5250/tnvt.java	Fri Oct 31 08:58:00 2014 -0700
+++ b/src/org/tn5250j/framework/tn5250/tnvt.java	Fri Oct 31 12:40:09 2014 -0700
@@ -167,7 +167,6 @@
     private boolean pendingUnlock = false;
     private boolean[] dataIncluded;
     protected ICodePage codePage;
-    private boolean firstScreen;
     private String sslType;
     private WTDSFParser sfParser;
     private TerminalBridge bridge;
@@ -362,8 +361,7 @@
 
             if (bout != null) bout.close();
 
-            connected   = false;
-            firstScreen = false;
+            connected  = false;
             // WVL - LDC : TR.000345 : properly disconnect and clear screen
             // Is this the right place to set screen realestate on disconnect?
             //controller.getScreen().clearAll();
@@ -821,6 +819,7 @@
             screen52.getOIA().setInputInhibited(ScreenOIA.INPUTINHIBITED_NOTINHIBITED,
                                                 ScreenOIA.OIA_LEVEL_INPUT_INHIBITED);
         invited = true;
+        screen52.updateDirty();
         buffer.testChanged();
     }
 
@@ -972,6 +971,7 @@
                 Object e = dsq.take();
 
                 if ((e instanceof Integer) && ((Integer)e == 0)) {
+                    screen52.updateDirty();
                     buffer.testChanged();
                     continue;
                 };
@@ -1011,12 +1011,6 @@
                     Log.d(TAG, "Put/Get Operation");
                     parseIncoming();
                     setInvited();
-
-                    if (!firstScreen) {
-                        firstScreen = true;
-                        //controller.fireSessionChanged(TN5250jConstants.STATE_CONNECTED);
-                    }
-
                     break;
 
                 case 4: