From 214151d94283913d717a5e117e5444efcfa63ca5 Mon Sep 17 00:00:00 2001 From: Brice Dutheil Date: Sat, 18 May 2024 23:24:54 +0200 Subject: [PATCH] fix: Properly fix the focus lost tooltip --- .../bric3/fireplace/ui/toolkit/FollowingTipService.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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 8c47e10..50dfa38 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 @@ -9,7 +9,7 @@ import java.awt.Graphics2D import java.awt.LayoutManager import java.awt.RenderingHints import java.awt.event.AWTEventListener -import java.awt.event.FocusEvent +import java.awt.event.FocusEvent.FOCUS_LOST import java.awt.event.MouseAdapter import java.awt.event.MouseEvent import java.awt.event.MouseEvent.MOUSE_DRAGGED @@ -17,6 +17,7 @@ import java.awt.event.MouseEvent.MOUSE_ENTERED import java.awt.event.MouseEvent.MOUSE_EXITED import java.awt.event.MouseEvent.MOUSE_MOVED import java.awt.event.MouseEvent.MOUSE_WHEEL +import java.awt.event.WindowEvent.WINDOW_LOST_FOCUS import java.util.* import javax.swing.* @@ -105,7 +106,7 @@ private class FollowingTip { } } - FocusEvent.FOCUS_LOST -> { + WINDOW_LOST_FOCUS, FOCUS_LOST -> { tipWindow.isVisible = false } @@ -131,6 +132,7 @@ private class FollowingTip { AWTEvent.MOUSE_EVENT_MASK or AWTEvent.MOUSE_MOTION_EVENT_MASK or AWTEvent.MOUSE_WHEEL_EVENT_MASK + or AWTEvent.WINDOW_FOCUS_EVENT_MASK or AWTEvent.FOCUS_EVENT_MASK ) }