#38 notify backend of lost connection, version bump to 0.3.1
[fanfix.git] / src / jexer / backend / ECMA48Terminal.java
index afd153579e961c9637412a32faf73792394ac85f..d10437c1f49dd377bce18ac786b9ecfae3555357 100644 (file)
@@ -50,10 +50,12 @@ import jexer.TImage;
 import jexer.bits.Cell;
 import jexer.bits.CellAttributes;
 import jexer.bits.Color;
+import jexer.event.TCommandEvent;
 import jexer.event.TInputEvent;
 import jexer.event.TKeypressEvent;
 import jexer.event.TMouseEvent;
 import jexer.event.TResizeEvent;
+import static jexer.TCommand.*;
 import static jexer.TKeypress.*;
 
 /**
@@ -1472,8 +1474,15 @@ public class ECMA48Terminal extends LogicalScreen
             }
         } // while ((done == false) && (stopReaderThread == false))
 
-        // TODO: pass an event up to TApplication to tell it this Backend is
-        // done.
+        // Pass an event up to TApplication to tell it this Backend is done.
+        synchronized (eventQueue) {
+            eventQueue.add(new TCommandEvent(cmBackendDisconnect));
+        }
+        if (listener != null) {
+            synchronized (listener) {
+                listener.notifyAll();
+            }
+        }
 
         // System.err.println("*** run() exiting..."); System.err.flush();
     }