prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Screen curtain reveals mouse position
  Note, this was reported to me by my wife, so it would help to have at least one sighted person who can verify this.
  
  ### Steps to reproduce:
  1. Enable the screen curtain by assigning a custom gesture to the global command in the vision category
  2. Look at the screen
  
  ### Actual behavior:
  The screen is black, but the mouse is still shown.
  
  ### Expected behavior:
  Screen is entirely black
  
  ### Proposed fix
  There is a function in the magnification API that hides the system cursor, so that can be implemented for this. Having said that, I don't consider this very important.
  
  ### System configuration
  #### NVDA installed/portable/running from source:
  Installed
  
  #### NVDA version:
  alpha-18574
  
  #### Windows version:
  Windows 10 1903
  
  
  </issue>
  <code>
  [start of source/visionEnhancementProviders/screenCurtain.py]
  1 # A part of NonVisual Desktop Access (NVDA)
  2 # This file is covered by the GNU General Public License.
  3 # See the file COPYING for more details.
  4 # Copyright (C) 2018-2019 NV Access Limited, Babbage B.V., Leonard de Ruijter
  5 
  6 """Screen curtain implementation based on the windows magnification API.
  7 This implementation only works on Windows 8 and above.
  8 """
  9 
  10 import vision
  11 import winVersion
  12 from ctypes import Structure, windll, c_float, POINTER, WINFUNCTYPE, WinError
  13 from ctypes.wintypes import BOOL
  14 
  15 
  16 class MAGCOLOREFFECT(Structure):
  17 	_fields_ = (("transform", c_float * 5 * 5),)
  18 
  19 
  20 TRANSFORM_BLACK = MAGCOLOREFFECT()
  21 TRANSFORM_BLACK.transform[4][4] = 1.0
  22 
  23 
  24 def _errCheck(result, func, args):
  25 	if result == 0:
  26 		raise WinError()
  27 	return args
  28 
  29 
  30 class Magnification:
  31 	"""Static class that wraps necessary functions from the Windows magnification API."""
  32 
  33 	_magnification = windll.Magnification
  34 
  35 	_MagInitializeFuncType = WINFUNCTYPE(BOOL)
  36 	_MagUninitializeFuncType = WINFUNCTYPE(BOOL)
  37 	_MagSetFullscreenColorEffectFuncType = WINFUNCTYPE(BOOL, POINTER(MAGCOLOREFFECT))
  38 	_MagSetFullscreenColorEffectArgTypes = ((1, "effect"),)
  39 	_MagGetFullscreenColorEffectFuncType = WINFUNCTYPE(BOOL, POINTER(MAGCOLOREFFECT))
  40 	_MagGetFullscreenColorEffectArgTypes = ((2, "effect"),)
  41 
  42 	MagInitialize = _MagInitializeFuncType(("MagInitialize", _magnification))
  43 	MagInitialize.errcheck = _errCheck
  44 	MagUninitialize = _MagUninitializeFuncType(("MagUninitialize", _magnification))
  45 	MagUninitialize.errcheck = _errCheck
  46 	try:
  47 		MagSetFullscreenColorEffect = _MagSetFullscreenColorEffectFuncType(
  48 			("MagSetFullscreenColorEffect", _magnification),
  49 			_MagSetFullscreenColorEffectArgTypes
  50 		)
  51 		MagSetFullscreenColorEffect.errcheck = _errCheck
  52 		MagGetFullscreenColorEffect = _MagGetFullscreenColorEffectFuncType(
  53 			("MagGetFullscreenColorEffect", _magnification),
  54 			_MagGetFullscreenColorEffectArgTypes
  55 		)
  56 		MagGetFullscreenColorEffect.errcheck = _errCheck
  57 	except AttributeError:
  58 		MagSetFullscreenColorEffect = None
  59 		MagGetFullscreenColorEffect = None
  60 
  61 
  62 class VisionEnhancementProvider(vision.providerBase.VisionEnhancementProvider):
  63 	name = "screenCurtain"
  64 	# Translators: Description of a vision enhancement provider that disables output to the screen,
  65 	# making it black.
  66 	description = _("Screen Curtain")
  67 	supportedRoles = frozenset([vision.constants.Role.COLORENHANCER])
  68 
  69 	@classmethod
  70 	def canStart(cls):
  71 		return winVersion.isFullScreenMagnificationAvailable()
  72 
  73 	def __init__(self):
  74 		super(VisionEnhancementProvider, self).__init__()
  75 		Magnification.MagInitialize()
  76 		Magnification.MagSetFullscreenColorEffect(TRANSFORM_BLACK)
  77 
  78 	def terminate(self):
  79 		super(VisionEnhancementProvider, self).terminate()
  80 		Magnification.MagUninitialize()
  81 
  82 	def registerEventExtensionPoints(self, extensionPoints):
  83 		# The screen curtain isn't interested in any events
  84 		pass
  85
  [end of source/visionEnhancementProviders/screenCurtain.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/source/visionEnhancementProviders/screenCurtain.py b/source/visionEnhancementProviders/screenCurtain.py
  --- a/source/visionEnhancementProviders/screenCurtain.py
  +++ b/source/visionEnhancementProviders/screenCurtain.py
  @@ -38,6 +38,8 @@
   	_MagSetFullscreenColorEffectArgTypes = ((1, "effect"),)
   	_MagGetFullscreenColorEffectFuncType = WINFUNCTYPE(BOOL, POINTER(MAGCOLOREFFECT))
   	_MagGetFullscreenColorEffectArgTypes = ((2, "effect"),)
  +	_MagShowSystemCursorFuncType = WINFUNCTYPE(BOOL, BOOL)
  +	_MagShowSystemCursorArgTypes = ((1, "showCursor"),)
   
   	MagInitialize = _MagInitializeFuncType(("MagInitialize", _magnification))
   	MagInitialize.errcheck = _errCheck
  @@ -57,6 +59,11 @@
   	except AttributeError:
   		MagSetFullscreenColorEffect = None
   		MagGetFullscreenColorEffect = None
  +	MagShowSystemCursor = _MagShowSystemCursorFuncType(
  +		("MagShowSystemCursor", _magnification),
  +		_MagShowSystemCursorArgTypes
  +	)
  +	MagShowSystemCursor.errcheck = _errCheck
   
   
   class VisionEnhancementProvider(vision.providerBase.VisionEnhancementProvider):
  @@ -73,10 +80,12 @@
   	def __init__(self):
   		super(VisionEnhancementProvider, self).__init__()
   		Magnification.MagInitialize()
  +		Magnification.MagShowSystemCursor(False)
   		Magnification.MagSetFullscreenColorEffect(TRANSFORM_BLACK)
   
   	def terminate(self):
   		super(VisionEnhancementProvider, self).terminate()
  +		Magnification.MagShowSystemCursor(True)
   		Magnification.MagUninitialize()
   
   	def registerEventExtensionPoints(self, extensionPoints):
  
verification_info: {"golden_diff": "diff --git a/source/visionEnhancementProviders/screenCurtain.py b/source/visionEnhancementProviders/screenCurtain.py\n--- a/source/visionEnhancementProviders/screenCurtain.py\n+++ b/source/visionEnhancementProviders/screenCurtain.py\n@@ -38,6 +38,8 @@\n \t_MagSetFullscreenColorEffectArgTypes = ((1, \"effect\"),)\r\n \t_MagGetFullscreenColorEffectFuncType = WINFUNCTYPE(BOOL, POINTER(MAGCOLOREFFECT))\r\n \t_MagGetFullscreenColorEffectArgTypes = ((2, \"effect\"),)\r\n+\t_MagShowSystemCursorFuncType = WINFUNCTYPE(BOOL, BOOL)\r\n+\t_MagShowSystemCursorArgTypes = ((1, \"showCursor\"),)\r\n \r\n \tMagInitialize = _MagInitializeFuncType((\"MagInitialize\", _magnification))\r\n \tMagInitialize.errcheck = _errCheck\r\n@@ -57,6 +59,11 @@\n \texcept AttributeError:\r\n \t\tMagSetFullscreenColorEffect = None\r\n \t\tMagGetFullscreenColorEffect = None\r\n+\tMagShowSystemCursor = _MagShowSystemCursorFuncType(\r\n+\t\t(\"MagShowSystemCursor\", _magnification),\r\n+\t\t_MagShowSystemCursorArgTypes\r\n+\t)\r\n+\tMagShowSystemCursor.errcheck = _errCheck\r\n \r\n \r\n class VisionEnhancementProvider(vision.providerBase.VisionEnhancementProvider):\r\n@@ -73,10 +80,12 @@\n \tdef __init__(self):\r\n \t\tsuper(VisionEnhancementProvider, self).__init__()\r\n \t\tMagnification.MagInitialize()\r\n+\t\tMagnification.MagShowSystemCursor(False)\r\n \t\tMagnification.MagSetFullscreenColorEffect(TRANSFORM_BLACK)\r\n \r\n \tdef terminate(self):\r\n \t\tsuper(VisionEnhancementProvider, self).terminate()\r\n+\t\tMagnification.MagShowSystemCursor(True)\r\n \t\tMagnification.MagUninitialize()\r\n \r\n \tdef registerEventExtensionPoints(self, extensionPoints):\n", "issue": "Screen curtain reveals mouse position\nNote, this was reported to me by my wife, so it would help to have at least one sighted person who can verify this.\r\n\r\n### Steps to reproduce:\r\n1. Enable the screen curtain by assigning a custom gesture to the global command in the vision category\r\n2. Look at the screen\r\n\r\n### Actual behavior:\r\nThe screen is black, but the mouse is still shown.\r\n\r\n### Expected behavior:\r\nScreen is entirely black\r\n\r\n### Proposed fix\r\nThere is a function in the magnification API that hides the system cursor, so that can be implemented for this. Having said that, I don't consider this very important.\r\n\r\n### System configuration\r\n#### NVDA installed/portable/running from source:\r\nInstalled\r\n\r\n#### NVDA version:\r\nalpha-18574\r\n\r\n#### Windows version:\r\nWindows 10 1903\r\n\n", "before_files": [{"content": "# A part of NonVisual Desktop Access (NVDA)\r\n# This file is covered by the GNU General Public License.\r\n# See the file COPYING for more details.\r\n# Copyright (C) 2018-2019 NV Access Limited, Babbage B.V., Leonard de Ruijter\r\n\r\n\"\"\"Screen curtain implementation based on the windows magnification API.\r\nThis implementation only works on Windows 8 and above.\r\n\"\"\"\r\n\r\nimport vision\r\nimport winVersion\r\nfrom ctypes import Structure, windll, c_float, POINTER, WINFUNCTYPE, WinError\r\nfrom ctypes.wintypes import BOOL\r\n\r\n\r\nclass MAGCOLOREFFECT(Structure):\r\n\t_fields_ = ((\"transform\", c_float * 5 * 5),)\r\n\r\n\r\nTRANSFORM_BLACK = MAGCOLOREFFECT()\r\nTRANSFORM_BLACK.transform[4][4] = 1.0\r\n\r\n\r\ndef _errCheck(result, func, args):\r\n\tif result == 0:\r\n\t\traise WinError()\r\n\treturn args\r\n\r\n\r\nclass Magnification:\r\n\t\"\"\"Static class that wraps necessary functions from the Windows magnification API.\"\"\"\r\n\r\n\t_magnification = windll.Magnification\r\n\r\n\t_MagInitializeFuncType = WINFUNCTYPE(BOOL)\r\n\t_MagUninitializeFuncType = WINFUNCTYPE(BOOL)\r\n\t_MagSetFullscreenColorEffectFuncType = WINFUNCTYPE(BOOL, POINTER(MAGCOLOREFFECT))\r\n\t_MagSetFullscreenColorEffectArgTypes = ((1, \"effect\"),)\r\n\t_MagGetFullscreenColorEffectFuncType = WINFUNCTYPE(BOOL, POINTER(MAGCOLOREFFECT))\r\n\t_MagGetFullscreenColorEffectArgTypes = ((2, \"effect\"),)\r\n\r\n\tMagInitialize = _MagInitializeFuncType((\"MagInitialize\", _magnification))\r\n\tMagInitialize.errcheck = _errCheck\r\n\tMagUninitialize = _MagUninitializeFuncType((\"MagUninitialize\", _magnification))\r\n\tMagUninitialize.errcheck = _errCheck\r\n\ttry:\r\n\t\tMagSetFullscreenColorEffect = _MagSetFullscreenColorEffectFuncType(\r\n\t\t\t(\"MagSetFullscreenColorEffect\", _magnification),\r\n\t\t\t_MagSetFullscreenColorEffectArgTypes\r\n\t\t)\r\n\t\tMagSetFullscreenColorEffect.errcheck = _errCheck\r\n\t\tMagGetFullscreenColorEffect = _MagGetFullscreenColorEffectFuncType(\r\n\t\t\t(\"MagGetFullscreenColorEffect\", _magnification),\r\n\t\t\t_MagGetFullscreenColorEffectArgTypes\r\n\t\t)\r\n\t\tMagGetFullscreenColorEffect.errcheck = _errCheck\r\n\texcept AttributeError:\r\n\t\tMagSetFullscreenColorEffect = None\r\n\t\tMagGetFullscreenColorEffect = None\r\n\r\n\r\nclass VisionEnhancementProvider(vision.providerBase.VisionEnhancementProvider):\r\n\tname = \"screenCurtain\"\r\n\t# Translators: Description of a vision enhancement provider that disables output to the screen,\r\n\t# making it black.\r\n\tdescription = _(\"Screen Curtain\")\r\n\tsupportedRoles = frozenset([vision.constants.Role.COLORENHANCER])\r\n\r\n\t@classmethod\r\n\tdef canStart(cls):\r\n\t\treturn winVersion.isFullScreenMagnificationAvailable()\r\n\r\n\tdef __init__(self):\r\n\t\tsuper(VisionEnhancementProvider, self).__init__()\r\n\t\tMagnification.MagInitialize()\r\n\t\tMagnification.MagSetFullscreenColorEffect(TRANSFORM_BLACK)\r\n\r\n\tdef terminate(self):\r\n\t\tsuper(VisionEnhancementProvider, self).terminate()\r\n\t\tMagnification.MagUninitialize()\r\n\r\n\tdef registerEventExtensionPoints(self, extensionPoints):\r\n\t\t# The screen curtain isn't interested in any events\r\n\t\tpass\r\n", "path": "source/visionEnhancementProviders/screenCurtain.py"}]}