| 1 | /** |
| 2 | * Jexer - Java Text User Interface - demonstration program |
| 3 | * |
| 4 | * Version: $Id$ |
| 5 | * |
| 6 | * Author: Kevin Lamonte, <a href="mailto:kevin.lamonte@gmail.com">kevin.lamonte@gmail.com</a> |
| 7 | * |
| 8 | * License: LGPLv3 or later |
| 9 | * |
| 10 | * Copyright: This module is licensed under the GNU Lesser General |
| 11 | * Public License Version 3. Please see the file "COPYING" in this |
| 12 | * directory for more information about the GNU Lesser General Public |
| 13 | * License Version 3. |
| 14 | * |
| 15 | * Copyright (C) 2015 Kevin Lamonte |
| 16 | * |
| 17 | * This program is free software; you can redistribute it and/or |
| 18 | * modify it under the terms of the GNU Lesser General Public License |
| 19 | * as published by the Free Software Foundation; either version 3 of |
| 20 | * the License, or (at your option) any later version. |
| 21 | * |
| 22 | * This program is distributed in the hope that it will be useful, but |
| 23 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 24 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 25 | * General Public License for more details. |
| 26 | * |
| 27 | * You should have received a copy of the GNU Lesser General Public |
| 28 | * License along with this program; if not, see |
| 29 | * http://www.gnu.org/licenses/, or write to the Free Software |
| 30 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA |
| 31 | * 02110-1301 USA |
| 32 | */ |
| 33 | package jexer; |
| 34 | |
| 35 | /** |
| 36 | * TApplication sets up a full Text User Interface application. |
| 37 | */ |
| 38 | public class TApplication { |
| 39 | |
| 40 | /** |
| 41 | * Run this application until it exits, using stdin and stdout |
| 42 | */ |
| 43 | final public void run() { |
| 44 | |
| 45 | /* |
| 46 | while (quit == false) { |
| 47 | |
| 48 | // Timeout is in milliseconds, so default timeout after 1 |
| 49 | // second of inactivity. |
| 50 | uint timeout = getSleepTime(1000); |
| 51 | // std.stdio.stderr.writefln("poll() timeout: %d", timeout); |
| 52 | |
| 53 | if (eventQueue.length > 0) { |
| 54 | // Do not wait if there are definitely events waiting to be |
| 55 | // processed or a screen redraw to do. |
| 56 | timeout = 0; |
| 57 | } |
| 58 | |
| 59 | // Pull any pending input events |
| 60 | TInputEvent [] events = backend.getEvents(timeout); |
| 61 | metaHandleEvents(events); |
| 62 | |
| 63 | // Process timers and call doIdle()'s |
| 64 | doIdle(); |
| 65 | |
| 66 | // Update the screen |
| 67 | drawAll(); |
| 68 | } |
| 69 | |
| 70 | // Shutdown the fibers |
| 71 | eventQueue.length = 0; |
| 72 | if (secondaryEventFiber !is null) { |
| 73 | assert(secondaryEventReceiver !is null); |
| 74 | secondaryEventReceiver = null; |
| 75 | if (secondaryEventFiber.state == Fiber.State.HOLD) { |
| 76 | // Wake up the secondary handler so that it can exit. |
| 77 | secondaryEventFiber.call(); |
| 78 | } |
| 79 | } |
| 80 | |
| 81 | if (primaryEventFiber.state == Fiber.State.HOLD) { |
| 82 | // Wake up the primary handler so that it can exit. |
| 83 | primaryEventFiber.call(); |
| 84 | } |
| 85 | |
| 86 | backend.shutdown(); |
| 87 | */ |
| 88 | |
| 89 | System.out.println("Hello"); |
| 90 | } |
| 91 | } |