*/
private static final boolean debugThreads = false;
+ /**
+ * If true, emit events being processed to System.err.
+ */
+ private static final boolean debugEvents = false;
+
/**
* WidgetEventHandler is the main event consumer loop. There are at most
* two such threads in existence: the primary for normal case and a
*/
private void metaHandleEvent(final TInputEvent event) {
- /*
- System.err.printf(String.format("metaHandleEvents event: %s\n",
- event)); System.err.flush();
- */
+ if (debugEvents) {
+ System.err.printf(String.format("metaHandleEvents event: %s\n",
+ event)); System.err.flush();
+ }
if (quit) {
// Do no more processing if the application is already trying
*/
private void primaryHandleEvent(final TInputEvent event) {
- // System.err.printf("Handle event: %s\n", event);
+ if (debugEvents) {
+ System.err.printf("Handle event: %s\n", event);
+ }
// Special application-wide events -----------------------------------
mouse.setX(mouse.getX() - window.getX());
mouse.setY(mouse.getY() - window.getY());
}
- // System.err("TApplication dispatch event: %s\n", event);
+ if (debugEvents) {
+ System.err.printf("TApplication dispatch event: %s\n",
+ event);
+ }
window.handleEvent(event);
break;
}
return true;
}
- /*
- TODO
if (command.equals(cmShell)) {
- openTerminal(0, 0, TWindow.Flag.RESIZABLE);
+ openTerminal(0, 0, TWindow.RESIZABLE);
repaint = true;
return true;
}
- */
if (command.equals(cmTile)) {
tileWindows();
return true;
}
- /*
- TODO
- if (menu.id == TMenu.MID_SHELL) {
- openTerminal(0, 0, TWindow.Flag.RESIZABLE);
+ if (menu.getId() == TMenu.MID_SHELL) {
+ openTerminal(0, 0, TWindow.RESIZABLE);
repaint = true;
return true;
}
- */
if (menu.getId() == TMenu.MID_TILE) {
tileWindows();
int newWidth = (getScreen().getWidth() / a);
int newHeight1 = ((getScreen().getHeight() - 1) / b);
int newHeight2 = ((getScreen().getHeight() - 1) / (b + c));
- // System.err.printf("Z %s a %s b %s c %s newWidth %s newHeight1 %s newHeight2 %s",
- // z, a, b, c, newWidth, newHeight1, newHeight2);
List<TWindow> sorted = new LinkedList<TWindow>(windows);
Collections.sort(sorted);
return new TInputBox(this, title, caption, text);
}
+ /**
+ * Convenience function to open a terminal window.
+ *
+ * @param x column relative to parent
+ * @param y row relative to parent
+ * @return the terminal new window
+ */
+ public final TTerminalWindow openTerminal(final int x, final int y) {
+ return openTerminal(x, y, TWindow.RESIZABLE);
+ }
+
+ /**
+ * Convenience function to open a terminal window.
+ *
+ * @param x column relative to parent
+ * @param y row relative to parent
+ * @param flags mask of CENTERED, MODAL, or RESIZABLE
+ * @return the terminal new window
+ */
+ public final TTerminalWindow openTerminal(final int x, final int y,
+ final int flags) {
+
+ return new TTerminalWindow(this, x, y, flags);
+ }
+
}