From 6a95897ec6fd3b7abf7b0098929450da00504120 Mon Sep 17 00:00:00 2001
From: Manuel Kaufmann <humitos@gmail.com>
Date: Wed, 5 Dec 2012 10:11:53 -0300
Subject: [PATCH] Screenshot (global key Alt+1) fixed SL #4104
Without this PATCH we were getting always the same screenshot (image
repeated) every time that we pressed Alt+1.
Use the same method used in Browse for its Bookmark previews.
Now we create a similar_surface and paste the content of
Gdk.default_root_window()
Signed-off-by: Manuel Kaufmann <humitos@gmail.com>
---
extensions/globalkey/screenshot.py | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/extensions/globalkey/screenshot.py b/extensions/globalkey/screenshot.py
index 5abf15b..4ece642 100644
a
|
b
|
def handle_key_press(key): |
42 | 42 | window = Gdk.get_default_root_window() |
43 | 43 | width, height = window.get_width(), window.get_height() |
44 | 44 | |
45 | | window_cr = Gdk.cairo_create(window) |
46 | | window_surface = window_cr.get_target() |
47 | | screenshot_surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, width, height) |
| 45 | screenshot_surface = Gdk.Window.create_similar_surface( |
| 46 | window, cairo.CONTENT_COLOR, width, height) |
| 47 | |
48 | 48 | cr = cairo.Context(screenshot_surface) |
49 | | cr.set_source_surface(window_surface) |
| 49 | Gdk.cairo_set_source_window(cr, window, 0, 0) |
50 | 50 | cr.paint() |
51 | 51 | screenshot_surface.write_to_png(file_path) |
52 | 52 | |