prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  On Linux, window contents are rendered behind a menubar
  But only if the menubar wasn't defined in the application code. Here's a slightly modified [example code](https://toga.readthedocs.io/en/latest/tutorial/tutorial-0.html) I'm running:
  
  ```py
  import toga
  
  def build(app):
      box = toga.Box()
      button = toga.Button('Hello world', on_press=lambda _: print("hello"))
      box.add(button)
      return box
  
  if __name__ == '__main__':
      app = toga.App('First App', 'org.pybee.sample', startup=build)
      app.main_loop()
  ```
  
  Here's how it looks like to me:
  
  ![image](https://cloud.githubusercontent.com/assets/1298948/25163164/ec3de0a8-24d0-11e7-8d31-a07a4051172c.png)
  
  Note that the button is behind the menubar (although no menubar was requested in the code). When I click on the menubar (including the Application or Help menu items), the button is being pressed instead.
  
  I've tried this with a few GTK themes, including Arc-OSX-dark, Mint-X, Redmond and Adwaita, and in every case it behaves this way.
  
  
  </issue>
  <code>
  [start of src/gtk/toga_gtk/widgets/box.py]
  1 from ..libs import Gtk, Gdk
  2 from .base import Widget
  3 
  4 
  5 class TogaBox(Gtk.Fixed):
  6     def __init__(self, impl):
  7         super().__init__()
  8         self._impl = impl
  9         self.interface = self._impl.interface
  10 
  11     def do_get_preferred_width(self):
  12         # Calculate the minimum and natural width of the container.
  13         # print("GET PREFERRED WIDTH", self._impl.native)
  14         width = self._impl.interface.layout.width
  15         min_width = self._impl.min_width
  16         if min_width is None:
  17             min_width = 0
  18         elif min_width > width:
  19             width = min_width
  20 
  21         # print(min_width, width)
  22         return min_width, width
  23 
  24     def do_get_preferred_height(self):
  25         # Calculate the minimum and natural height of the container.
  26         # height = self._impl.layout.height
  27         # print("GET PREFERRED HEIGHT", self._impl.native)
  28         height = self._impl.interface.layout.height
  29         min_height = self._impl.min_height
  30         if min_height is None:
  31             min_height = 0
  32         elif min_height > height:
  33             height = min_height
  34         # print(min_height, height)
  35         return min_height, height
  36 
  37     def do_size_allocate(self, allocation):
  38         # print(self._impl, "Container layout", allocation.width, 'x', allocation.height, ' @ ', allocation.x, 'x', allocation.y)
  39         if self._impl.viewport is not None:
  40             self.set_allocation(allocation)
  41             self.interface.refresh()
  42 
  43             # WARNING! This list of children is *not* the same
  44             # as the list provided by the interface!
  45             # For GTK's layout purposes, all widgets in the tree
  46             # are children of the *container* - that is, the impl
  47             # object of the root object in the tree of widgets.
  48             for widget in self.get_children():
  49                 if not widget.get_visible():
  50                     # print("CHILD NOT VISIBLE", widget.interface)
  51                     pass
  52                 else:
  53                     # print("update ", widget.interface, widget.interface.layout)
  54                     widget.interface._impl.rehint()
  55                     widget_allocation = Gdk.Rectangle()
  56                     widget_allocation.x = widget.interface.layout.absolute_content_left
  57                     widget_allocation.y = widget.interface.layout.absolute_content_top
  58                     widget_allocation.width = widget.interface.layout.content_width
  59                     widget_allocation.height = widget.interface.layout.content_height
  60 
  61                     widget.size_allocate(widget_allocation)
  62 
  63 
  64 class Box(Widget):
  65     def create(self):
  66         self.min_width = None
  67         self.min_height = None
  68         self.native = TogaBox(self)
  69
  [end of src/gtk/toga_gtk/widgets/box.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/src/gtk/toga_gtk/widgets/box.py b/src/gtk/toga_gtk/widgets/box.py
  --- a/src/gtk/toga_gtk/widgets/box.py
  +++ b/src/gtk/toga_gtk/widgets/box.py
  @@ -53,8 +53,8 @@
                       # print("update ", widget.interface, widget.interface.layout)
                       widget.interface._impl.rehint()
                       widget_allocation = Gdk.Rectangle()
  -                    widget_allocation.x = widget.interface.layout.absolute_content_left
  -                    widget_allocation.y = widget.interface.layout.absolute_content_top
  +                    widget_allocation.x = widget.interface.layout.absolute_content_left + allocation.x
  +                    widget_allocation.y = widget.interface.layout.absolute_content_top + allocation.y
                       widget_allocation.width = widget.interface.layout.content_width
                       widget_allocation.height = widget.interface.layout.content_height
  
verification_info: {"golden_diff": "diff --git a/src/gtk/toga_gtk/widgets/box.py b/src/gtk/toga_gtk/widgets/box.py\n--- a/src/gtk/toga_gtk/widgets/box.py\n+++ b/src/gtk/toga_gtk/widgets/box.py\n@@ -53,8 +53,8 @@\n                     # print(\"update \", widget.interface, widget.interface.layout)\n                     widget.interface._impl.rehint()\n                     widget_allocation = Gdk.Rectangle()\n-                    widget_allocation.x = widget.interface.layout.absolute_content_left\n-                    widget_allocation.y = widget.interface.layout.absolute_content_top\n+                    widget_allocation.x = widget.interface.layout.absolute_content_left + allocation.x\n+                    widget_allocation.y = widget.interface.layout.absolute_content_top + allocation.y\n                     widget_allocation.width = widget.interface.layout.content_width\n                     widget_allocation.height = widget.interface.layout.content_height\n", "issue": "On Linux, window contents are rendered behind a menubar\nBut only if the menubar wasn't defined in the application code. Here's a slightly modified [example code](https://toga.readthedocs.io/en/latest/tutorial/tutorial-0.html) I'm running:\r\n\r\n```py\r\nimport toga\r\n\r\ndef build(app):\r\n    box = toga.Box()\r\n    button = toga.Button('Hello world', on_press=lambda _: print(\"hello\"))\r\n    box.add(button)\r\n    return box\r\n\r\nif __name__ == '__main__':\r\n    app = toga.App('First App', 'org.pybee.sample', startup=build)\r\n    app.main_loop()\r\n```\r\n\r\nHere's how it looks like to me:\r\n\r\n![image](https://cloud.githubusercontent.com/assets/1298948/25163164/ec3de0a8-24d0-11e7-8d31-a07a4051172c.png)\r\n\r\nNote that the button is behind the menubar (although no menubar was requested in the code). When I click on the menubar (including the Application or Help menu items), the button is being pressed instead.\r\n\r\nI've tried this with a few GTK themes, including Arc-OSX-dark, Mint-X, Redmond and Adwaita, and in every case it behaves this way.\r\n\n", "before_files": [{"content": "from ..libs import Gtk, Gdk\nfrom .base import Widget\n\n\nclass TogaBox(Gtk.Fixed):\n    def __init__(self, impl):\n        super().__init__()\n        self._impl = impl\n        self.interface = self._impl.interface\n\n    def do_get_preferred_width(self):\n        # Calculate the minimum and natural width of the container.\n        # print(\"GET PREFERRED WIDTH\", self._impl.native)\n        width = self._impl.interface.layout.width\n        min_width = self._impl.min_width\n        if min_width is None:\n            min_width = 0\n        elif min_width > width:\n            width = min_width\n\n        # print(min_width, width)\n        return min_width, width\n\n    def do_get_preferred_height(self):\n        # Calculate the minimum and natural height of the container.\n        # height = self._impl.layout.height\n        # print(\"GET PREFERRED HEIGHT\", self._impl.native)\n        height = self._impl.interface.layout.height\n        min_height = self._impl.min_height\n        if min_height is None:\n            min_height = 0\n        elif min_height > height:\n            height = min_height\n        # print(min_height, height)\n        return min_height, height\n\n    def do_size_allocate(self, allocation):\n        # print(self._impl, \"Container layout\", allocation.width, 'x', allocation.height, ' @ ', allocation.x, 'x', allocation.y)\n        if self._impl.viewport is not None:\n            self.set_allocation(allocation)\n            self.interface.refresh()\n\n            # WARNING! This list of children is *not* the same\n            # as the list provided by the interface!\n            # For GTK's layout purposes, all widgets in the tree\n            # are children of the *container* - that is, the impl\n            # object of the root object in the tree of widgets.\n            for widget in self.get_children():\n                if not widget.get_visible():\n                    # print(\"CHILD NOT VISIBLE\", widget.interface)\n                    pass\n                else:\n                    # print(\"update \", widget.interface, widget.interface.layout)\n                    widget.interface._impl.rehint()\n                    widget_allocation = Gdk.Rectangle()\n                    widget_allocation.x = widget.interface.layout.absolute_content_left\n                    widget_allocation.y = widget.interface.layout.absolute_content_top\n                    widget_allocation.width = widget.interface.layout.content_width\n                    widget_allocation.height = widget.interface.layout.content_height\n\n                    widget.size_allocate(widget_allocation)\n\n\nclass Box(Widget):\n    def create(self):\n        self.min_width = None\n        self.min_height = None\n        self.native = TogaBox(self)\n", "path": "src/gtk/toga_gtk/widgets/box.py"}]}