nvdajp / focusHighlight

NVDA add-on which highlights the focused location.
GNU General Public License v2.0
16 stars 2 forks source link

HiDPI support #6

Open nishimotz opened 7 years ago

nishimotz commented 7 years ago

HiDPI support which covers:

This work is in progress and a lot of test code should be removed before release.

So far, tested with Windows 10 version 1607 and 1703 only.

nishimotz commented 7 years ago

Windows 8.1 raises the error as follows

ERROR - eventHandler.executeEvent (15:55:58):
error executing event: gainFocus on <NVDAObjects.Dynamic_DialogIAccessibleWindowNVDAObject object at 0x04090EB0> with extra args of {}
Traceback (most recent call last):
  File "eventHandler.pyo", line 143, in executeEvent
  File "eventHandler.pyo", line 91, in __init__
  File "eventHandler.pyo", line 98, in next
  File "C:\Users\nishimotz\AppData\Roaming\nvda\addons\focusHighlight\globalPlugins\focusHighlight.py", line 665, in event_gainFocus
  File "C:\Users\nishimotz\AppData\Roaming\nvda\addons\focusHighlight\globalPlugins\focusHighlight.py", line 625, in getInfo
  File "C:\Users\nishimotz\AppData\Roaming\nvda\addons\focusHighlight\globalPlugins\focusHighlight.py", line 318, in objToRect
  File "C:\Users\nishimotz\AppData\Roaming\nvda\addons\focusHighlight\globalPlugins\focusHighlight.py", line 230, in getDpiInfo
  File "ctypes\__init__.pyo", line 375, in __getattr__
  File "ctypes\__init__.pyo", line 380, in __getitem__
AttributeError: function 'GetDpiForSystem' not found
nishimotz commented 7 years ago

Should handle the exception on Windows 10 as follows

ERROR - unhandled exception (18:41:37):
Traceback (most recent call last):
  File "_ctypes/callbacks.c", line 315, in 'calling callback function'
  File "C:\Users\nishimotz\AppData\Roaming\nvda\addons\focusHighlight\globalPlugins\focusHighlight.py", line 540, in wndProc
  File "C:\Users\nishimotz\AppData\Roaming\nvda\addons\focusHighlight\globalPlugins\focusHighlight.py", line 442, in updateFocusLocation
  File "C:\Users\nishimotz\AppData\Roaming\nvda\addons\focusHighlight\globalPlugins\focusHighlight.py", line 389, in moveAndShowWindow
ArgumentError: argument 5: <type 'exceptions.OverflowError'>: long int too long to convert
nishimotz commented 7 years ago

Known issue:

nishimotz commented 7 years ago

Known issue:

nishimotz commented 7 years ago

According to https://github.com/nvaccess/nvda/issues/7065 NVDA object locations are always physical coordinates.

I wrote some experimental global plugin and found that unexpected behaviors are caused by Win32 APIs such as SetWindowPos and MoveWindow.

My observation (with Windows 10 version 1703) indicates

sub monitors' coordinates for window position APIs = (physical coordinates in the virtual desktop) * (primary monitor scale factor) / (target monitor scale factor)

I don't understand why this behavior occurs. It may depend on the DPI awareness of NVDA process itself.

nishimotz commented 6 years ago

finally, modified version of NVDA and new add-on, as follows, work nicely with Windows 10 per-monitor DPI environment.

nvda_2017.4jp-beta-171105x https://ci.appveyor.com/project/TakuyaNishimoto/nvdajp/build/jpbeta-470/artifacts

focusHighlight 5.0-dev-171105 https://github.com/nvdajp/focusHighlight/releases/tag/5.0-dev-171105

mrazzari commented 6 years ago

Just a heads up in case this helps anyone else... I use your plugin heavily for presentations, where my HiDPI laptop is plugged into a VGA projector.

Either cloning the screen or extending it, the focus rectangle works for Windows apps, Window's settings, and for Firefox's browser's chrome (tabs, menus). But it fails for webpage content.

The issue can be worked around by disabling HiDPI just for NVDA.

Since NVDA is non-visual anyway (pun), this setting doesn't otherwise impact usage.

In Explorer or on the Start menu, right-click the NVDA access shortcut, select Properties, select the Compatibility tab, and then select the Disable display scaling on high DPI settings check box.

In Windows 10 Creators Update (Version 1703) and later version of Windows, this is under Override high DPI scaling behavior, then scaling performed by: Application.