X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fjexer%2FTApplication.java;h=14ebacda7f4fa0a645c0958018d1bb8871f332e9;hb=6738825512004e0992555778e7124b568dd5044c;hp=9c9c5714c67cbad7eb7a093fe049644f88250b13;hpb=2bb26984bfcf482db4e4fc5fd2faea86004fc979;p=fanfix.git diff --git a/src/jexer/TApplication.java b/src/jexer/TApplication.java index 9c9c571..14ebacd 100644 --- a/src/jexer/TApplication.java +++ b/src/jexer/TApplication.java @@ -1100,8 +1100,8 @@ public class TApplication implements Runnable { oldMouseY = 0; } if (desktop != null) { - desktop.setDimensions(0, 0, resize.getWidth(), - resize.getHeight() - (hideStatusBar ? 0 : 1)); + desktop.setDimensions(0, desktopTop, resize.getWidth(), + (desktopBottom - desktopTop)); desktop.onResize(resize); } @@ -1296,6 +1296,8 @@ public class TApplication implements Runnable { } } else if (event instanceof TKeypressEvent) { dispatchToDesktop = false; + } else if (event instanceof TMenuEvent) { + dispatchToDesktop = false; } if (debugEvents) { @@ -1999,12 +2001,29 @@ public class TApplication implements Runnable { // Place the cursor if it is visible if (!menuIsActive) { + + int visibleWindowCount = 0; + for (TWindow window: sorted) { + if (window.isShown()) { + visibleWindowCount++; + } + } + if (visibleWindowCount == 0) { + // No windows are visible, only the desktop. Allow it to + // have the cursor. + if (desktop != null) { + sorted.add(desktop); + } + } + TWidget activeWidget = null; if (sorted.size() > 0) { activeWidget = sorted.get(sorted.size() - 1).getActiveChild(); + int cursorClipTop = desktopTop; + int cursorClipBottom = desktopBottom; if (activeWidget.isCursorVisible()) { - if ((activeWidget.getCursorAbsoluteY() < desktopBottom) - && (activeWidget.getCursorAbsoluteY() > desktopTop) + if ((activeWidget.getCursorAbsoluteY() <= cursorClipBottom) + && (activeWidget.getCursorAbsoluteY() >= cursorClipTop) ) { getScreen().putCursor(true, activeWidget.getCursorAbsoluteX(),