-
-
Notifications
You must be signed in to change notification settings - Fork 831
Touch interaction: allow users to disable touch support completely #10557
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
michaelDCurran
merged 16 commits into
nvaccess:master
from
josephsl:i9682configurableTouchOverlay
Jun 23, 2020
Merged
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 dfb0901
Touch handler: copyright header
josephsl 4892a39
Touch handler: use platform version tuple to determine if touch suppo…
josephsl 0fafb9d
Touch handler: enable touch support/overlay if told to do so by users…
josephsl eedf3a0
Settings/touch interaction: add touch support toggle. Re #9682.
josephsl 79798b7
Touch supporte3d: add debugLog flag so excessive log output will not …
josephsl 9915422
Touch handler: handle configuration profile switches via a dedicated …
josephsl 32f9e6c
Touch handler: set touch support mode and register/unregister profile…
josephsl 3ec6a28
Touch interaction settings panel: use touchHandler.setTouchSupport fu…
josephsl b878e3c
Touch interaction panel: add accelerator.
josephsl 5ce560e
User guide: add notes on touch interaction support checkbox in settin…
josephsl d4bed76
Touch handler: review comments (annotations, docstring). Re #9682.
josephsl 2c54386
Touch interaction panel: convert to use GUI helper. re #9682.
josephsl 475ee44
User guide: clarify the behavior of touch support when touch is disab…
josephsl ec3061b
Touch handler: update copyright years
josephsl b1376a2
Merge branch 'master' of https://github.com/nvaccess/nvda into i9682c…
josephsl File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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. | ||||||
|
|
@@ -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. | ||||||
| @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): | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 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(): | ||||||
|
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 | ||||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.