diff options
author | Manuel Kaufmann <humitos@gmail.com> | 2012-12-05 13:11:53 (GMT) |
---|---|---|
committer | Manuel QuiƱones <manuq@laptop.org> | 2012-12-10 14:46:55 (GMT) |
commit | 34fb1f8d948d0bc57334a7df94b8e1711f132912 (patch) | |
tree | ec84170ec2ef4bc803a800c3b398e70dd4f62ff9 /extensions | |
parent | 35c51f0dc1e78fb3449284e5612bca7b0f0909ed (diff) |
Screenshot extension: make sure we use a compatible cairo surface - SL #4104
To create the screenshot surface, use
gdk_window_create_similar_surface instead. In toolkit
(Activity.get_preview) we do the same. It creates a more compatible
surface. Otherwise we are hardcoding the format, which showed to fail
in XO-4 hardware.
To set the window surface as the source surface on the new context,
use gdk_cairo_set_source_window instead. This way there is no need to
create a new cairo context to get the surface, use the gdk window
directly instead.
Signed-off-by: Manuel Kaufmann <humitos@gmail.com>
Signed-off-by: Manuel QuiƱones <manuq@laptop.org>
Acked-by: Simon Schampijer <simon@laptop.org>
Diffstat (limited to 'extensions')
-rw-r--r-- | extensions/globalkey/screenshot.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/extensions/globalkey/screenshot.py b/extensions/globalkey/screenshot.py index 5abf15b..4ece642 100644 --- a/extensions/globalkey/screenshot.py +++ b/extensions/globalkey/screenshot.py @@ -42,11 +42,11 @@ def handle_key_press(key): window = Gdk.get_default_root_window() width, height = window.get_width(), window.get_height() - window_cr = Gdk.cairo_create(window) - window_surface = window_cr.get_target() - screenshot_surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, width, height) + screenshot_surface = Gdk.Window.create_similar_surface( + window, cairo.CONTENT_COLOR, width, height) + cr = cairo.Context(screenshot_surface) - cr.set_source_surface(window_surface) + Gdk.cairo_set_source_window(cr, window, 0, 0) cr.paint() screenshot_surface.write_to_png(file_path) |