Ticket #4104: 0001-Screenshot-global-key-Alt-1-fixed-SL-4104.3.patch

File 0001-Screenshot-global-key-Alt-1-fixed-SL-4104.3.patch, 1.4 KB (added by godiard, 11 years ago)

New patch with a better msg

  • extensions/globalkey/screenshot.py

    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): 
    4242    window = Gdk.get_default_root_window()
    4343    width, height = window.get_width(), window.get_height()
    4444
    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
    4848    cr = cairo.Context(screenshot_surface)
    49     cr.set_source_surface(window_surface)
     49    Gdk.cairo_set_source_window(cr, window, 0, 0)
    5050    cr.paint()
    5151    screenshot_surface.write_to_png(file_path)
    5252