rendered paste bodydiff --git a/sugar/graphics/window.py b/sugar/graphics/window.py
index 28fdb35..fd6ac21 100644
--- a/sugar/graphics/window.py
+++ b/sugar/graphics/window.py
@@ -54,6 +54,17 @@ class Window(gtk.Window):
group.realize()
window.window.set_group(group.window)
+ def _draw_on_pixmap(self, pixmap, window, origin_x, origin_y, clip_area):
+ x, y, width, height, depth = window.get_geometry()
+ area = gtk.gdk.Rectangle(x + origin_x, y + origin_y, width, height)
+ area = area.intersect(clip_area)
+ if depth > 0:
+ pixmap.draw_drawable(window.new_gc(), window, 0, 0,
+ area.x, area.y, area.width, area.height)
+ for child in window.get_children():
+ self._draw_on_pixmap(pixmap, child,
+ x + origin_x, y + origin_y, area)
+
def get_canvas_screenshot(self):
if not self.canvas:
return None
@@ -61,8 +72,13 @@ class Window(gtk.Window):
window = self.canvas.window
width, height = window.get_size()
+ pixmap = gtk.gdk.Pixmap(window, width, height)
+ area = gtk.gdk.Rectangle(0, 0, width, height)
+ self._draw_on_pixmap(pixmap, window, 0, 0, area)
+
screenshot = gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB, has_alpha=False,
bits_per_sample=8, width=width, height=height)
- screenshot.get_from_drawable(window, window.get_colormap(), 0, 0, 0, 0,
+ screenshot.get_from_drawable(pixmap, pixmap.get_colormap(), 0, 0, 0, 0,
width, height)
return screenshot
+