X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fjexer%2FTApplication.java;h=4c317f304d6bb82c6fc39684ce17be4ffc8b53ea;hb=9696a8f6da9a0d204740420d6d8571176ab81944;hp=41981daf3c3ca0e3943223534de125e0c943d835;hpb=e23ea53820244957b17a7000c6d3e1ff586f1ef0;p=fanfix.git diff --git a/src/jexer/TApplication.java b/src/jexer/TApplication.java index 41981da..4c317f3 100644 --- a/src/jexer/TApplication.java +++ b/src/jexer/TApplication.java @@ -1508,6 +1508,18 @@ public class TApplication implements Runnable { } } + /** + * Check if application is still running. + * + * @return true if the application is running + */ + public final boolean isRunning() { + if (quit == true) { + return false; + } + return true; + } + // ------------------------------------------------------------------------ // Screen refresh loop ---------------------------------------------------- // ------------------------------------------------------------------------ @@ -1522,7 +1534,26 @@ public class TApplication implements Runnable { if (debugThreads) { System.err.printf("%d %s invertCell() %d %d\n", System.currentTimeMillis(), Thread.currentThread(), x, y); + + if (activeWindow != null) { + System.err.println("activeWindow.hasHiddenMouse() " + + activeWindow.hasHiddenMouse()); + } + } + + // If this cell is on top of a visible window that has requested a + // hidden mouse, bail out. + if ((activeWindow != null) && (activeMenu == null)) { + if ((activeWindow.hasHiddenMouse() == true) + && (x > activeWindow.getX()) + && (x < activeWindow.getX() + activeWindow.getWidth() - 1) + && (y > activeWindow.getY()) + && (y < activeWindow.getY() + activeWindow.getHeight() - 1) + ) { + return; + } } + Cell cell = getScreen().getCharXY(x, y); if (cell.isImage()) { cell.invertImage(); @@ -1758,6 +1789,10 @@ public class TApplication implements Runnable { // Flush the screen contents if ((images.size() > 0) || getScreen().isDirty()) { + if (debugThreads) { + System.err.printf("%d %s backend.flushScreen()\n", + System.currentTimeMillis(), Thread.currentThread()); + } backend.flushScreen(); } @@ -1889,7 +1924,8 @@ public class TApplication implements Runnable { assert (!window.isActive()); if (activeWindow != null) { - assert (activeWindow.getZ() == 0); + // TODO: see if this assertion is really necessary. + // assert (activeWindow.getZ() == 0); activeWindow.setActive(false); @@ -2222,6 +2258,21 @@ public class TApplication implements Runnable { return false; } + /** + * Check if there is a window with overridden menu flag on top. + * + * @return true if the active window is overriding the menu + */ + private boolean overrideMenuWindowActive() { + if (activeWindow != null) { + if (activeWindow.hasOverriddenMenu()) { + return true; + } + } + + return false; + } + /** * Close all open windows. */ @@ -2552,6 +2603,7 @@ public class TApplication implements Runnable { if ((mouse.getType() == TMouseEvent.Type.MOUSE_DOWN) && (mouse.isMouse1()) && (!modalWindowActive()) + && (!overrideMenuWindowActive()) && (mouse.getAbsoluteY() == 0) ) { @@ -3298,7 +3350,7 @@ public class TApplication implements Runnable { public final TTerminalWindow openTerminal(final int x, final int y, final int flags, final String commandLine) { - return new TTerminalWindow(this, x, y, flags, commandLine.split("\\s")); + return new TTerminalWindow(this, x, y, flags, commandLine.split("\\s+")); } /** @@ -3315,7 +3367,7 @@ public class TApplication implements Runnable { public final TTerminalWindow openTerminal(final int x, final int y, final int flags, final String commandLine, final boolean closeOnExit) { - return new TTerminalWindow(this, x, y, flags, commandLine.split("\\s"), + return new TTerminalWindow(this, x, y, flags, commandLine.split("\\s+"), closeOnExit); }