Changeset 2317

Show
Ignore:
Timestamp:
07/29/08 01:51:08 (4 months ago)
Author:
mdcurran
Message:

JABHandler: try and ignore duplicate focus events. Also ignore focus events for what seem to be broken java objects -- apart from NVDA saying unknown object, it also stuffs up focus ancestors quite badly. Now its a lot nicer to press f2 on a cell in Open Office Celc etc as NVDA no longer repeates lots of pointless information.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/source/JABHandler.py

    r2314 r2317  
    2222vmIDsToWindowHandles={} 
    2323internalFunctionQueue=Queue.Queue(1000) 
     24internalFunctionQueue.__name__="JABHandler.internalFunctionQueue" 
     25lastFocusNVDAObject=None 
    2426 
    2527def internalQueueFunction(func,*args,**kwargs): 
     
    261263 
    262264def event_gainFocus(vmID,accContext): 
     265        global lastFocusNVDAObject 
    263266        jabContext=JABContext(vmID=vmID,accContext=accContext) 
    264267        if not winUser.isDescendantWindow(winUser.getForegroundWindow(),jabContext.hwnd): 
    265268                return 
    266269        focus=api.getFocusObject() 
    267         if isinstance(focus,NVDAObjects.JAB.JAB) and focus.jabContext==jabContext: 
     270        if (isinstance(focus,NVDAObjects.JAB.JAB) and focus.jabContext==jabContext) or (lastFocusNVDAObject and lastFocusNVDAObject.jabContext==jabContext): 
    268271                return  
    269272        obj=NVDAObjects.JAB.JAB(jabContext=jabContext) 
     273        if obj.role==controlTypes.ROLE_UNKNOWN: 
     274                return 
    270275        eventHandler.queueEvent("gainFocus",obj) 
     276        lastFocusNVDAObject=obj 
    271277        activeChild=obj.activeChild 
    272         if activeChild: 
     278        if activeChild and activeChild.role!=controlTypes.ROLE_UNKNOWN and activeChild.jabContext!=jabContext: 
    273279                eventHandler.queueEvent("gainFocus",activeChild) 
     280                lastFocusNVDAObject=activeChild 
    274281 
    275282@CFUNCTYPE(c_voidp,c_int,c_int,c_int,c_int,c_int)