X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fjexer%2FTApplication.java;h=96dad6cc0b0cece1541d43dccab333b813f233d0;hb=84da64e71d6c5d9991e99ff47533d0fe14bd51ed;hp=ee2e9de86664a04a238070b40637dff35a393176;hpb=051e29138b18fb4b731a72f8727475b10e4c74e4;p=fanfix.git diff --git a/src/jexer/TApplication.java b/src/jexer/TApplication.java index ee2e9de..96dad6c 100644 --- a/src/jexer/TApplication.java +++ b/src/jexer/TApplication.java @@ -1125,8 +1125,14 @@ public class TApplication implements Runnable { } secondaryEventReceiver.handleEvent(event); - if (doubleClick != null) { - secondaryEventReceiver.handleEvent(doubleClick); + // Note that it is possible for secondaryEventReceiver to be null + // now, because its handleEvent() might have finished out on the + // secondary thread. So put any extra processing inside a null + // check. + if (secondaryEventReceiver != null) { + if (doubleClick != null) { + secondaryEventReceiver.handleEvent(doubleClick); + } } } @@ -1199,7 +1205,8 @@ public class TApplication implements Runnable { keepTimers.add(timer); } } - timers = keepTimers; + timers.clear(); + timers.addAll(keepTimers); } // Call onIdle's @@ -2056,6 +2063,9 @@ public class TApplication implements Runnable { } TWindow w = sorted.get(i); + int oldWidth = w.getWidth(); + int oldHeight = w.getHeight(); + w.setX(logicalX * newWidth); w.setWidth(newWidth); if (i >= ((a - 1) * b)) { @@ -2065,6 +2075,12 @@ public class TApplication implements Runnable { w.setY((logicalY * newHeight1) + 1); w.setHeight(newHeight1); } + if ((w.getWidth() != oldWidth) + || (w.getHeight() != oldHeight) + ) { + w.onResize(new TResizeEvent(TResizeEvent.Type.WIDGET, + w.getWidth(), w.getHeight())); + } } } } @@ -2854,6 +2870,22 @@ public class TApplication implements Runnable { return new TInputBox(this, title, caption, text); } + /** + * Convenience function to spawn an input box. + * + * @param title window title, will be centered along the top border + * @param caption message to display. Use embedded newlines to get a + * multi-line box. + * @param text initial text to seed the field with + * @param type one of the Type constants. Default is Type.OK. + * @return the new input box + */ + public final TInputBox inputBox(final String title, final String caption, + final String text, final TInputBox.Type type) { + + return new TInputBox(this, title, caption, text, type); + } + /** * Convenience function to open a terminal window. *