terminal/backend handshaking, no more polling
[nikiroo-utils.git] / src / jexer / backend / Backend.java
index 15fcf62620eff7254c73117d8fe8b9c02a521b59..256e9bb84f125353b8cedefb8a33022ad971a819 100644 (file)
@@ -32,6 +32,8 @@
  */
 package jexer.backend;
 
+import java.util.List;
+
 import jexer.event.TInputEvent;
 import jexer.io.Screen;
 import jexer.session.SessionInfo;
@@ -63,10 +65,11 @@ public abstract class Backend {
      * Subclasses must provide an implementation to get keyboard, mouse, and
      * screen resize events.
      *
-     * @param timeout maximum amount of time to wait for an event
-     * @return events received, or an empty list if the timeout was reached
+     * @param queue list to append new events to
+     * @param timeout maximum amount of time (in millis) to wait for an
+     * event.  0 means to return immediately, i.e. perform a poll.
      */
-    abstract public TInputEvent [] getEvents(int timeout);
+    abstract public void getEvents(List<TInputEvent> queue, int timeout);
 
     /**
      * Subclasses must provide an implementation that closes sockets,