From 1516f96d262909868d79f97b89931773f9722720 Mon Sep 17 00:00:00 2001 From: Michael Curran Date: Wed, 17 Oct 2012 16:04:00 +1000 Subject: [PATCH] When tapping on the password field in the win8 logon dialog, make sure it gets focus, and also make sure that the onscreen keyboard appears. Specifically: implement doAction 0 for this object to do setFocus (this UIA object has no invoke pattern) and also in globalCommands's review_activate script call accNotifyTouchInteraction if this was a touch gesture, so that this is communicated to Windows. --- source/appModules/logonui.py | 16 ++++++++++++++++ source/globalCommands.py | 4 ++++ source/touchHandler.py | 11 +++++++++++ 3 files changed, 31 insertions(+) diff --git a/source/appModules/logonui.py b/source/appModules/logonui.py index 0176074bc..60a6036ca 100644 --- a/source/appModules/logonui.py +++ b/source/appModules/logonui.py @@ -12,6 +12,9 @@ from NVDAObjects.IAccessible import IAccessible from NVDAObjects.behaviors import Dialog import appModuleHandler import eventHandler +import UIAHandler +if UIAHandler.isUIAAvailable: + from NVDAObjects.UIA import UIA """App module for the Windows Logon screen """ @@ -32,6 +35,16 @@ class LogonDialog(Dialog): return super(LogonDialog, self).event_gainFocus() +if UIAHandler.isUIAAvailable: + class Win8PasswordField(UIA): + + #This UIA object has no invoke pattern, at least set focus. + def doAction(self,index=None): + if not index: + self.setFocus() + else: + super(Win8PasswordField,self).doAction(index) + class XPPasswordField(IAccessible): def initOverlayClass(self): @@ -68,6 +81,9 @@ class AppModule(appModuleHandler.AppModule): def chooseNVDAObjectOverlayClasses(self, obj, clsList): windowClass = obj.windowClassName + if UIAHandler.isUIAAvailable: + if isinstance(obj,UIA) and obj.UIAElement.cachedClassName=="TouchEditInner" and obj.role==controlTypes.ROLE_EDITABLETEXT: + clsList.insert(0,Win8PasswordField) if windowClass == "AUTHUI.DLL: LogonUI Logon Window" and obj.parent and obj.parent.parent and not obj.parent.parent.parent: clsList.insert(0, LogonDialog) return diff --git a/source/globalCommands.py b/source/globalCommands.py index 54af70505..9f3932b82 100755 --- a/source/globalCommands.py +++ b/source/globalCommands.py @@ -427,6 +427,8 @@ class GlobalCommands(ScriptableObject): pos=api.getReviewPosition() try: pos.activate() + if isinstance(gesture,touchHandler.TouchInputGesture): + touchHandler.handler.notifyInteraction(pos.NVDAObjectAtStart) ui.message(actionName) return except NotImplementedError: @@ -435,6 +437,8 @@ class GlobalCommands(ScriptableObject): while obj: try: obj.doAction() + if isinstance(gesture,touchHandler.TouchInputGesture): + touchHandler.handler.notifyInteraction(obj) try: actionName=obj.getActionName() except NotImplementedError: diff --git a/source/touchHandler.py b/source/touchHandler.py index c37fe343a..19fdbc93c 100644 --- a/source/touchHandler.py +++ b/source/touchHandler.py @@ -13,6 +13,7 @@ import inputCore import screenExplorer from logHandler import log import touchTracker +import gui availableTouchModes=['text','object'] @@ -193,6 +194,16 @@ class TouchHandler(threading.Thread): pass yield + def notifyInteraction(self, obj): + """Notify the system that UI interaction is occurring via touch. + This should be called when performing an action on an object. + @param obj: The NVDAObject with which the user is interacting. + @type obj: L{NVDAObjects.NVDAObject} + """ + l, t, w, h = obj.location + oledll.oleacc.AccNotifyTouchInteraction(gui.mainFrame.Handle, obj.windowHandle, + POINT(l + (w / 2), t + (h / 2))) + handler=None def initialize(): -- 2.11.0