Popup: no longer use popup.show() for already visible popup window to avoid that inactive owner window becomes active (issue #1037)
Some checks failed
CI / build (11) (push) Has been cancelled
CI / build-on (17, ) (push) Has been cancelled
CI / build-on (21, ) (push) Has been cancelled
CI / build-on (23, ) (push) Has been cancelled
CI / build-on (8, ) (push) Has been cancelled
CI / snapshot (push) Has been cancelled
CI / release (push) Has been cancelled

This commit is contained in:
Karl Tauber
2025-09-09 20:00:26 +02:00
parent d079741f94
commit b3c9638e47
2 changed files with 11 additions and 1 deletions

View File

@@ -13,6 +13,8 @@ FlatLaf Change Log
#### Fixed bugs
- Tree and List: Fixed painting of rounded drop backgrounds. (issue #1023)
- Popup: Showing tooltip in inactive window brought that window to front (made
it active) and potentially hid the previously active window. (issue #1037)
- macOS: Fixed window "flashing" when switching from a light to a dark theme (or
vice versa). Especially when using animated theme changer (see
[FlatLaf Extras](flatlaf-extras)).

View File

@@ -546,7 +546,15 @@ public class FlatPopupFactory
int x = popupWindow.getX();
int y = popupWindow.getY();
popup.show();
if( !popupWindow.isVisible() )
popup.show();
else {
// if the popup window is already visible (because it is reused),
// do not invoke Popup.show() because this would invoke Window.toFront(),
// which may have the side effect that an inactive owner window
// would be also moved to front and maybe hide previously active window
popupWindow.pack();
}
// restore popup window location if it has changed
// (probably scaled when screens use different scale factors)