Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/sugar
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <mpg@redhat.com>2007-08-23 19:17:43 (GMT)
committer Marco Pesenti Gritti <mpg@redhat.com>2007-08-23 19:17:43 (GMT)
commit6b30262cf78de2beaf03fe248f290be8f4da5b35 (patch)
treef208092640981bc90a8e7fec88ac9146ae7d258c /sugar
parent6b5703ac964f6fb470aac4ce1370d4e092ab7403 (diff)
Redraw the window only if allocation changed. Patch
by benzea, with a little cleanup and comments by me.
Diffstat (limited to 'sugar')
-rw-r--r--sugar/graphics/palette.py16
1 files changed, 15 insertions, 1 deletions
diff --git a/sugar/graphics/palette.py b/sugar/graphics/palette.py
index 70abc2e..15cd661 100644
--- a/sugar/graphics/palette.py
+++ b/sugar/graphics/palette.py
@@ -104,6 +104,7 @@ class Palette(gtk.Window):
self.set_resizable(False)
self.connect('realize', self._realize_cb)
+ self._old_alloc = None
self._full_request = [0, 0]
self._cursor_x = 0
self._cursor_y = 0
@@ -219,7 +220,20 @@ class Palette(gtk.Window):
def do_size_allocate(self, allocation):
gtk.Window.do_size_allocate(self, allocation)
- self.queue_draw()
+
+ if self._old_alloc is None or \
+ self._old_alloc.x != allocation.x or \
+ self._old_alloc.y != allocation.y or \
+ self._old_alloc.width != allocation.width or \
+ self._old_alloc.height != allocation.height:
+ self.queue_draw()
+
+ # We need to store old allocation because when size_allocate
+ # is called widget.allocation is already updated.
+ # gtk.Window resizing is different from normal containers:
+ # the X window is resized, widget.allocation is updated from
+ # the configure request handler and finally size_allocate is called.
+ self._old_alloc = allocation
def do_expose_event(self, event):
# We want to draw a border with a beautiful gap