Skip to content

Commit

Permalink
use GDI Plus
Browse files Browse the repository at this point in the history
  • Loading branch information
nishimotz committed Nov 5, 2017
1 parent a7e045a commit 8eacb3d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 14 deletions.
22 changes: 10 additions & 12 deletions addon/globalPlugins/focusHighlight.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,22 +174,22 @@ def makeARGB(a,r,g,b):
transBrush = windll.gdi32.CreateSolidBrush(transColor)

# focus (passthrough)
ptARGB = makeARGB(255, 0x00, 0x00, 0xff)
ptDashStyle = 4
ptThickness = 2
ptARGB = makeARGB(255, 0x22, 0x22, 0xff)
ptDashStyle = 2
ptThickness = 12

# focus
fcARGB = makeARGB(255, 0xff, 0x00, 0x00)
fcDashStyle = 0
fcThickness = 5
fcThickness = 6

# navigator
navARGB = makeARGB(255, 0x00, 0xff, 0x00)
navDashStyle = 2
navThickness = 3
navDashStyle = 3
navThickness = 4

PADDING_THIN = 15
PADDING_THICK = 12
PADDING_THIN = 10
PADDING_THICK = 5
WINDOW_ALPHA = 192

ID_TIMER = 100
Expand Down Expand Up @@ -316,9 +316,9 @@ def doPaint(hwnd):
if currentAppSleepMode:
pass
elif passThroughMode:
argb, dashStyle, thickness, padding = ptARGB, ptDashStyle, ptThickness, PADDING_THIN
argb, dashStyle, thickness, padding = ptARGB, ptDashStyle, ptThickness, PADDING_THICK
else:
argb, dashStyle, thickness, padding = fcARGB, fcDashStyle, fcThickness, PADDING_THIN
argb, dashStyle, thickness, padding = fcARGB, fcDashStyle, fcThickness, PADDING_THICK
if rectEquals(focusRect, navigatorRect):
if not passThroughMode:
thickness *= 2
Expand Down Expand Up @@ -452,8 +452,6 @@ class GlobalPlugin(globalPluginHandler.GlobalPlugin):

def __init__(self):
super(globalPluginHandler.GlobalPlugin, self).__init__()

windll.shcore.SetProcessDpiAwareness(2)
self.gdipToken = c_ulong()
startupInput = GdiplusStartupInput()
startupInput.GdiplusVersion = 1
Expand Down
10 changes: 8 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,19 @@ By drawing a colored rectangle, this addon enables partially sighted users, sigh

The following colors are used by this addon:

* Green jagged line, to indicate the navigator object.
* Green thin dashed dotted line rectangle, to indicate the navigator object.
* Red thin rectangle, to indicate the focused object/control.
* Red thick rectangle, to indicate when navigator object and focused object are overlapping.
* Blue thick rectangle with thin slashes, to indicate NVDA is in focus mode, i.e. key types are passed to the control.
* Blue thick dotted line rectangle, to indicate NVDA is in focus mode, i.e. key types are passed to the control.

To disable object tracking, uninstall the addon.

## Changes for 5.0 ##

* Indicators of navigator object and focus mode were changed.
* Multiple monitors are supported.
* It now uses GDI Plus technology for drawing.

## Changes for 4.0 ##

* Hide rectangle if current application is in sleep mode.
Expand Down

0 comments on commit 8eacb3d

Please sign in to comment.