Skip to content

Commit

Permalink
If numlock is on, it is not deactivated unwantedly anymore.
Browse files Browse the repository at this point in the history
  • Loading branch information
CyrilleB79 committed Mar 6, 2020
1 parent 2bf2ce1 commit 32bee35
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions addon/globalPlugins/winMag/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import mouseHandler
import globalVars
import winUser
from keyboardHandler import KeyboardInputGesture

import wx

Expand Down Expand Up @@ -365,19 +366,28 @@ def terminate(self):
gestures = ["kb:windows+numpadPlus", "kb:windows+numLock+numpadPlus", "kb:windows+" + KEY_ALPHA_PLUS, "kb:windows+plus"]
)
def script_zoomIn(self, gesture):
numlockWasOn = 'numlock' in gesture.normalizedIdentifiers[0].split(':')[1]
if isMagnifierRunning():
self.modifyZoomLevel(gesture)
else:
self.modifyRunningState(gesture)
if numlockWasOn:
# A gesture.send() with numlock on will unwantedly toggle numlock (see NVDA issue #10827), so restore it.
KeyboardInputGesture.fromName('numlock').send()


@script(
gestures = ["kb:windows+numpadMinus", "kb:windows+numLock+numpadMinus", "kb:windows+" + KEY_ALPHA_MINUS, "kb:windows+-"]
)
def script_zoomOut(self, gesture):
numlockWasOn = 'numlock' in gesture.normalizedIdentifiers[0].split(':')[1]
if isMagnifierRunning():
self.modifyZoomLevel(gesture)
else:
gesture.send()
if numlockWasOn:
# A gesture.send() with numlock on will unwantedly toggle numlock (see NVDA issue #10827), so restore it.
KeyboardInputGesture.fromName('numlock').send()

@script(
gesture = "kb:windows+escape"
Expand Down

0 comments on commit 32bee35

Please sign in to comment.