/usr/lib/gdesklets/utils/wallpaper.py is in gdesklets 0.36.1-5+b1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | try:
from utils.tiling import Tiling
except ImportError:
import sys
log("Could not import tiling module!")
sys.exit(1)
import gtk
tiling = Tiling()
#
# Restricts the given coordinates to visible values.
#
def _crop_coords(x, y, width, height):
scrwidth = gtk.gdk.screen_width()
scrheight = gtk.gdk.screen_height()
x = min(x, scrwidth - 1)
y = min(y, scrheight - 1)
return (x, y, width, height)
#
# Captures the wallpaper image by accessing the background pixmap.
#
def get_wallpaper(widget, x, y, width, height):
x, y, width, height = _crop_coords(x, y, width, height)
# get wallpaper
try:
pmap_id = get_wallpaper_id()
widget.set_from_background(pmap_id, x, y, width, height)
except NotImplementedError:
widget.set_from_background(0, x, y, width, height)
widget.render(width, height, 1, 1)
#
# Returns the ID of the background pixmap.
#
def get_wallpaper_id():
try:
root = gtk.gdk.get_default_root_window()
ident = root.property_get("_XROOTPMAP_ID", "PIXMAP")[2][0]
return long(ident)
except:
raise NotImplementedError
|