X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fjexer%2FTWindow.java;h=ae3b85dd01fe8e2b0d7379836e14b833e2e792a6;hb=43ee96da86bb1a5d1f308a8499dabbbd8750dd80;hp=6763df3063640e5e2504dfa34d2e6f5bf6997b43;hpb=2bc32111fa17ae50a8aaa09ab347191fefc494a1;p=fanfix.git diff --git a/src/jexer/TWindow.java b/src/jexer/TWindow.java index 6763df3..ae3b85d 100644 --- a/src/jexer/TWindow.java +++ b/src/jexer/TWindow.java @@ -541,12 +541,6 @@ public class TWindow extends TWidget { } if (inWindowResize) { - // Do not permit resizing below the status line - if (mouse.getAbsoluteY() == application.getDesktopBottom()) { - inWindowResize = false; - return; - } - // Move window over setWidth(resizeWindowWidth + (mouse.getAbsoluteX() - moveWindowMouseX)); @@ -566,23 +560,22 @@ public class TWindow extends TWidget { // Keep within min/max bounds if (getWidth() < minimumWindowWidth) { setWidth(minimumWindowWidth); - inWindowResize = false; } if (getHeight() < minimumWindowHeight) { setHeight(minimumWindowHeight); - inWindowResize = false; } if ((maximumWindowWidth > 0) && (getWidth() > maximumWindowWidth) ) { setWidth(maximumWindowWidth); - inWindowResize = false; } if ((maximumWindowHeight > 0) && (getHeight() > maximumWindowHeight) ) { setHeight(maximumWindowHeight); - inWindowResize = false; + } + if (getHeight() + getY() >= getApplication().getDesktopBottom()) { + setHeight(getApplication().getDesktopBottom() - getY()); } // Pass a resize event to my children @@ -608,6 +601,15 @@ public class TWindow extends TWidget { @Override public void onKeypress(final TKeypressEvent keypress) { + if (inWindowMove || inWindowResize) { + // ESC or ENTER - Exit size/move + if (keypress.equals(kbEsc) || keypress.equals(kbEnter)) { + inWindowMove = false; + inWindowResize = false; + return; + } + } + if (inKeyboardResize) { // ESC or ENTER - Exit size/move @@ -1431,4 +1433,16 @@ public class TWindow extends TWidget { this.hideMouse = hideMouse; } + /** + * Generate a human-readable string for this window. + * + * @return a human-readable string + */ + @Override + public String toString() { + return String.format("%s(%8x) \'%s\' position (%d, %d) geometry %dx%d" + + " hidden %s modal %s", getClass().getName(), hashCode(), title, + getX(), getY(), getWidth(), getHeight(), hidden, isModal()); + } + }