diff -Nru scrot-0.8/debian/changelog scrot-0.8/debian/changelog --- scrot-0.8/debian/changelog 2010-10-15 16:49:21.000000000 +0000 +++ scrot-0.8/debian/changelog 2010-07-20 21:34:15.000000000 +0000 @@ -1,3 +1,22 @@ +scrot (0.8-13) unstable; urgency=low + + * Changed patch system to 'quilt' + + -- William Vera Tue, 20 Jul 2010 16:32:55 -0500 + +scrot (0.8-12) unstable; urgency=low + + * Added a patch to fix missing option for beep prevention. + (Closes: #586769) Thanks to Ibragimov Rinat + * Updated Standards Version to 3.9.0. + * Updated debhelper version. + * Added ${misc:Depends} in control file. + * Added DM Upload Allowed in control file. + * Switch to dpkg-source 3.0 (quilt) format. + * Added a patch to fix a minus sign in a manpage. + + -- William Vera Wed, 30 Jun 2010 10:00:05 -0500 + scrot (0.8-11) unstable; urgency=low * Changed the Homepage field on control file (Closes: #547486). diff -Nru scrot-0.8/debian/control scrot-0.8/debian/control --- scrot-0.8/debian/control 2010-10-15 16:49:21.000000000 +0000 +++ scrot-0.8/debian/control 2010-07-20 21:30:29.000000000 +0000 @@ -2,13 +2,14 @@ Section: graphics Priority: optional Maintainer: William Vera -Standards-Version: 3.8.3 -Build-Depends: libimlib2-dev, giblib-dev, debhelper (>=7.0.17), autotools-dev, dpatch, libtool +DM-Upload-Allowed: yes +Standards-Version: 3.9.0 +Build-Depends: libimlib2-dev, giblib-dev, debhelper (>=7.0.50~), autotools-dev, libtool Homepage: http://freshmeat.net/projects/scrot Package: scrot Architecture: any -Depends: ${shlibs:Depends} +Depends: ${shlibs:Depends}, ${misc:Depends} Description: command line screen capture utility scrot (SCReen shOT) is a simple commandline screen capture utility that uses imlib2 to grab and save images. Multiple diff -Nru scrot-0.8/debian/patches/003_descmanpage.dpatch scrot-0.8/debian/patches/003_descmanpage.dpatch --- scrot-0.8/debian/patches/003_descmanpage.dpatch 2010-10-15 16:49:21.000000000 +0000 +++ scrot-0.8/debian/patches/003_descmanpage.dpatch 1970-01-01 00:00:00.000000000 +0000 @@ -1,17 +0,0 @@ -#! /bin/sh /usr/share/dpatch/dpatch-run -## 003_descmanpage.dpatch by William Vera -## -## DP: Change the description on manpage. - -@DPATCH@ -diff -urNad scrot-0.8~/scrot.1 scrot-0.8/scrot.1 ---- scrot-0.8~/scrot.1 2001-01-11 11:43:06.000000000 -0600 -+++ scrot-0.8/scrot.1 2009-05-13 06:44:15.000000000 -0500 -@@ -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 diff -Nru scrot-0.8/debian/patches/003_descmanpage.patch scrot-0.8/debian/patches/003_descmanpage.patch --- scrot-0.8/debian/patches/003_descmanpage.patch 1970-01-01 00:00:00.000000000 +0000 +++ scrot-0.8/debian/patches/003_descmanpage.patch 2010-07-20 21:28:23.000000000 +0000 @@ -0,0 +1,12 @@ +Author: William Vera +Description: Change the description on manpage. +--- a/scrot.1 ++++ b/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 diff -Nru scrot-0.8/debian/patches/00list scrot-0.8/debian/patches/00list --- scrot-0.8/debian/patches/00list 2010-10-15 16:49:21.000000000 +0000 +++ scrot-0.8/debian/patches/00list 1970-01-01 00:00:00.000000000 +0000 @@ -1,7 +0,0 @@ -01_manpagefix.dpatch -02_options.c.dpatch -003_descmanpage.dpatch -04-focused.dpatch -05-addfocusedmanpage.dpatch -06_manpagespace.dpatch -07_fix-formatstring.dpatch diff -Nru scrot-0.8/debian/patches/01_manpagefix.dpatch scrot-0.8/debian/patches/01_manpagefix.dpatch --- scrot-0.8/debian/patches/01_manpagefix.dpatch 2010-10-15 16:49:21.000000000 +0000 +++ scrot-0.8/debian/patches/01_manpagefix.dpatch 1970-01-01 00:00:00.000000000 +0000 @@ -1,18 +0,0 @@ -#! /bin/sh /usr/share/dpatch/dpatch-run -## 01_manpagefix.dpatch by William Vera -## -## DP: Character cleanup for UTF-8 compatibility. - -@DPATCH@ -diff -urNad scrot-0.8~/scrot.1 scrot-0.8/scrot.1 ---- scrot-0.8~/scrot.1 2001-01-11 11:43:06.000000000 -0600 -+++ scrot-0.8/scrot.1 2008-08-15 00:46:36.000000000 -0500 -@@ -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. diff -Nru scrot-0.8/debian/patches/01_manpagefix.patch scrot-0.8/debian/patches/01_manpagefix.patch --- scrot-0.8/debian/patches/01_manpagefix.patch 1970-01-01 00:00:00.000000000 +0000 +++ scrot-0.8/debian/patches/01_manpagefix.patch 2010-07-20 21:28:18.000000000 +0000 @@ -0,0 +1,13 @@ +Author: William Vera +Description: Character cleanup for UTF-8 compatibility. +--- a/scrot.1 ++++ b/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. diff -Nru scrot-0.8/debian/patches/02_options.c.dpatch scrot-0.8/debian/patches/02_options.c.dpatch --- scrot-0.8/debian/patches/02_options.c.dpatch 2010-10-15 16:49:21.000000000 +0000 +++ scrot-0.8/debian/patches/02_options.c.dpatch 1970-01-01 00:00:00.000000000 +0000 @@ -1,27 +0,0 @@ -#! /bin/sh /usr/share/dpatch/dpatch-run -## 02_options.c.dpatch by William Vera -## -## DP: A little fix for wrong words. - -@DPATCH@ -diff -urNad scrot-0.8~/src/options.c scrot-0.8/src/options.c ---- scrot-0.8~/src/options.c 2003-06-23 07:09:08.000000000 -0500 -+++ scrot-0.8/src/options.c 2008-10-27 22:06:20.000000000 -0600 -@@ -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" diff -Nru scrot-0.8/debian/patches/02_options.c.patch scrot-0.8/debian/patches/02_options.c.patch --- scrot-0.8/debian/patches/02_options.c.patch 1970-01-01 00:00:00.000000000 +0000 +++ scrot-0.8/debian/patches/02_options.c.patch 2010-07-20 21:28:20.000000000 +0000 @@ -0,0 +1,22 @@ +Author: William Vera +Description: A little fix for wrong words. +--- a/src/options.c ++++ b/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" diff -Nru scrot-0.8/debian/patches/04-focused.dpatch scrot-0.8/debian/patches/04-focused.dpatch --- scrot-0.8/debian/patches/04-focused.dpatch 2010-10-15 16:49:21.000000000 +0000 +++ scrot-0.8/debian/patches/04-focused.dpatch 1970-01-01 00:00:00.000000000 +0000 @@ -1,243 +0,0 @@ -#! /bin/sh /usr/share/dpatch/dpatch-run -## 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. - -@DPATCH@ -diff -u -r scrot-0.8~/src/options.h scrot-0.8/src/options.h ---- scrot-0.8~/src/options.h 2004-04-21 21:15:24.000000000 +1000 -+++ scrot-0.8~/src/options.h 2004-04-21 22:00:47.000000000 +1000 -@@ -32,6 +32,7 @@ - int delay; - int countdown; - int select; -+ int focused; - int quality; - int border; - int multidisp; -diff -u -r scrot-0.8~/src/options.c scrot-0.8/src/options.c ---- scrot-0.8~/orig/options.c 2004-04-21 21:15:24.000000000 +1000 -+++ scrot-0.8/src/options.c 2004-04-21 22:00:32.000000000 +1000 -@@ -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" -diff -u -r scrot-0.8~/src/scrot.h scrot-0.8/src/scrot.h ---- scrot-0.8~/src/scrot.h 2004-04-21 21:15:24.000000000 +1000 -+++ scrot-0.8/src/scrot.h 2004-04-21 22:00:42.000000000 +1000 -@@ -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, -diff -u -r scrot-0.8~/src/main.c scrot-0.8/src/main.c ---- scrot-0.8~/src/main.c 2004-04-21 21:15:24.000000000 +1000 -+++ scrot-0.8/src/main.c 2004-04-21 22:01:27.000000000 +1000 -@@ -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, diff -Nru scrot-0.8/debian/patches/04-focused.patch scrot-0.8/debian/patches/04-focused.patch --- scrot-0.8/debian/patches/04-focused.patch 1970-01-01 00:00:00.000000000 +0000 +++ scrot-0.8/debian/patches/04-focused.patch 2010-07-20 21:28:26.000000000 +0000 @@ -0,0 +1,233 @@ +Author: James Cameron +Description: src/options.c (scrot_parse_option_array): add --focused option. +src/main.c (scrot_get_geometry, scrot_nice_clip): new functions +src/main.c (scrot_grab_focused): new function to grab currently +--- a/src/options.h ++++ b/src/options.h +@@ -32,6 +32,7 @@ + int delay; + int countdown; + int select; ++ int focused; + int quality; + int border; + int multidisp; +--- a/src/options.c ++++ b/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" +--- a/src/scrot.h ++++ b/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, +--- a/src/main.c ++++ b/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); +- } +- +- /* clip rectangle nicely */ +- if (rx < 0) { +- rw += rx; +- rx = 0; ++ if (!scrot_get_geometry(target, &rx, &ry, &rw, &rh)) return NULL; + } +- 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, diff -Nru scrot-0.8/debian/patches/05-addfocusedmanpage.dpatch scrot-0.8/debian/patches/05-addfocusedmanpage.dpatch --- scrot-0.8/debian/patches/05-addfocusedmanpage.dpatch 2010-10-15 16:49:21.000000000 +0000 +++ scrot-0.8/debian/patches/05-addfocusedmanpage.dpatch 1970-01-01 00:00:00.000000000 +0000 @@ -1,19 +0,0 @@ -#! /bin/sh /usr/share/dpatch/dpatch-run -## 05-addfocusedmanpage.dpatch by William Vera -## -## DP: Add a new option in the man page (focused option). - -@DPATCH@ -diff -urNad scrot-0.8~/scrot.1 scrot-0.8/scrot.1 ---- scrot-0.8~/scrot.1 2009-05-19 09:33:05.000000000 -0500 -+++ scrot-0.8/scrot.1 2009-05-19 09:37:44.000000000 -0500 -@@ -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. diff -Nru scrot-0.8/debian/patches/05-addfocusedmanpage.patch scrot-0.8/debian/patches/05-addfocusedmanpage.patch --- scrot-0.8/debian/patches/05-addfocusedmanpage.patch 1970-01-01 00:00:00.000000000 +0000 +++ scrot-0.8/debian/patches/05-addfocusedmanpage.patch 2010-07-20 21:28:28.000000000 +0000 @@ -0,0 +1,14 @@ +Author: William Vera +Description: Add a new option in the man page (focused option). +--- a/scrot.1 ++++ b/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. diff -Nru scrot-0.8/debian/patches/06_manpagespace.dpatch scrot-0.8/debian/patches/06_manpagespace.dpatch --- scrot-0.8/debian/patches/06_manpagespace.dpatch 2010-10-15 16:49:21.000000000 +0000 +++ scrot-0.8/debian/patches/06_manpagespace.dpatch 1970-01-01 00:00:00.000000000 +0000 @@ -1,18 +0,0 @@ -#! /bin/sh /usr/share/dpatch/dpatch-run -## 06_manpagespace.dpatch by William Vera -## -## DP: Improve spacing in manual page. - -@DPATCH@ -diff -urNad scrot-0.8~/scrot.1 scrot-0.8/scrot.1 ---- scrot-0.8~/scrot.1 2001-01-11 11:43:06.000000000 -0600 -+++ scrot-0.8/scrot.1 2009-10-25 19:55:38.000000000 -0600 -@@ -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 diff -Nru scrot-0.8/debian/patches/06_manpagespace.patch scrot-0.8/debian/patches/06_manpagespace.patch --- scrot-0.8/debian/patches/06_manpagespace.patch 1970-01-01 00:00:00.000000000 +0000 +++ scrot-0.8/debian/patches/06_manpagespace.patch 2010-07-20 21:28:31.000000000 +0000 @@ -0,0 +1,13 @@ +Author: William Vera +Description: Improve spacing in manual page. +--- a/scrot.1 ++++ b/scrot.1 +@@ -61,7 +61,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 diff -Nru scrot-0.8/debian/patches/07_fix-formatstring.dpatch scrot-0.8/debian/patches/07_fix-formatstring.dpatch --- scrot-0.8/debian/patches/07_fix-formatstring.dpatch 2010-10-15 16:49:21.000000000 +0000 +++ scrot-0.8/debian/patches/07_fix-formatstring.dpatch 1970-01-01 00:00:00.000000000 +0000 @@ -1,22 +0,0 @@ -#! /bin/sh /usr/share/dpatch/dpatch-run -## 07_fix-formatstring.dpatch by George Danchev -## -## DP: Prevent arbitrary long file names - -@DPATCH@ -diff -urNad scrot-0.8~/src/options.c scrot-0.8/src/options.c ---- scrot-0.8~/src/options.c 2009-10-27 08:11:41.000000000 +0200 -+++ scrot-0.8/src/options.c 2009-10-27 08:12:09.000000000 +0200 -@@ -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); - } diff -Nru scrot-0.8/debian/patches/07_fix-formatstring.patch scrot-0.8/debian/patches/07_fix-formatstring.patch --- scrot-0.8/debian/patches/07_fix-formatstring.patch 1970-01-01 00:00:00.000000000 +0000 +++ scrot-0.8/debian/patches/07_fix-formatstring.patch 2010-07-20 21:28:34.000000000 +0000 @@ -0,0 +1,17 @@ +Author: George Danchev +Description: Prevent arbitrary long file names +--- a/src/options.c ++++ b/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); + } diff -Nru scrot-0.8/debian/patches/08_fix-beeping.patch scrot-0.8/debian/patches/08_fix-beeping.patch --- scrot-0.8/debian/patches/08_fix-beeping.patch 1970-01-01 00:00:00.000000000 +0000 +++ scrot-0.8/debian/patches/08_fix-beeping.patch 2010-07-20 21:28:36.000000000 +0000 @@ -0,0 +1,81 @@ +Author: Ibragimov Rinat +Description: Fix missing option for beep prevention. +--- a/scrot.1 ++++ b/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 +--- a/src/main.c ++++ b/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; +--- a/src/options.c ++++ b/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" +--- a/src/options.h ++++ b/src/options.h +@@ -35,6 +35,7 @@ + int focused; + int quality; + int border; ++ int silent; + int multidisp; + int thumb; + int thumb_width; diff -Nru scrot-0.8/debian/patches/series scrot-0.8/debian/patches/series --- scrot-0.8/debian/patches/series 1970-01-01 00:00:00.000000000 +0000 +++ scrot-0.8/debian/patches/series 2010-07-20 21:28:34.000000000 +0000 @@ -0,0 +1,8 @@ +01_manpagefix.patch +02_options.c.patch +003_descmanpage.patch +04-focused.patch +05-addfocusedmanpage.patch +06_manpagespace.patch +07_fix-formatstring.patch +08_fix-beeping.patch diff -Nru scrot-0.8/debian/rules scrot-0.8/debian/rules --- scrot-0.8/debian/rules 2010-10-15 16:49:21.000000000 +0000 +++ scrot-0.8/debian/rules 2010-07-20 21:37:15.000000000 +0000 @@ -1,86 +1,11 @@ #!/usr/bin/make -f +# Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 +#export DH_OPTIONS=-v +%: + dh $@ -DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) -DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) -ifneq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE)) -CROSS= --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE) -else -CROSS= --build $(DEB_BUILD_GNU_TYPE) -endif - - - -configure: configure-stamp -configure-stamp: patch - - dh_testdir -ifneq "$(wildcard /usr/share/misc/config.sub)" "" - cp -f /usr/share/misc/config.sub config.sub -endif -ifneq "$(wildcard /usr/share/misc/config.guess)" "" - cp -f /usr/share/misc/config.guess config.guess -endif - ./configure $(CROSS) --prefix=/usr --mandir=\$${prefix}/share/man --infodir=\$${prefix}/share/info CFLAGS="$(CFLAGS)" LDFLAGS="-Wl,-z,defs" - - -build: build-stamp -build-stamp: configure-stamp - dh_testdir - - $(MAKE) - - touch $@ - -clean: unpatch - dh_testdir - dh_testroot - rm -f build-stamp configure-stamp - - [ ! -f Makefile ] || $(MAKE) distclean - rm -f config.sub config.guess - - dh_clean - -patch: patch-stamp -patch-stamp: - dpatch apply-all - touch build-stamp - -unpatch: - dpatch deapply-all - rm -rf patch-stamp debian/patched - -install: build - dh_testdir - dh_testroot - dh_clean - dh_installdirs - - $(MAKE) DESTDIR=$(CURDIR)/debian/scrot install +override_dh_auto_install: + $(MAKE) install prefix=$(CURDIR)/debian/scrot/usr rm -rf $(CURDIR)/debian/scrot/usr/doc - - -binary-indep: build install - -binary-arch: build install - dh_testdir - dh_testroot - dh_installchangelogs ChangeLog - dh_installdocs - dh_installexamples - dh_install - dh_installman - dh_link - dh_strip - dh_compress - dh_fixperms - dh_installdeb - dh_shlibdeps - dh_gencontrol - dh_md5sums - dh_builddeb - -binary: binary-indep binary-arch -.PHONY: build clean binary-indep binary-arch binary install diff -Nru scrot-0.8/debian/source/format scrot-0.8/debian/source/format --- scrot-0.8/debian/source/format 1970-01-01 00:00:00.000000000 +0000 +++ scrot-0.8/debian/source/format 2010-10-15 16:49:21.000000000 +0000 @@ -0,0 +1 @@ +3.0 (quilt)