Skip to content

Commit

Permalink
Merge pull request #3 from hwf1324/v0.4.0
Browse files Browse the repository at this point in the history
V0.4.0
  • Loading branch information
hwf1324 authored Jan 6, 2025
2 parents 11ec855 + 3e60cf5 commit d713733
Show file tree
Hide file tree
Showing 7 changed files with 79 additions and 37 deletions.
29 changes: 0 additions & 29 deletions _template_addon_release.json

This file was deleted.

32 changes: 32 additions & 0 deletions addon/appModules/windowsterminal.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
from contextlib import contextmanager
from typing import Callable

import appModuleHandler
import controlTypes
from NVDAObjects import UIA
from textInfos import UNIT_LINE, UNIT_PARAGRAPH


@contextmanager
def restrictParagraphToLine():
import config

try:
curTextUnit = config.conf["mouse"]["mouseTextUnit"]
if curTextUnit == UNIT_PARAGRAPH:
config.conf["mouse"]["mouseTextUnit"] = UNIT_LINE
yield
finally:
config.conf["mouse"]["mouseTextUnit"] = (
curTextUnit or config.conf.getConfigValidation(("mouse", "mouseTextUnit")).default
)


class AppModule(appModuleHandler.AppModule):

def event_mouseMove(self, obj: UIA.UIA, nextHandler: Callable[[], None], x: int, y: int) -> None:
if obj.role == controlTypes.Role.TERMINAL:
with restrictParagraphToLine():
nextHandler()
return
nextHandler()
24 changes: 24 additions & 0 deletions addon/globalPlugins/winUI.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# mouseEnhancement add-on for NVDA
# This file is covered by the GNU General Public License.
# See the file COPYING.txt for more details.
# Copyright (C) 2025 hwf1324 <[email protected]>

import controlTypes
import globalPluginHandler


class GlobalPlugin(globalPluginHandler.GlobalPlugin):

def chooseNVDAObjectOverlayClasses(self, obj, clsList):
try:
if (
(
obj.windowClassName == "Microsoft.UI.Content.DesktopChildSiteBridge"
or obj.windowClassName == "Windows.UI.Composition.DesktopWindowContentBridge"
)
and obj.role == controlTypes.Role.PANE
and not obj.appModule.isGoodUIAWindow(obj.windowHandle)
):
obj.appModule.isGoodUIAWindow = lambda hwnd: True
except AttributeError:
pass
9 changes: 6 additions & 3 deletions buildVars.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,13 @@ def _(arg):
# Translators: Long description to be shown for this add-on on add-on information from add-ons manager
"addon_description": _("""This add-on provides enhancement to mouse functionality in NVDA.
For example, fixed mouse tracking in Electron app (2024.4 only).
Electron apps, such as VS Code."""),
For example:
Fixed mouse tracking in Electron app (2024.4 only).
Electron apps, such as VS Code.
Experimental fix for mouse tracking in WinUI apps.
WinUI applications: e.g. Windows Terminal, PowerToys v0.86.0 and higher, some applications that come with Windows, etc."""),
# version
"addon_version": "0.3.0",
"addon_version": "0.4.0",
# Author(s)
"addon_author": "hwf1324 <[email protected]>",
# URL for the add-on documentation support
Expand Down
6 changes: 3 additions & 3 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
* Change the add-on name to: Mouse Enhancement. (Doesn't take into account add-on upgrades.)
* Ignore the error when entering the security screen because the object does not have the windowClassName attribute.
* Mouse tracking can report the description of the option in the Git for Windows installer. (Individual options cannot be viewed individually.)
* Experimental: Fix mouse tracking in WinUI apps by making `obj.appModule.isGoodUIAWindow` always return `True` when an object with a specific `windowClassName` property is encountered.
* Windows Terminal: If the text unit is a paragraph, moving the mouse in the Terminal control restricts the text unit to lines.
* Electron: cleaned up some unnecessary judgment logic.
* Update add-on template.
12 changes: 11 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,21 @@ Some features may be moved out as standalone features in the future.

* Fix mouse tracking in [Electron](https://www.electronjs.org/) apps (2024.4 only).
* Electron apps, such as [VS Code](https://code.visualstudio.com/).
* Experimental fix mouse tracking in [WinUI](https://github.com/microsoft/microsoft-ui-xaml) apps.
* [Windows Terminal](https://github.com/microsoft/terminal): If the text unit is a paragraph, moving the mouse in the Terminal control restricts the text unit to lines.
* Fix a part of the NVIDIA Control Panel where the content of the static text description control is incorrect.
* Fixed the problem that some buttons in [PDFgear](https://www.pdfgear.com/) could not get the description text.
* Mouse tracking can report the description of the option in the [Git for Windows](https://git-scm.com/downloads/win) installer. (Individual options cannot be viewed individually.)

## Changelog

### 0.4.0

* Experimental: Fix mouse tracking in WinUI apps by making `obj.appModule.isGoodUIAWindow` always return `True` when an object with a specific `windowClassName` property is encountered.
* Windows Terminal: If the text unit is a paragraph, moving the mouse in the Terminal control restricts the text unit to lines.
* Electron: cleaned up some unnecessary judgment logic.
* Update add-on template.

### 0.3.0

* Change the add-on name to: Mouse Enhancement. (Doesn't take into account add-on upgrades.)
Expand All @@ -34,4 +43,5 @@ Some features may be moved out as standalone features in the future.

## Acknowledgements

Thanks to @jcsteh for his guidance in fixing mouse tracking in the Electron app.
Thanks to @jcsteh in https://github.com/nvaccess/nvda/issues/17108 for his guidance in fixing mouse tracking in the Electron app.
Thanks to @codeofdusk in https://github.com/nvaccess/nvda/issues/17407#issuecomment-2544712156 for the way to experimentally fix mouse tracking in WinUI apps.
4 changes: 3 additions & 1 deletion sconstruct
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# NVDA add-on template SCONSTRUCT file
# Copyright (C) 2012-2024 Rui Batista, Noelia Martinez, Joseph Lee
# Copyright (C) 2012-2025 Rui Batista, Noelia Martinez, Joseph Lee
# This file is covered by the GNU General Public License.
# See the file COPYING.txt for more details.

Expand Down Expand Up @@ -100,6 +100,7 @@ env.Append(**buildVars.addon_info)

if env["dev"]:
import datetime

buildDate = datetime.datetime.now()
year, month, day = str(buildDate.year), str(buildDate.month), str(buildDate.day)
versionTimestamp = "".join([year, month.zfill(2), day.zfill(2)])
Expand Down Expand Up @@ -247,6 +248,7 @@ addon = env.NVDAAddon(addonFile, env.Dir("addon"))
langDirs = [f for f in env.Glob(os.path.join("addon", "locale", "*"))]

# Allow all NVDA's gettext po files to be compiled in source/locale, and manifest files to be generated
moByLang = {}
for dir in langDirs:
poFile = dir.File(os.path.join("LC_MESSAGES", "nvda.po"))
moFile = env.gettextMoFile(poFile)
Expand Down

0 comments on commit d713733

Please sign in to comment.