File tree Expand file tree Collapse file tree 3 files changed +34
-6
lines changed
src/main/java/qupath/fx/dialogs Expand file tree Collapse file tree 3 files changed +34
-6
lines changed Original file line number Diff line number Diff line change 1+ ## v0.2.1
2+ - Improve Dialogs.getDefaultOwner() logic https://github.com/qupath/qupath-fxtras/pull/60
3+
4+ ## v0.2.0
5+ - Update gradle, version https://github.com/qupath/qupath-fxtras/pull/48
6+ - FXUtils commands to get stages https://github.com/qupath/qupath-fxtras/pull/47
7+ - Convert to kotlin https://github.com/qupath/qupath-fxtras/pull/49
8+ - Make the use of country codes optional https://github.com/qupath/qupath-fxtras/pull/50
9+ - Fix publishing https://github.com/qupath/qupath-fxtras/pull/51
10+ - Update version https://github.com/qupath/qupath-fxtras/pull/52
11+ - Improve file chooser behavior https://github.com/qupath/qupath-fxtras/pull/53
12+
13+ ## v0.1.7
14+ - Improve screen choice for input display https://github.com/qupath/qupath-fxtras/pull/44
15+
116## v0.1.6
217- Allow default directory to be set when prompting for a file with FileChoosers (https://github.com/qupath/qupath-fxtras/issues/40 )
318
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ plugins {
66
77base {
88 group = " io.github.qupath"
9- version = " 0.2.0 "
9+ version = " 0.2.1 "
1010 description = " Extra classes built on JavaFX that are used to help create the QuPath user interface. " +
1111 " These don't depend on other QuPath modules, so can be reused elsewhere."
1212}
Original file line number Diff line number Diff line change @@ -505,14 +505,27 @@ static Window getDefaultOwner() {
505505 .thenComparing (w -> w .isFocused () ? -1 : 1 ) // Prefer focused windows
506506 .thenComparing (w -> w == primaryWindow ) // Prefer the primary window
507507 .thenComparing (Dialogs ::getTitle ); // Finally sort by title
508- var owner = Window . getWindows (). stream ( )
509- . filter ( w -> !( w instanceof PopupWindow )) // Avoid popup windows (they don't work well as owners )
510- . sorted ( comparator )
511- . findFirst ( )
508+ // Avoid popup windows (they don't work well as owners )
509+ return Window . getWindows (). stream ( )
510+ . filter ( Dialogs :: maybeOwner )
511+ . min ( comparator )
512512 .orElse (primaryWindow );
513- return owner ;
514513 }
515514
515+ private static boolean maybeOwner (Window window ) {
516+ // Don't accept popup windows
517+ if (window instanceof PopupWindow || !window .isShowing ())
518+ return false ;
519+ // Only accept 'normal', decorated, non-transparent stages
520+ if (window instanceof Stage stage ) {
521+ return switch (stage .getStyle ()) {
522+ case UNDECORATED , TRANSPARENT , UTILITY -> false ;
523+ default -> true ;
524+ };
525+ }
526+ return true ;
527+ }
528+
516529 private static String getTitle (Window window ) {
517530 String title = null ;
518531 if (window instanceof Stage stage )
You can’t perform that action at this time.
0 commit comments