File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11# A part of NonVisual Desktop Access (NVDA)
2- # Copyright (C) 2008-2021 NV Access Limited
2+ # Copyright (C) 2008-2024 NV Access Limited, Cyrille Bougot
33# This file is covered by the GNU General Public License.
44# See the file COPYING for more details.
55
2525import exceptions
2626import NVDAHelper
2727import NVDAState
28+ from NVDAObjects .window import Window
2829
2930
3031def __getattr__ (attrName : str ) -> Any :
@@ -205,12 +206,13 @@ def _shouldRecoverAfterMinTimeout():
205206 return True
206207 if winUser .getClassName (info .hwndFocus ) in safeWindowClassSet :
207208 return False
208- if not winUser .isDescendantWindow (info .hwndActive , api .getFocusObject ().windowHandle ):
209+ focus = api .getFocusObject ()
210+ if (not isinstance (focus , Window )) or (not winUser .isDescendantWindow (info .hwndActive , focus .windowHandle )):
209211 # The foreground window has changed.
210212 return True
211213 newHwnd = info .hwndFocus
212214 newThreadID = winUser .getWindowThreadProcessID (newHwnd )[1 ]
213- return newThreadID != api . getFocusObject () .windowThreadID
215+ return newThreadID != focus .windowThreadID
214216
215217def _recoverAttempt ():
216218 try :
You can’t perform that action at this time.
0 commit comments