rendered paste bodydiff --git a/sugar/graphics/window.py b/sugar/graphics/window.py
index 28fdb35..da9fbc9 100644
--- a/sugar/graphics/window.py
+++ b/sugar/graphics/window.py
@@ -54,6 +54,18 @@ class Window(gtk.Window):
group.realize()
window.window.set_group(group.window)
+ def _draw_on_pixmap(self, pixmap, window, origin_x, origin_y):
+ x, y, width, height, depth = window.get_geometry()
+
+ x += origin_x
+ y += origin_y
+
+ if depth > 0:
+ pixmap.draw_drawable(window.new_gc(), window, 0, 0,
+ x, y, width, height)
+ for child in window.get_children():
+ self._draw_on_pixmap(pixmap, child, x, y)
+
def get_canvas_screenshot(self):
if not self.canvas:
return None
@@ -61,8 +73,12 @@ class Window(gtk.Window):
window = self.canvas.window
width, height = window.get_size()
+ pixmap = gtk.gdk.Pixmap(window, width, height)
+ self._draw_on_pixmap(pixmap, window, 0, 0)
+
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
+