Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
458a7f1
ConfSpec: add touch enabled key. Re #9682.
josephsl Nov 20, 2019
dfb0901
Touch handler: copyright header
josephsl Nov 20, 2019
4892a39
Touch handler: use platform version tuple to determine if touch suppo…
josephsl Nov 20, 2019
0fafb9d
Touch handler: enable touch support/overlay if told to do so by users…
josephsl Nov 20, 2019
eedf3a0
Settings/touch interaction: add touch support toggle. Re #9682.
josephsl Nov 20, 2019
79798b7
Touch supporte3d: add debugLog flag so excessive log output will not …
josephsl Nov 21, 2019
9915422
Touch handler: handle configuration profile switches via a dedicated …
josephsl Nov 21, 2019
32f9e6c
Touch handler: set touch support mode and register/unregister profile…
josephsl Nov 21, 2019
3ec6a28
Touch interaction settings panel: use touchHandler.setTouchSupport fu…
josephsl Nov 22, 2019
b878e3c
Touch interaction panel: add accelerator.
josephsl Nov 28, 2019
5ce560e
User guide: add notes on touch interaction support checkbox in settin…
josephsl Nov 28, 2019
d4bed76
Touch handler: review comments (annotations, docstring). Re #9682.
josephsl Nov 28, 2019
2c54386
Touch interaction panel: convert to use GUI helper. re #9682.
josephsl Nov 28, 2019
475ee44
User guide: clarify the behavior of touch support when touch is disab…
josephsl Nov 30, 2019
ec3061b
Touch handler: update copyright years
josephsl Jan 2, 2020
b1376a2
Merge branch 'master' of https://github.com/nvaccess/nvda into i9682c…
josephsl May 6, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions source/config/configSpec.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@
autoFocusFocusableElements = boolean(default=True)

[touch]
enabled = boolean(default=true)
touchTyping = boolean(default=False)

#Settings for document reading (such as MS Word and wordpad)
Expand Down
13 changes: 10 additions & 3 deletions source/gui/settingsDialogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -2217,14 +2217,21 @@ class TouchInteractionPanel(SettingsPanel):
title = _("Touch Interaction")

def makeSettings(self, settingsSizer):
sHelper = guiHelper.BoxSizerHelper(self, sizer=settingsSizer)
# Translators: This is the label for a checkbox in the
# touch interaction settings panel.
touchSupportEnableLabel = _("Enable touch interaction support")
self.enableTouchSupportCheckBox = sHelper.addItem(wx.CheckBox(self, label=touchSupportEnableLabel))
self.enableTouchSupportCheckBox.SetValue(config.conf["touch"]["enabled"])
# Translators: This is the label for a checkbox in the
# touch interaction settings panel.
self.touchTypingCheckBox=wx.CheckBox(self,label=_("&Touch typing mode"))
self.touchTypingCheckBox = sHelper.addItem(wx.CheckBox(self, label=_("&Touch typing mode")))
self.touchTypingCheckBox.SetValue(config.conf["touch"]["touchTyping"])
settingsSizer.Add(self.touchTypingCheckBox,border=10,flag=wx.BOTTOM)

def onSave(self):
config.conf["touch"]["touchTyping"]=self.touchTypingCheckBox.IsChecked()
config.conf["touch"]["enabled"] = self.enableTouchSupportCheckBox.IsChecked()
config.conf["touch"]["touchTyping"] = self.touchTypingCheckBox.IsChecked()
touchHandler.setTouchSupport(config.conf["touch"]["enabled"])

class UwpOcrPanel(SettingsPanel):
# Translators: The title of the Windows 10 OCR panel.
Expand Down
52 changes: 39 additions & 13 deletions source/touchHandler.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
#touchHandler.py
#A part of NonVisual Desktop Access (NVDA)
#This file is covered by the GNU General Public License.
#See the file COPYING for more details.
#Copyright (C) 2012-2018 NV Access Limited, Joseph Lee, Babbage B.V.
# A part of NonVisual Desktop Access (NVDA)
# This file is covered by the GNU General Public License.
# See the file COPYING for more details.
# Copyright (C) 2012-2020 NV Access Limited, Joseph Lee, Babbage B.V.

