[Sugar-devel] [PATCH toolkit-gtk3] Frame Device icons: Palette is not drawn at the correct position

Simon Schampijer simon at schampijer.de
Wed Sep 12 06:56:30 EDT 2012


From: Simon Schampijer <simon at laptop.org>

We are adding the x value twice (from the allocation and from the origin)
in get_rect of the WidgetInvoker which we derive from in the FrameInvoker.
In the toolkit-gtk2 code [1] we did add the allocation.x value when
the widget does not provide its own gtk.gdk.Window (gtk.NO_WINDOW) [2]. This
is the same check we do above if the widget has a window and we set x and y
to 0 there which sounds sane enough to me.

[1] http://git.sugarlabs.org/sugar-toolkit/mainline/blobs/d1f68419e79376381fc2c3b111466714f044dfc0/src/sugar/graphics/palettewindow.py#line716
[2] http://www.pygtk.org/docs/pygtk/class-gtkobject.html#method-gtkobject--flags

Signed-off-by: Simon Schampijer <simon at laptop.org>
---
 src/sugar3/graphics/palettewindow.py | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/src/sugar3/graphics/palettewindow.py b/src/sugar3/graphics/palettewindow.py
index ab7e2f2..a4088be 100644
--- a/src/sugar3/graphics/palettewindow.py
+++ b/src/sugar3/graphics/palettewindow.py
@@ -998,24 +998,18 @@ class WidgetInvoker(Invoker):
         allocation = self._widget.get_allocation()
         window = self._widget.get_window()
         if window is not None:
-            res, x, y = window.get_origin()
+            res_, x, y = window.get_origin()
         else:
             logging.warning(
                 "Trying to position palette with invoker that's not realized.")
             x = 0
             y = 0
 
-        x += allocation.x
-        y += allocation.y
-
-        width = allocation.width
-        height = allocation.height
-
         rect = Gdk.Rectangle()
         rect.x = x
         rect.y = y
-        rect.width = width
-        rect.height = height
+        rect.width = allocation.width
+        rect.height = allocation.height
         return rect
 
     def has_rectangle_gap(self):
-- 
1.7.11.4



More information about the Sugar-devel mailing list