diff --git a/fireplace-app/src/main/kotlin/io/github/bric3/fireplace/ui/toolkit/FollowingTipService.kt b/fireplace-app/src/main/kotlin/io/github/bric3/fireplace/ui/toolkit/FollowingTipService.kt index 50dfa38..0b37973 100644 --- a/fireplace-app/src/main/kotlin/io/github/bric3/fireplace/ui/toolkit/FollowingTipService.kt +++ b/fireplace-app/src/main/kotlin/io/github/bric3/fireplace/ui/toolkit/FollowingTipService.kt @@ -69,6 +69,11 @@ private class FollowingTip { val component: Component when (e.id) { MOUSE_ENTERED, MOUSE_MOVED, MOUSE_DRAGGED, MOUSE_WHEEL -> { + // Don't bother to show tip if the owner window is not focused or active + if (!ownerWindow.isActive || !ownerWindow.isFocused) { + tipWindow.isVisible = false + return@AWTEventListener + } event = e as MouseEvent component = e.component if (ownerWindow.isAncestorOf(component) && component is JComponent) { @@ -85,7 +90,7 @@ private class FollowingTip { } val content = contentProvider?.invoke(component, event) - if (content == null) { + if (content == null || !ownerWindow.isActive || !ownerWindow.isFocused) { tipWindow.isVisible = false return@AWTEventListener } @@ -101,7 +106,7 @@ private class FollowingTip { event = e as MouseEvent component = e.component val p = SwingUtilities.convertPoint(component, event.point, ownerWindow) - if (!ownerWindow.contains(p)) { + if (!ownerWindow.contains(p) || !ownerWindow.isActive || !ownerWindow.isFocused) { tipWindow.isVisible = false } }