From 5ab2b8054633e876da71ffdb6b5f7ee61f5c9930 Mon Sep 17 00:00:00 2001 From: Simon Schampijer Date: Wed, 12 Sep 2012 12:44:20 +0200 Subject: [PATCH] Frame Device icons: Palette is not drawn at the correct position MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Acked-by: Manuel QuiƱones --- 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 ab7e2f2f..a4088be9 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):