prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Running game changes to default X cursor in main window
  ![cursor](https://i.imgbox.com/uyN4gDZq.png)
  
  I think [this is the code](https://github.com/lutris/lutris/blob/cbe6f5d5d982543a66f95aa62f0d8e26dd462470/lutris/util/display.py#L10) that sets the cursor. This was introduced in the commit https://github.com/lutris/lutris/commit/4bb2d78e5c3626057f9dc10dcc27f74ae67853b9
  
  Right now it's using [GdkCursorType](https://developer.gnome.org/gdk3/stable/gdk3-Cursors.html#GdkCursorType) to set cursor, but it seems like we should be using [gdk_cursor_new_from_name()](https://developer.gnome.org/gdk3/stable/gdk3-Cursors.html#gdk-cursor-new-from-name) instead which is the recommended way.
  
  
  </issue>
  <code>
  [start of lutris/util/display.py]
  1 import subprocess
  2 from gi.repository import Gdk
  3 
  4 from lutris.util.log import logger
  5 
  6 
  7 def set_cursor(name, window, display=None):
  8     """Set a named mouse cursor for the given window."""
  9     cursors = {
  10         'default': Gdk.CursorType.ARROW,
  11         'wait': Gdk.CursorType.WATCH,
  12     }
  13 
  14     if not display:
  15         display = Gdk.Display.get_default()
  16     cursor = Gdk.Cursor.new_for_display(display, cursors[name])
  17     window.set_cursor(cursor)
  18 
  19 
  20 def get_vidmodes():
  21     xrandr_output = subprocess.Popen(["xrandr"],
  22                                      stdout=subprocess.PIPE).communicate()[0]
  23     return list([line for line in xrandr_output.decode().split("\n")])
  24 
  25 
  26 def get_outputs():
  27     """Return list of tuples containing output name and geometry."""
  28     outputs = []
  29     vid_modes = get_vidmodes()
  30     if not vid_modes:
  31         logger.error("xrandr didn't return anything")
  32         return []
  33     for line in vid_modes:
  34         parts = line.split()
  35         if len(parts) < 2:
  36             continue
  37         if parts[1] == 'connected':
  38             if len(parts) == 2:
  39                 continue
  40             geom = parts[2] if parts[2] != 'primary' else parts[3]
  41             if geom.startswith('('):  # Screen turned off, no geometry
  42                 continue
  43             outputs.append((parts[0], geom))
  44     return outputs
  45 
  46 
  47 def get_output_names():
  48     return [output[0] for output in get_outputs()]
  49 
  50 
  51 def turn_off_except(display):
  52     for output in get_outputs():
  53         if output[0] != display:
  54             subprocess.Popen(["xrandr", "--output", output[0], "--off"])
  55 
  56 
  57 def get_resolutions():
  58     """Return the list of supported screen resolutions."""
  59     resolution_list = []
  60     for line in get_vidmodes():
  61         if line.startswith("  "):
  62             resolution_list.append(line.split()[0])
  63     return resolution_list
  64 
  65 
  66 def get_current_resolution(monitor=0):
  67     """Return the current resolution for the desktop."""
  68     resolution = list()
  69     for line in get_vidmodes():
  70         if line.startswith("  ") and "*" in line:
  71             resolution.append(line.split()[0])
  72     if monitor == 'all':
  73         return resolution
  74     else:
  75         return resolution[monitor]
  76 
  77 
  78 def change_resolution(resolution):
  79     """Change display resolution.
  80 
  81     Takes a string for single monitors or a list of displays as returned
  82     by get_outputs().
  83     """
  84     if not resolution:
  85         logger.warning("No resolution provided")
  86         return
  87     if isinstance(resolution, str):
  88         logger.debug("Switching resolution to %s", resolution)
  89 
  90         if resolution not in get_resolutions():
  91             logger.warning("Resolution %s doesn't exist." % resolution)
  92         else:
  93             subprocess.Popen(["xrandr", "-s", resolution])
  94     else:
  95         for display in resolution:
  96             display_name = display[0]
  97             logger.debug("Switching to %s on %s", display[1], display[0])
  98             display_geom = display[1].split('+')
  99             display_resolution = display_geom[0]
  100             position = (display_geom[1], display_geom[2])
  101 
  102             subprocess.Popen([
  103                 "xrandr",
  104                 "--output", display_name,
  105                 "--mode", display_resolution,
  106                 "--pos", "{}x{}".format(position[0], position[1])
  107             ]).communicate()
  108 
  109 
  110 def restore_gamma():
  111     """Restores gamma to a normal level."""
  112     subprocess.Popen(["xgamma", "-gamma", "1.0"])
  113
  [end of lutris/util/display.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/lutris/util/display.py b/lutris/util/display.py
  --- a/lutris/util/display.py
  +++ b/lutris/util/display.py
  @@ -6,14 +6,10 @@
   
   def set_cursor(name, window, display=None):
       """Set a named mouse cursor for the given window."""
  -    cursors = {
  -        'default': Gdk.CursorType.ARROW,
  -        'wait': Gdk.CursorType.WATCH,
  -    }
   
       if not display:
           display = Gdk.Display.get_default()
  -    cursor = Gdk.Cursor.new_for_display(display, cursors[name])
  +    cursor = Gdk.Cursor.new_from_name(display, name)
       window.set_cursor(cursor)
  
verification_info: {"golden_diff": "diff --git a/lutris/util/display.py b/lutris/util/display.py\n--- a/lutris/util/display.py\n+++ b/lutris/util/display.py\n@@ -6,14 +6,10 @@\n \n def set_cursor(name, window, display=None):\n     \"\"\"Set a named mouse cursor for the given window.\"\"\"\n-    cursors = {\n-        'default': Gdk.CursorType.ARROW,\n-        'wait': Gdk.CursorType.WATCH,\n-    }\n \n     if not display:\n         display = Gdk.Display.get_default()\n-    cursor = Gdk.Cursor.new_for_display(display, cursors[name])\n+    cursor = Gdk.Cursor.new_from_name(display, name)\n     window.set_cursor(cursor)\n", "issue": "Running game changes to default X cursor in main window\n![cursor](https://i.imgbox.com/uyN4gDZq.png)\n\nI think [this is the code](https://github.com/lutris/lutris/blob/cbe6f5d5d982543a66f95aa62f0d8e26dd462470/lutris/util/display.py#L10) that sets the cursor. This was introduced in the commit https://github.com/lutris/lutris/commit/4bb2d78e5c3626057f9dc10dcc27f74ae67853b9\n\nRight now it's using [GdkCursorType](https://developer.gnome.org/gdk3/stable/gdk3-Cursors.html#GdkCursorType) to set cursor, but it seems like we should be using [gdk_cursor_new_from_name()](https://developer.gnome.org/gdk3/stable/gdk3-Cursors.html#gdk-cursor-new-from-name) instead which is the recommended way.\n\n", "before_files": [{"content": "import subprocess\nfrom gi.repository import Gdk\n\nfrom lutris.util.log import logger\n\n\ndef set_cursor(name, window, display=None):\n    \"\"\"Set a named mouse cursor for the given window.\"\"\"\n    cursors = {\n        'default': Gdk.CursorType.ARROW,\n        'wait': Gdk.CursorType.WATCH,\n    }\n\n    if not display:\n        display = Gdk.Display.get_default()\n    cursor = Gdk.Cursor.new_for_display(display, cursors[name])\n    window.set_cursor(cursor)\n\n\ndef get_vidmodes():\n    xrandr_output = subprocess.Popen([\"xrandr\"],\n                                     stdout=subprocess.PIPE).communicate()[0]\n    return list([line for line in xrandr_output.decode().split(\"\\n\")])\n\n\ndef get_outputs():\n    \"\"\"Return list of tuples containing output name and geometry.\"\"\"\n    outputs = []\n    vid_modes = get_vidmodes()\n    if not vid_modes:\n        logger.error(\"xrandr didn't return anything\")\n        return []\n    for line in vid_modes:\n        parts = line.split()\n        if len(parts) < 2:\n            continue\n        if parts[1] == 'connected':\n            if len(parts) == 2:\n                continue\n            geom = parts[2] if parts[2] != 'primary' else parts[3]\n            if geom.startswith('('):  # Screen turned off, no geometry\n                continue\n            outputs.append((parts[0], geom))\n    return outputs\n\n\ndef get_output_names():\n    return [output[0] for output in get_outputs()]\n\n\ndef turn_off_except(display):\n    for output in get_outputs():\n        if output[0] != display:\n            subprocess.Popen([\"xrandr\", \"--output\", output[0], \"--off\"])\n\n\ndef get_resolutions():\n    \"\"\"Return the list of supported screen resolutions.\"\"\"\n    resolution_list = []\n    for line in get_vidmodes():\n        if line.startswith(\"  \"):\n            resolution_list.append(line.split()[0])\n    return resolution_list\n\n\ndef get_current_resolution(monitor=0):\n    \"\"\"Return the current resolution for the desktop.\"\"\"\n    resolution = list()\n    for line in get_vidmodes():\n        if line.startswith(\"  \") and \"*\" in line:\n            resolution.append(line.split()[0])\n    if monitor == 'all':\n        return resolution\n    else:\n        return resolution[monitor]\n\n\ndef change_resolution(resolution):\n    \"\"\"Change display resolution.\n\n    Takes a string for single monitors or a list of displays as returned\n    by get_outputs().\n    \"\"\"\n    if not resolution:\n        logger.warning(\"No resolution provided\")\n        return\n    if isinstance(resolution, str):\n        logger.debug(\"Switching resolution to %s\", resolution)\n\n        if resolution not in get_resolutions():\n            logger.warning(\"Resolution %s doesn't exist.\" % resolution)\n        else:\n            subprocess.Popen([\"xrandr\", \"-s\", resolution])\n    else:\n        for display in resolution:\n            display_name = display[0]\n            logger.debug(\"Switching to %s on %s\", display[1], display[0])\n            display_geom = display[1].split('+')\n            display_resolution = display_geom[0]\n            position = (display_geom[1], display_geom[2])\n\n            subprocess.Popen([\n                \"xrandr\",\n                \"--output\", display_name,\n                \"--mode\", display_resolution,\n                \"--pos\", \"{}x{}\".format(position[0], position[1])\n            ]).communicate()\n\n\ndef restore_gamma():\n    \"\"\"Restores gamma to a normal level.\"\"\"\n    subprocess.Popen([\"xgamma\", \"-gamma\", \"1.0\"])\n", "path": "lutris/util/display.py"}]}