OSDN Git Service

When tapping on the password field in the win8 logon dialog, make sure it gets focus...
authorMichael Curran <mick@kulgan.net>
Wed, 17 Oct 2012 06:04:00 +0000 (16:04 +1000)
committerMichael Curran <mick@kulgan.net>
Wed, 17 Oct 2012 06:04:00 +0000 (16:04 +1000)
source/appModules/logonui.py
source/globalCommands.py
source/touchHandler.py

index 0176074..60a6036 100644 (file)
@@ -12,6 +12,9 @@ from NVDAObjects.IAccessible import IAccessible
 from NVDAObjects.behaviors import Dialog\r
 import appModuleHandler\r
 import eventHandler\r
+import UIAHandler\r
+if UIAHandler.isUIAAvailable:\r
+       from NVDAObjects.UIA import UIA\r
 \r
 """App module for the Windows Logon screen\r
 """\r
@@ -32,6 +35,16 @@ class LogonDialog(Dialog):
 \r
                return super(LogonDialog, self).event_gainFocus()\r
 \r
+if UIAHandler.isUIAAvailable:\r
+       class Win8PasswordField(UIA):\r
+\r
+               #This UIA object has no invoke pattern, at least set focus.\r
+               def doAction(self,index=None):\r
+                       if not index:\r
+                               self.setFocus()\r
+                       else:\r
+                               super(Win8PasswordField,self).doAction(index)\r
+\r
 class XPPasswordField(IAccessible):\r
 \r
        def initOverlayClass(self):\r
@@ -68,6 +81,9 @@ class AppModule(appModuleHandler.AppModule):
        def chooseNVDAObjectOverlayClasses(self, obj, clsList):\r
                windowClass = obj.windowClassName\r
 \r
+               if UIAHandler.isUIAAvailable:\r
+                       if isinstance(obj,UIA) and obj.UIAElement.cachedClassName=="TouchEditInner" and obj.role==controlTypes.ROLE_EDITABLETEXT:\r
+                               clsList.insert(0,Win8PasswordField)\r
                if windowClass == "AUTHUI.DLL: LogonUI Logon Window" and obj.parent and obj.parent.parent and not obj.parent.parent.parent:\r
                        clsList.insert(0, LogonDialog)\r
                        return\r
index 54af705..9f3932b 100755 (executable)
@@ -427,6 +427,8 @@ class GlobalCommands(ScriptableObject):
                pos=api.getReviewPosition()\r
                try:\r
                        pos.activate()\r
+                       if isinstance(gesture,touchHandler.TouchInputGesture):\r
+                               touchHandler.handler.notifyInteraction(pos.NVDAObjectAtStart)\r
                        ui.message(actionName)\r
                        return\r
                except NotImplementedError:\r
@@ -435,6 +437,8 @@ class GlobalCommands(ScriptableObject):
                while obj:\r
                        try:\r
                                obj.doAction()\r
+                               if isinstance(gesture,touchHandler.TouchInputGesture):\r
+                                       touchHandler.handler.notifyInteraction(obj)\r
                                try:\r
                                        actionName=obj.getActionName()\r
                                except NotImplementedError:\r
index c37fe34..19fdbc9 100644 (file)
@@ -13,6 +13,7 @@ import inputCore
 import screenExplorer\r
 from logHandler import log\r
 import touchTracker\r
+import gui\r
 \r
 availableTouchModes=['text','object']\r
 \r
@@ -193,6 +194,16 @@ class TouchHandler(threading.Thread):
                                        pass\r
                        yield\r
 \r
+       def notifyInteraction(self, obj):\r
+               """Notify the system that UI interaction is occurring via touch.\r
+               This should be called when performing an action on an object.\r
+               @param obj: The NVDAObject with which the user is interacting.\r
+               @type obj: L{NVDAObjects.NVDAObject}\r
+               """\r
+               l, t, w, h = obj.location\r
+               oledll.oleacc.AccNotifyTouchInteraction(gui.mainFrame.Handle, obj.windowHandle,\r
+                       POINT(l + (w / 2), t + (h / 2)))\r
+\r
 handler=None\r
 \r
 def initialize():\r