"""handles touchscreen interaction (Windows 8 and later).
Used to provide input gestures for touchscreens, touch modes and other support facilities.
Expand Down Expand Up @@ -294,30 +293,57 @@ def notifyInteraction(self, obj):

handler=None

def touchSupported():

def touchSupported(debugLog: bool = False):
"""Returns if the system and current NVDA session supports touchscreen interaction.
Comment thread
LeonarddeR marked this conversation as resolved.
@param debugLog: Whether to log additional details about touch support to the NVDA log.
"""
if not config.isInstalledCopy() and not config.isAppX:
log.debugWarning("Touch only supported on installed copies")
if debugLog:
log.debugWarning("Touch only supported on installed copies")
return False
if (winVersion.winVersion.major*10+winVersion.winVersion.minor)<62:
log.debugWarning("Touch only supported on Windows 8 and higher")
if winVersion.winVersion.platform_version < (6, 2, 9200):

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it really necessary to take the platform into account here?

Suggested change
if winVersion.winVersion.platform_version < (6, 2, 9200):
if (winVersion.winVersion.major, winVersion.winVersion.minor) < (6, 2):

if debugLog:
log.debugWarning("Touch only supported on Windows 8 and higher")
return False
maxTouches=windll.user32.GetSystemMetrics(SM_MAXIMUMTOUCHES)
if maxTouches<=0:
log.debugWarning("No touch devices found")
if debugLog:
log.debugWarning("No touch devices found")
return False
return True

def initialize():

def setTouchSupport(enable: bool):
global handler
if not touchSupported():
raise NotImplementedError
handler=TouchHandler()
log.debug("Touch support initialized. maximum touch inputs: %d"%windll.user32.GetSystemMetrics(SM_MAXIMUMTOUCHES))
if not handler and enable:
handler = TouchHandler()
log.debug("Touch support enabled.")
elif handler and not enable:
handler.terminate()
handler = None
log.debug("Touch support disabled.")


def handlePostConfigProfileSwitch():
Comment thread
LeonarddeR marked this conversation as resolved.
setTouchSupport(config.conf["touch"]["enabled"])


def initialize():
global handler
if not touchSupported(debugLog=True):
raise NotImplementedError
log.debug(
"Touchscreen detected, maximum touch inputs: %d" % winUser.user32.GetSystemMetrics(SM_MAXIMUMTOUCHES)
)
config.post_configProfileSwitch.register(handlePostConfigProfileSwitch)
setTouchSupport(config.conf["touch"]["enabled"])

def terminate():
global handler
config.post_configProfileSwitch.unregister(handlePostConfigProfileSwitch)
if handler:
handler.terminate()
handler=None
8 changes: 7 additions & 1 deletion user_docs/en/userGuide.t2t
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,9 @@ If your laptop cannot do this or does not allow you to turn Num Lock off, you ma

++ NVDA Touch Gestures ++[NVDATouchGestures]
If you are running NVDA on a device with a touchscreen and running Windows 8 or higher, you can also control NVDA directly via touch commands.
While NVDA is running, all touch input will go directly to NVDA.
While NVDA is running, unless touch interaction support is disabled, all touch input will go directly to NVDA.
Therefore, actions that can be performed normally without NVDA will not work.
You can change this by enabling or disabling [touch interaction support # TouchSupportEnable] from touch interaction category of the NVDA settings.

+++ Exploring the Screen +++[ExploringTheScreen]
The most basic action you can perform with the touch screen is to announce the control or text at any point on the screen.
Expand Down Expand Up @@ -1513,6 +1514,11 @@ If you check this option and you have the "Enable mouse tracking" option enabled
This settings category, only available on computers running Windows 8 and later with touch capabilities, allows you to configure how NVDA interacts with touchscreens.
This category contains the following options:

==== Enable touch interaction support ====[TouchSupportEnable]
This checkbox enables NVDA's touch interaction support.
If enabled, you can use your fingers to navigate and interact with items on screen using a touchscreen device.
If disabled, touchscreen support will be disabled as though NVDA is not running.

==== Touch typing mode ====[TouchTypingMode]
This checkbox allows you to specify the method you wish to use when entering text using the touch keyboard.
If this checkbox is checked, when you locate a key on the touch keyboard, you can lift your finger and the selected key will be pressed.
Expand Down