NVDA with Japanese branch
リビジョン | 791d8b92064a5130cafc30bb99ac75f712816e59 (tree) |
---|---|
日時 | 2010-10-28 15:02:35 |
作者 | James Teh <jamie@jant...> |
コミッター | James Teh |
Fix access to some Windows Security dialogs such as the dialog that appears when installing unsigned drivers.
It seems that custom window messages cannot be sent to these dialogs, so sending our custom ping message returns an access denied error, which causes IAccessibleHandler.accessibleObjectFromEvent() to fail.
This custom ping message was implemented to fix Windows Live Messenger 2009 exiting on startup (#677). Instead, just use WM_NULL (which can be sent to these dialogs) and implement a specific condition to ignore the problematic event from Messenger.
@@ -358,7 +358,7 @@ def normalizeIAccessible(pacc): | ||
358 | 358 | |
359 | 359 | def accessibleObjectFromEvent(window,objectID,childID): |
360 | 360 | wmResult=c_long() |
361 | - if windll.user32.SendMessageTimeoutW(window,wmNVDAPing,0,0,winUser.SMTO_ABORTIFHUNG,2000,byref(wmResult))==0: | |
361 | + if windll.user32.SendMessageTimeoutW(window,winUser.WM_NULL,0,0,winUser.SMTO_ABORTIFHUNG,2000,byref(wmResult))==0: | |
362 | 362 | log.debugWarning("Window %d dead or not responding: %s" % (window, ctypes.WinError())) |
363 | 363 | return None |
364 | 364 | try: |
@@ -577,6 +577,11 @@ def winEventCallback(handle,eventID,window,objectID,childID,threadID,timestamp): | ||
577 | 577 | #We never want to see foreground events for the Program Manager or Shell (task bar) |
578 | 578 | if eventID==winUser.EVENT_SYSTEM_FOREGROUND and windowClassName in ("Progman","Shell_TrayWnd"): |
579 | 579 | return |
580 | + if eventID==winUser.EVENT_OBJECT_NAMECHANGE and windowClassName=="MSNHiddenWindowClass": | |
581 | + # HACK: This gets fired by Windows Live Messenger 2009 when it starts. | |
582 | + # If we send a WM_NULL to this window at this point (which happens in accessibleObjectFromEvent), Messenger will silently exit (#677). | |
583 | + # Therefore, completely ignore the event, which is useless to us anyway. | |
584 | + return | |
580 | 585 | winEventLimiter.addEvent(eventID,window,objectID,childID,threadID) |
581 | 586 | except: |
582 | 587 | log.error("winEventCallback", exc_info=True) |
@@ -801,13 +806,7 @@ def _fakeFocus(oldFocus): | ||
801 | 806 | #Register internal object event with IAccessible |
802 | 807 | cWinEventCallback=WINFUNCTYPE(None,c_int,c_int,c_int,c_int,c_int,c_int,c_int)(winEventCallback) |
803 | 808 | |
804 | -#: A window message used to determine whether a window is alive. | |
805 | -#: We use this instead of WM_NULL because Windows Live Messenger 2009 (and maybe other applications) barf if we send WM_NULL. | |
806 | -wmNVDAPing = None | |
807 | 809 | def initialize(): |
808 | - global wmNVDAPing | |
809 | - if not wmNVDAPing: | |
810 | - wmNVDAPing = windll.user32.RegisterWindowMessageW(u"NVDA ping") | |
811 | 810 | for eventType in winEventIDsToNVDAEventNames.keys(): |
812 | 811 | hookID=winUser.setWinEventHook(eventType,eventType,0,cWinEventCallback,0,0,0) |
813 | 812 | if hookID: |