boolean (@NotNull WindowEvent event, @Nullable Window popup) { Window window = event.getWindow(); // the activated or focused window return window == null || popup == null || !SwingUtilities.isDescendingFrom(window, popup) && (myFocusable || !SwingUtilities.isDescendingFrom(popup, window)); }