mirror of
https://github.com/ankitects/anki.git
synced 2026-01-05 18:13:56 -05:00
added new app.focusWindow() check that might work on windows
This commit is contained in:
parent
53eb33fafe
commit
a1a50659d8
1 changed files with 4 additions and 1 deletions
|
|
@ -1109,10 +1109,13 @@ def tooltip(
|
|||
def close_if_parent_inactive() -> None:
|
||||
if not _tooltipLabel or window is None:
|
||||
return
|
||||
# Check if window is still active and application has focus
|
||||
app_has_focus = aqt.mw.app.focusWindow() is not None
|
||||
window_is_active = window.isActiveWindow()
|
||||
if (
|
||||
not window.isVisible()
|
||||
or (window.windowState() & Qt.WindowState.WindowMinimized)
|
||||
or (was_active and not window.isActiveWindow())
|
||||
or (was_active and (not window_is_active or not app_has_focus))
|
||||
):
|
||||
closeTooltip()
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue