Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ public boolean isMouseActivationStroke(KeyStroke keyStroke) {
isMouseActivation = action.getActionType() == MouseActionType.CLICK_DOWN;
}

return isMouseActivation;
return isFocused() && isMouseActivation;
}

public boolean isActivationStroke(KeyStroke keyStroke) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -382,8 +382,14 @@ protected synchronized void ifMouseDownPossiblyChangeActiveWindow(KeyStroke keyS
List<Window> snapshot = new ArrayList<>(getWindows());
for (Window w : snapshot) {
w.getBounds().whenContains(mouse.getPosition(), () -> {
setActiveWindow(w);
anyHit.set(true);
// Only change active window if the active MODAL dialog or if
// window is not MODAL
if (!priorActiveWindow.getHints().contains(Hint.MODAL) ||
(priorActiveWindow.getHints().contains(Hint.MODAL) && w == priorActiveWindow))
{
setActiveWindow(w);
anyHit.set(true);
}
});
}
// clear popup menus if they clicked onto another window or missed all windows
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public MessageDialogBuilder() {
this.buttons = new ArrayList<>();
this.extraWindowHints = new HashSet<>();
this.extraWindowHints.add(Window.Hint.CENTERED);
this.extraWindowHints.add(Window.Hint.MODAL);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import com.googlecode.lanterna.TestTerminalFactory;
import com.googlecode.lanterna.gui2.dialogs.*;
import com.googlecode.lanterna.screen.Screen;
import com.googlecode.lanterna.terminal.MouseCaptureMode;

import java.io.File;
import java.io.IOException;
Expand All @@ -33,7 +34,7 @@
*/
public class DialogsTextGUIBasicTest {
public static void main(String[] args) throws IOException {
Screen screen = new TestTerminalFactory(args).createScreen();
Screen screen = new TestTerminalFactory(args).setMouseCaptureMode(MouseCaptureMode.CLICK_AUTODETECT).createScreen();
screen.startScreen();
final WindowBasedTextGUI textGUI = new MultiWindowTextGUI(screen);
try {
Expand Down