changeset 422:651aff5a46c7

synchronize font size listeners; log get/set field values
author Carl Byington <carl@five-ten-sg.com>
date Thu, 30 Oct 2014 16:27:31 -0700
parents 660ac2d2003b
children 76efe8fa29b9
files src/com/five_ten_sg/connectbot/service/TerminalBridge.java src/com/five_ten_sg/connectbot/service/TerminalMonitor.java src/org/tn5250j/framework/tn5250/Screen5250.java
diffstat 3 files changed, 17 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/com/five_ten_sg/connectbot/service/TerminalBridge.java	Wed Oct 29 18:03:42 2014 -0700
+++ b/src/com/five_ten_sg/connectbot/service/TerminalBridge.java	Thu Oct 30 16:27:31 2014 -0700
@@ -459,8 +459,10 @@
         // refresh any bitmap with new font size
         if (parent != null) parentChanged(parent);
 
-        for (FontSizeChangedListener ofscl : fontSizeChangedListeners)
-            ofscl.onFontSizeChanged(size);
+        synchronized(fontSizeChangedListeners) {
+            for (FontSizeChangedListener ofscl : fontSizeChangedListeners)
+                ofscl.onFontSizeChanged(size);
+        }
 
         host.setFontSize(size);
         manager.hostdb.updateFontSize(host);
@@ -474,7 +476,9 @@
      *            listener to add
      */
     public void addFontSizeChangedListener(FontSizeChangedListener listener) {
-        fontSizeChangedListeners.add(listener);
+        synchronized(fontSizeChangedListeners) {
+            fontSizeChangedListeners.add(listener);
+        }
     }
 
     /**
@@ -484,7 +488,9 @@
      * @param listener
      */
     public void removeFontSizeChangedListener(FontSizeChangedListener listener) {
-        fontSizeChangedListeners.remove(listener);
+        synchronized(fontSizeChangedListeners) {
+            fontSizeChangedListeners.remove(listener);
+        }
     }
 
     /**
--- a/src/com/five_ten_sg/connectbot/service/TerminalMonitor.java	Wed Oct 29 18:03:42 2014 -0700
+++ b/src/com/five_ten_sg/connectbot/service/TerminalMonitor.java	Thu Oct 30 16:27:31 2014 -0700
@@ -433,6 +433,7 @@
         int len = data.length - offset;
         char[] da = new char[len];
         System.arraycopy(data, offset, da, 0, len);
+        Log.i(TAG, String.format("setField(line %d, col %d, value %s)", l, c, new String(da)));
 
         if ((l > 60000) || (c > 60000)) {
             l = -1;
@@ -456,7 +457,7 @@
     }
 
     public synchronized void getField(int l, int c, int len) {
-        Log.i(TAG, "getField()");
+        Log.i(TAG, String.format("getField(line %d, col %d, len %d)", l, c, len));
         char[] arg2 = new char[4 + len];
         arg2[2] = (char)(l & 0x0000ffff);
         arg2[3] = (char)(c & 0x0000ffff);
@@ -469,6 +470,10 @@
             System.arraycopy(buffer.charArray[buffer.screenBase + l], c, arg2, base, len);
         }
 
+        char[] da = new char[len];
+        System.arraycopy(arg2, base, da, 0, len);
+        Log.i(TAG, String.format("getField value %s", new String(da)));
+
         monitorWrite(MONITOR_CMD_FIELDVALUE, arg2);
     }
 
--- a/src/org/tn5250j/framework/tn5250/Screen5250.java	Wed Oct 29 18:03:42 2014 -0700
+++ b/src/org/tn5250j/framework/tn5250/Screen5250.java	Thu Oct 30 16:27:31 2014 -0700
@@ -3444,6 +3444,7 @@
     }
 
     protected void setChar(int cByte) {
+        //if (cByte != 0) Log.i(TAG, String.format("%d %c %d", lastPos, cByte, cByte));
         if (lastPos > 0) {
             lastAttr = planes.getCharAttr(lastPos - 1);
         }