X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=examples%2FJexerTilingWindowManager2.java;h=0e360b6d04c1d9e0e4d4dc1306992c111ff2ae01;hb=1e8647a978ba3c3966dbf8ae90eeae6612f403be;hp=e06119b2ba14ef5ae0b5183498b5752c84431b47;hpb=955c55b766a8aebb528d5af5f7582a857c72e2f5;p=nikiroo-utils.git diff --git a/examples/JexerTilingWindowManager2.java b/examples/JexerTilingWindowManager2.java index e06119b..0e360b6 100644 --- a/examples/JexerTilingWindowManager2.java +++ b/examples/JexerTilingWindowManager2.java @@ -1,12 +1,9 @@ -import java.util.ArrayList; import jexer.TAction; import jexer.TApplication; import jexer.TDesktop; -import jexer.TPanel; import jexer.TTerminalWidget; import jexer.TSplitPane; import jexer.TWidget; -import jexer.event.TKeypressEvent; import jexer.event.TMenuEvent; import jexer.menu.TMenu; @@ -59,7 +56,7 @@ public class JexerTilingWindowManager2 extends TApplication { * Public constructor chooses the ECMA-48 / Xterm backend. */ public JexerTilingWindowManager2() throws Exception { - super(BackendType.SWING); + super(BackendType.XTERM); // The stock tool menu has items for redrawing the screen, opening // images, and (when using the Swing backend) setting the font. @@ -73,16 +70,28 @@ public class JexerTilingWindowManager2 extends TApplication { tileMenu.addItem(MENU_SPLIT_HORIZONTAL, "&Horizontal Split"); tileMenu.addItem(MENU_RESPAWN_ROOT, "&Respawn Root Terminal"); - // Stock commands: a new shell with resizable window, previous, next, - // close, and exit program. - tileMenu.addItem(TMenu.MID_SHELL, "&Floating"); + // Stock commands: a new shell with resizable window, and exit + // program. tileMenu.addSeparator(); - tileMenu.addDefaultItem(TMenu.MID_WINDOW_PREVIOUS); - tileMenu.addDefaultItem(TMenu.MID_WINDOW_NEXT); - tileMenu.addDefaultItem(TMenu.MID_WINDOW_CLOSE); + tileMenu.addItem(TMenu.MID_SHELL, "&New Windowed Terminal"); tileMenu.addSeparator(); tileMenu.addDefaultItem(TMenu.MID_EXIT); + // TTerminalWidget can request the text-block mouse pointer be + // suppressed, but the default TDesktop will ignore it. Let's set a + // new TDesktop to pass that mouse pointer visibility option to + // TApplication. + setDesktop(new TDesktop(this) { + @Override + public boolean hasHiddenMouse() { + TWidget active = getActiveChild(); + if (active instanceof TTerminalWidget) { + return ((TTerminalWidget) active).hasHiddenMouse(); + } + return false; + } + }); + // Spin up the root terminal createRootTerminal(); } @@ -137,6 +146,8 @@ public class JexerTilingWindowManager2 extends TApplication { private void createRootTerminal() { assert (root == null); disableMenuItem(MENU_RESPAWN_ROOT); + enableMenuItem(MENU_SPLIT_VERTICAL); + enableMenuItem(MENU_SPLIT_HORIZONTAL); root = createTerminal(); } @@ -156,6 +167,10 @@ public class JexerTilingWindowManager2 extends TApplication { } else { source.getApplication().enableMenuItem( MENU_RESPAWN_ROOT); + source.getApplication().disableMenuItem( + MENU_SPLIT_VERTICAL); + source.getApplication().disableMenuItem( + MENU_SPLIT_HORIZONTAL); source.remove(); root = null; }