[Sugar-devel] [PATCH sugar-toolkit] Don't put event box in toplevel window
From: Simon Schampijer Remove an unnecessary toplevel widget. This event box was originally added by Marco "to make it easier to take screenshot of the canvas area only" (7f731457c2) but we're unsure why this is, and it doesn't seem to be needed for our current screenshot-taking mechanism. Screenshots continue to work fine after removing this. --- src/sugar/graphics/window.py | 13 + 1 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/sugar/graphics/window.py b/src/sugar/graphics/window.py index b269efc..dbac464 100644 --- a/src/sugar/graphics/window.py +++ b/src/sugar/graphics/window.py @@ -103,12 +103,9 @@ class Window(gtk.Window): self.__vbox.pack_start(self.__hbox) self.__hbox.show() -self._event_box = gtk.EventBox() -self.__hbox.pack_start(self._event_box) -self._event_box.show() -self._event_box.add_events(gtk.gdk.POINTER_MOTION_HINT_MASK - | gtk.gdk.POINTER_MOTION_MASK) -self._event_box.connect('motion-notify-event', self.__motion_notify_cb) +self.add_events(gtk.gdk.POINTER_MOTION_HINT_MASK +| gtk.gdk.POINTER_MOTION_MASK) +self.connect('motion-notify-event', self.__motion_notify_cb) self.add(self.__vbox) self.__vbox.show() @@ -173,10 +170,10 @@ class Window(gtk.Window): def set_canvas(self, canvas): if self._canvas: -self._event_box.remove(self._canvas) +self.__hbox.remove(self._canvas) if canvas: -self._event_box.add(canvas) +self.__hbox.pack_start(canvas) self._canvas = canvas self.__vbox.set_focus_child(self._canvas) -- 1.7.6 ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
Re: [Sugar-devel] [PATCH sugar-toolkit] Don't put event box in toplevel window
On 17 September 2011 12:47, Daniel Drake wrote: > From: Simon Schampijer > > Remove an unnecessary toplevel widget. > > This event box was originally added by Marco "to make it easier > to take screenshot of the canvas area only" (7f731457c2) but we're > unsure why this is, and it doesn't seem to be needed for our current > screenshot-taking mechanism. Screenshots continue to work fine after > removing this. If I remember correctly this was necessary because we was getting snapshots from the X server and we needed to ensure we had an XWindow in the canvas for that to work. It seems like we are using the gtk client side mechanism for snapshots now, so that should not be necessary anymore. The patch looks good to me. Marco ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
Re: [Sugar-devel] [PATCH sugar-toolkit] Don't put event box in toplevel window
Excerpts from Daniel Drake's message of 2011-09-17 13:47:59 +0200: > Remove an unnecessary toplevel widget. [...] Thanks, keep those clean-up patches coming! ;) Acked-By: Sascha Silbe Sascha -- http://sascha.silbe.org/ http://www.infra-silbe.de/ signature.asc Description: PGP signature ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
Re: [Sugar-devel] [PATCH sugar-toolkit] Don't put event box in toplevel window
On Mon, Sep 26, 2011 at 4:42 PM, Sascha Silbe wrote: > Excerpts from Daniel Drake's message of 2011-09-17 13:47:59 +0200: > >> Remove an unnecessary toplevel widget. > [...] > > Thanks, keep those clean-up patches coming! ;) > > Acked-By: Sascha Silbe pushed this one ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel