# HG changeset patch # User Aleksej Bobylev # Date 1352253938 0 # Node ID ac0701daf97a8f8b405113ef58c454a52bd9df10 # Parent a00b16a1dca0a2ccb5bc53fa4279cfaa6019e8a2 scrot: up 0.8-12 (with patches) diff -r a00b16a1dca0 -r ac0701daf97a scrot/receipt --- a/scrot/receipt Tue Nov 06 16:37:56 2012 +0100 +++ b/scrot/receipt Wed Nov 07 02:05:38 2012 +0000 @@ -1,31 +1,30 @@ # SliTaz package receipt. PACKAGE="scrot" -VERSION="0.8" +VERSION="0.8-12" CATEGORY="x-window" -SHORT_DESC="A screen capture utility." -MAINTAINER="rocky@slitaz.org" -DEPENDS="giblib" -BUILD_DEPENDS="giblib giblib-dev imlib2-dev" -TARBALL="$PACKAGE-$VERSION.tar.gz" -WEB_SITE="http://www.linuxbrit.co.uk/scrot" +SHORT_DESC="A screen capture utility" +MAINTAINER="al.bobylev@gmail.com" +DEPENDS="bzlib freetype giblib glibc-base imlib2 libxcb xorg-libX11 \ +xorg-libXau xorg-libXdmcp xorg-libXext zlib" +BUILD_DEPENDS="patch giblib-dev imlib2-dev xorg-libX11-dev" +TARBALL="$PACKAGE-${VERSION%-*}.tar.gz" +WEB_SITE="http://freecode.com/projects/scrot" WGET_URL="http://www.linuxbrit.co.uk/downloads/$TARBALL" # Rules to configure and make the package. compile_rules() { - cd $src - ./configure --prefix=/usr \ - --mandir=/usr/share/man \ - --disable-nls \ - $CONFIGURE_ARGS && - make && - make DESTDIR=$PWD/_pkg install + cd $src + patch -p1 < $stuff/scrot.patch + ./configure $CONFIGURE_ARGS && + make && + make DESTDIR=$PWD/_pkg install } # Rules to gen a SliTaz package suitable for Tazpkg. genpkg_rules() { - mkdir -p $fs/usr - cp -a $_pkg/usr/bin $fs/usr + mkdir -p $fs/usr + cp -a $_pkg/usr/bin $fs/usr } diff -r a00b16a1dca0 -r ac0701daf97a scrot/stuff/scrot.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scrot/stuff/scrot.patch Wed Nov 07 02:05:38 2012 +0000 @@ -0,0 +1,440 @@ +# This patch was created manually from patches found here: +# http://scrot.sourcearchive.com/downloads/0.8-12/scrot_0.8-12.debian.tar.gz + +## 01_manpagefix.dpatch by William Vera +## DP: Character cleanup for UTF-8 compatibility. + +--- scrot-0.8-orig/scrot.1 ++++ scrot-0.8/scrot.1 +@@ -87,7 +87,7 @@ + \\n prints a newline (ignored when used in the filename) + .fi + .SH EXAMPLE +-scrot '%Y-%m-%d_$wx$h.png' -e 'mv $f ~/shots/' ++scrot '%Y\-%m\-%d_$wx$h.png' \-e 'mv $f ~/shots/' + .br + This would create a file called something like + 2000-10-30_2560x1024.png and move it to your shots directory. + +## 02_options.c.dpatch by William Vera +## DP: A little fix for wrong words. + +--- scrot-0.8-orig/src/options.c ++++ scrot-0.8/src/options.c +@@ -229,7 +229,7 @@ + " low quality means high compression.\n" + " -m, --multidisp For multiple heads, grab shot from each\n" + " and join them together.\n" +- " -s, --select interactively choose a window or rectnagle\n" ++ " -s, --select interactively choose a window or rectangle\n" + " with the mouse\n" + " -t, --thumb NUM generate thumbnail too. NUM is the percentage\n" + " of the original size for the thumbnail to be,\n" +@@ -238,7 +238,7 @@ + " Both the --exec and filename parameters can take format specifiers\n" + " that are expanded by " PACKAGE " when encountered.\n" + " There are two types of format specifier. Characters preceded by a '%%'\n" +- " are interpretted by strftime(2). See man strftime for examples.\n" ++ " are interpreted by strftime(2). See man strftime for examples.\n" + " These options may be used to refer to the current date and time.\n" + " The second kind are internal to " PACKAGE + " and are prefixed by '$'\n" + +## 003_descmanpage.dpatch by William Vera +## DP: Change the description on manpage. + +--- scrot-0.8-orig/scrot.1 ++++ scrot-0.8/scrot.1 +@@ -1,6 +1,6 @@ + .TH scrot 1 "Oct 26, 2000" + .SH NAME +-scrot - Screen capture using imlib2 ++scrot - capture a screenshot using imlib2 + .SH SYNOPSIS + scrot [options] [file] + .SH DESCRIPTION + +## 04-focused.dpatch by James Cameron +## DP: src/options.c (scrot_parse_option_array): add --focused option. +## DP: src/main.c (scrot_get_geometry, scrot_nice_clip): new functions +## for common code used by both selected and focused screenshot. +## DP: src/main.c (scrot_grab_focused): new function to grab currently +## focused window after specified delay. + +--- scrot-0.8-orig/src/options.h ++++ scrot-0.8/src/options.h +@@ -32,6 +32,7 @@ + int delay; + int countdown; + int select; ++ int focused; + int quality; + int border; + int multidisp; +--- scrot-0.8-orig/src/options.c ++++ scrot-0.8/src/options.c +@@ -44,13 +44,15 @@ + static void + scrot_parse_option_array(int argc, char **argv) + { +- static char stropts[] = "bcd:e:hmq:st:v+:"; ++ static char stropts[] = "bcd:e:hmq:st:uv+:"; + static struct option lopts[] = { + /* actions */ + {"help", 0, 0, 'h'}, /* okay */ + {"version", 0, 0, 'v'}, /* okay */ + {"count", 0, 0, 'c'}, + {"select", 0, 0, 's'}, ++ {"focused", 0, 0, 'u'}, ++ {"focussed", 0, 0, 'u'}, /* macquarie dictionary has both spellings */ + {"border", 0, 0, 'b'}, + {"multidisp", 0, 0, 'm'}, + /* toggles */ +@@ -95,6 +97,9 @@ + case 's': + opt.select = 1; + break; ++ case 'u': ++ opt.focused = 1; ++ break; + case '+': + opt.debug_level = atoi(optarg); + break; +@@ -231,6 +236,7 @@ + " and join them together.\n" + " -s, --select interactively choose a window or rectangle\n" + " with the mouse\n" ++ " -u, --focused use the currently focused window\n" + " -t, --thumb NUM generate thumbnail too. NUM is the percentage\n" + " of the original size for the thumbnail to be,\n" + " or the geometry in percent, e.g. 50x60 or 80x20.\n" +--- scrot-0.8-orig/src/scrot.h ++++ scrot-0.8/src/scrot.h +@@ -72,7 +72,10 @@ + char *filename_im, char *filename_thumb); + void scrot_do_delay(void); + Imlib_Image scrot_sel_and_grab_image(void); ++Imlib_Image scrot_grab_focused(void); + void scrot_sel_area(int *x, int *y, int *w, int *h); ++void scrot_nice_clip(int *rx, int *ry, int *rw, int *rh); ++int scrot_get_geometry(Window target, int *rx, int *ry, int *rw, int *rh); + Window scrot_get_window(Display *display,Window window,int x,int y); + Window scrot_get_client_window(Display * display, Window target); + Window scrot_find_window_by_property(Display * display, const Window window, +--- scrot-0.8-orig/src/main.c ++++ scrot-0.8/src/main.c +@@ -48,7 +48,9 @@ + } + + +- if (opt.select) ++ if (opt.focused) ++ image = scrot_grab_focused(); ++ else if (opt.select) + image = scrot_sel_and_grab_image(); + else { + scrot_do_delay(); +@@ -171,6 +173,22 @@ + } + + Imlib_Image ++scrot_grab_focused(void) ++{ ++ Imlib_Image im = NULL; ++ int rx = 0, ry = 0, rw = 0, rh = 0; ++ Window target = None; ++ int ignored; ++ ++ scrot_do_delay(); ++ XGetInputFocus(disp, &target, &ignored); ++ if (!scrot_get_geometry(target, &rx, &ry, &rw, &rh)) return NULL; ++ scrot_nice_clip(&rx, &ry, &rw, &rh); ++ im = gib_imlib_create_image_from_drawable(root, 0, rx, ry, rw, rh, 1); ++ return im; ++} ++ ++Imlib_Image + scrot_sel_and_grab_image(void) + { + Imlib_Image im = NULL; +@@ -313,57 +331,10 @@ + rh = 0 - rh; + } + } else { +- Window child; +- XWindowAttributes attr; +- int stat; +- + /* else it's a window click */ +- /* get geometry of window and use that */ +- /* get windowmanager frame of window */ +- if (target != root) { +- unsigned int d, x; +- int status; +- +- status = XGetGeometry(disp, target, &root, &x, &x, &d, &d, &d, &d); +- if (status != 0) { +- Window rt, *children, parent; +- +- for (;;) { +- /* Find window manager frame. */ +- status = XQueryTree(disp, target, &rt, &parent, &children, &d); +- if (status && (children != None)) +- XFree((char *) children); +- if (!status || (parent == None) || (parent == rt)) +- break; +- target = parent; +- } +- /* Get client window. */ +- if (!opt.border) +- target = scrot_get_client_window(disp, target); +- XRaiseWindow(disp, target); +- } +- } +- stat = XGetWindowAttributes(disp, target, &attr); +- if ((stat == False) || (attr.map_state != IsViewable)) +- return NULL; +- rw = attr.width; +- rh = attr.height; +- XTranslateCoordinates(disp, target, root, 0, 0, &rx, &ry, &child); ++ if (!scrot_get_geometry(target, &rx, &ry, &rw, &rh)) return NULL; + } +- +- /* clip rectangle nicely */ +- if (rx < 0) { +- rw += rx; +- rx = 0; +- } +- if (ry < 0) { +- rh += ry; +- ry = 0; +- } +- if ((rx + rw) > scr->width) +- rw = scr->width - rx; +- if ((ry + rh) > scr->height) +- rh = scr->height - ry; ++ scrot_nice_clip(&rx, &ry, &rw, &rh); + + XBell(disp, 0); + im = gib_imlib_create_image_from_drawable(root, 0, rx, ry, rw, rh, 1); +@@ -371,6 +342,72 @@ + return im; + } + ++/* clip rectangle nicely */ ++void ++scrot_nice_clip(int *rx, ++ int *ry, ++ int *rw, ++ int *rh) ++{ ++ if (*rx < 0) { ++ *rw += *rx; ++ *rx = 0; ++ } ++ if (*ry < 0) { ++ *rh += *ry; ++ *ry = 0; ++ } ++ if ((*rx + *rw) > scr->width) ++ *rw = scr->width - *rx; ++ if ((*ry + *rh) > scr->height) ++ *rh = scr->height - *ry; ++} ++ ++/* get geometry of window and use that */ ++int ++scrot_get_geometry(Window target, ++ int *rx, ++ int *ry, ++ int *rw, ++ int *rh) ++{ ++ Window child; ++ XWindowAttributes attr; ++ int stat; ++ ++ /* get windowmanager frame of window */ ++ if (target != root) { ++ unsigned int d, x; ++ int status; ++ ++ status = XGetGeometry(disp, target, &root, &x, &x, &d, &d, &d, &d); ++ if (status != 0) { ++ Window rt, *children, parent; ++ ++ for (;;) { ++ /* Find window manager frame. */ ++ status = XQueryTree(disp, target, &rt, &parent, &children, &d); ++ if (status && (children != None)) ++ XFree((char *) children); ++ if (!status || (parent == None) || (parent == rt)) ++ break; ++ target = parent; ++ } ++ /* Get client window. */ ++ if (!opt.border) ++ target = scrot_get_client_window(disp, target); ++ XRaiseWindow(disp, target); ++ } ++ } ++ stat = XGetWindowAttributes(disp, target, &attr); ++ if ((stat == False) || (attr.map_state != IsViewable)) ++ return 0; ++ *rw = attr.width; ++ *rh = attr.height; ++ XTranslateCoordinates(disp, target, root, 0, 0, rx, ry, &child); ++ return 1; ++} ++ + Window + scrot_get_window(Display * display, + Window window, + +## 05-addfocusedmanpage.dpatch by William Vera +## DP: Add a new option in the man page (focused option). + +--- scrot-0.8-orig/scrot.1 ++++ scrot-0.8/scrot.1 +@@ -43,6 +43,9 @@ + .B -s, --select + Interactively select a window or rectangle with the mouse. + .TP 5 ++.B -u, --focused ++Use the currently focused window. ++.TP 5 + .B -t, --thumb NUM + generate thumbnail too. NUM is the percentage of the original size for the + thumbnail to be. + +## 06_manpagespace.dpatch by William Vera +## DP: Improve spacing in manual page. + +--- scrot-0.8-orig/scrot.1 ++++ scrot-0.8/scrot.1 +@@ -58,7 +58,7 @@ + These options may be used to refer to the current date and time. + The second kind are internal to scrot and are prefixed by '$' + The following specifiers are recognised: +-.br ++.PP + .B $f + image path/filename (ignored when used in the filename) + .br + +## 07_fix-formatstring.dpatch by George Danchev +## DP: Prevent arbitrary long file names + +--- scrot-0.8-orig/src/options.c ++++ scrot-0.8/src/options.c +@@ -124,6 +124,12 @@ + if (!opt.output_file) + { + opt.output_file = argv[optind++]; ++ ++ if ( strlen(opt.output_file) > 256 ) { ++ printf("output filename too long.\n"); ++ exit(EXIT_FAILURE); ++ } ++ + if (opt.thumb) + opt.thumb_file = name_thumbnail(opt.output_file); + } + +## fix-beeping.dpatch by Ibragimov Rinat +## DP: Fix missing option for beep prevention. + +--- scrot-0.8-orig/scrot.1 ++++ scrot-0.8/scrot.1 +@@ -49,6 +49,9 @@ + .B -t, --thumb NUM + generate thumbnail too. NUM is the percentage of the original size for the + thumbnail to be. ++.TP 5 ++.B -z, --silent ++prevent beeping. + .SH SPECIAL STRINGS + Both the + .B --exec +--- scrot-0.8-orig/src/main.c ++++ scrot-0.8/src/main.c +@@ -154,7 +154,7 @@ + { + Imlib_Image im; + +- XBell(disp, 0); ++ if (! opt.silent) XBell(disp, 0); + im = + gib_imlib_create_image_from_drawable(root, 0, 0, 0, scr->width, + scr->height, 1); +@@ -336,7 +336,7 @@ + } + scrot_nice_clip(&rx, &ry, &rw, &rh); + +- XBell(disp, 0); ++ if (! opt.silent) XBell(disp, 0); + im = gib_imlib_create_image_from_drawable(root, 0, rx, ry, rw, rh, 1); + } + return im; +--- scrot-0.8-orig/src/options.c ++++ scrot-0.8/src/options.c +@@ -44,7 +44,7 @@ + static void + scrot_parse_option_array(int argc, char **argv) + { +- static char stropts[] = "bcd:e:hmq:st:uv+:"; ++ static char stropts[] = "bcd:e:hmq:st:uv+:z"; + static struct option lopts[] = { + /* actions */ + {"help", 0, 0, 'h'}, /* okay */ +@@ -55,6 +55,7 @@ + {"focussed", 0, 0, 'u'}, /* macquarie dictionary has both spellings */ + {"border", 0, 0, 'b'}, + {"multidisp", 0, 0, 'm'}, ++ {"silent", 0, 0, 'z'}, + /* toggles */ + {"thumb", 1, 0, 't'}, + {"delay", 1, 0, 'd'}, +@@ -109,6 +110,9 @@ + case 't': + options_parse_thumbnail(optarg); + break; ++ case 'z': ++ opt.silent = 1; ++ break; + default: + break; + } +@@ -246,6 +250,7 @@ + " -t, --thumb NUM generate thumbnail too. NUM is the percentage\n" + " of the original size for the thumbnail to be,\n" + " or the geometry in percent, e.g. 50x60 or 80x20.\n" ++ " -z, --silent Prevent beeping\n" + "\n" " SPECIAL STRINGS\n" + " Both the --exec and filename parameters can take format specifiers\n" + " that are expanded by " PACKAGE " when encountered.\n" +--- scrot-0.8-orig/src/options.h ++++ scrot-0.8/src/options.h +@@ -35,6 +35,7 @@ + int focused; + int quality; + int border; ++ int silent; + int multidisp; + int thumb; + int thumb_width; + +## 09_fix-minusign.dpatch by William Vera +## DP: Fix a hyphen-used-as-minus-sign in a manpage. + +--- scrot-0.8-orig/scrot.1 ++++ scrot-0.8/scrot.1 +@@ -93,7 +93,7 @@ + \\n prints a newline (ignored when used in the filename) + .fi + .SH EXAMPLE +-scrot '%Y-%m-%d_$wx$h.png' -e 'mv $f ~/shots/' ++scrot '%Y-%m-%d_$wx$h.png' \-e 'mv $f ~/shots/' + .br + This would create a file called something like + 2000-10-30_2560x1024.png and move it to your shots directory.