wok diff scrot/stuff/scrot.patch @ rev 15291

remmina-plugins: update bdeps
author Pascal Bellard <pascal.bellard@slitaz.org>
date Thu Sep 26 20:43:45 2013 +0000 (2013-09-26)
parents
children
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/scrot/stuff/scrot.patch	Thu Sep 26 20:43:45 2013 +0000
     1.3 @@ -0,0 +1,440 @@
     1.4 +# This patch was created manually from patches found here:
     1.5 +# http://scrot.sourcearchive.com/downloads/0.8-12/scrot_0.8-12.debian.tar.gz
     1.6 +
     1.7 +## 01_manpagefix.dpatch by  William Vera <billy@billy.com.mx>
     1.8 +## DP: Character cleanup for UTF-8 compatibility.
     1.9 +
    1.10 +--- scrot-0.8-orig/scrot.1
    1.11 ++++ scrot-0.8/scrot.1
    1.12 +@@ -87,7 +87,7 @@
    1.13 + \\n prints a newline (ignored when used in the filename)
    1.14 + .fi
    1.15 + .SH EXAMPLE
    1.16 +-scrot '%Y-%m-%d_$wx$h.png' -e 'mv $f ~/shots/'
    1.17 ++scrot '%Y\-%m\-%d_$wx$h.png' \-e 'mv $f ~/shots/'
    1.18 + .br
    1.19 + This would create a file called something like
    1.20 + 2000-10-30_2560x1024.png and move it to your shots directory.
    1.21 +
    1.22 +## 02_options.c.dpatch by William Vera <billy@billy.com.mx>
    1.23 +## DP: A little fix for wrong words.
    1.24 +
    1.25 +--- scrot-0.8-orig/src/options.c
    1.26 ++++ scrot-0.8/src/options.c
    1.27 +@@ -229,7 +229,7 @@
    1.28 +            "                            low quality means high compression.\n"
    1.29 +            "  -m, --multidisp           For multiple heads, grab shot from each\n"
    1.30 +            "                            and join them together.\n"
    1.31 +-           "  -s, --select              interactively choose a window or rectnagle\n"
    1.32 ++           "  -s, --select              interactively choose a window or rectangle\n"
    1.33 +            "                            with the mouse\n"
    1.34 +            "  -t, --thumb NUM           generate thumbnail too. NUM is the percentage\n"
    1.35 +            "                            of the original size for the thumbnail to be,\n"
    1.36 +@@ -238,7 +238,7 @@
    1.37 +            "  Both the --exec and filename parameters can take format specifiers\n"
    1.38 +            "  that are expanded by " PACKAGE " when encountered.\n"
    1.39 +            "  There are two types of format specifier. Characters preceded by a '%%'\n"
    1.40 +-           "  are interpretted by strftime(2). See man strftime for examples.\n"
    1.41 ++           "  are interpreted by strftime(2). See man strftime for examples.\n"
    1.42 +            "  These options may be used to refer to the current date and time.\n"
    1.43 +            "  The second kind are internal to " PACKAGE
    1.44 +            "  and are prefixed by '$'\n"
    1.45 +
    1.46 +## 003_descmanpage.dpatch by William Vera <billy@billy.com.mx>
    1.47 +## DP: Change the description on manpage.
    1.48 +
    1.49 +--- scrot-0.8-orig/scrot.1
    1.50 ++++ scrot-0.8/scrot.1
    1.51 +@@ -1,6 +1,6 @@
    1.52 + .TH scrot 1 "Oct 26, 2000"
    1.53 + .SH NAME
    1.54 +-scrot - Screen capture using imlib2
    1.55 ++scrot - capture a screenshot using imlib2
    1.56 + .SH SYNOPSIS
    1.57 + scrot [options] [file]
    1.58 + .SH DESCRIPTION
    1.59 +
    1.60 +## 04-focused.dpatch by James Cameron  <quozl@us.netrek.org>
    1.61 +## DP: src/options.c (scrot_parse_option_array): add --focused option.
    1.62 +## DP: src/main.c (scrot_get_geometry, scrot_nice_clip): new functions
    1.63 +##     for common code used by both selected and focused screenshot.
    1.64 +## DP: src/main.c (scrot_grab_focused): new function to grab currently
    1.65 +##      focused window after specified delay.
    1.66 +
    1.67 +--- scrot-0.8-orig/src/options.h
    1.68 ++++ scrot-0.8/src/options.h
    1.69 +@@ -32,6 +32,7 @@
    1.70 +    int delay;
    1.71 +    int countdown;
    1.72 +    int select;
    1.73 ++   int focused;
    1.74 +    int quality;
    1.75 +    int border;
    1.76 +    int multidisp;
    1.77 +--- scrot-0.8-orig/src/options.c
    1.78 ++++ scrot-0.8/src/options.c
    1.79 +@@ -44,13 +44,15 @@
    1.80 + static void
    1.81 + scrot_parse_option_array(int argc, char **argv)
    1.82 + {
    1.83 +-   static char stropts[] = "bcd:e:hmq:st:v+:";
    1.84 ++   static char stropts[] = "bcd:e:hmq:st:uv+:";
    1.85 +    static struct option lopts[] = {
    1.86 +       /* actions */
    1.87 +       {"help", 0, 0, 'h'},                  /* okay */
    1.88 +       {"version", 0, 0, 'v'},               /* okay */
    1.89 +       {"count", 0, 0, 'c'},
    1.90 +       {"select", 0, 0, 's'},
    1.91 ++      {"focused", 0, 0, 'u'},
    1.92 ++      {"focussed", 0, 0, 'u'},	/* macquarie dictionary has both spellings */
    1.93 +       {"border", 0, 0, 'b'},
    1.94 +       {"multidisp", 0, 0, 'm'},
    1.95 +       /* toggles */
    1.96 +@@ -95,6 +97,9 @@
    1.97 +         case 's':
    1.98 +            opt.select = 1;
    1.99 +            break;
   1.100 ++        case 'u':
   1.101 ++           opt.focused = 1;
   1.102 ++           break;
   1.103 +         case '+':
   1.104 +            opt.debug_level = atoi(optarg);
   1.105 +            break;
   1.106 +@@ -231,6 +236,7 @@
   1.107 +            "                            and join them together.\n"
   1.108 +            "  -s, --select              interactively choose a window or rectangle\n"
   1.109 +            "                            with the mouse\n"
   1.110 ++           "  -u, --focused             use the currently focused window\n"
   1.111 +            "  -t, --thumb NUM           generate thumbnail too. NUM is the percentage\n"
   1.112 +            "                            of the original size for the thumbnail to be,\n"
   1.113 +            "                            or the geometry in percent, e.g. 50x60 or 80x20.\n"
   1.114 +--- scrot-0.8-orig/src/scrot.h
   1.115 ++++ scrot-0.8/src/scrot.h
   1.116 +@@ -72,7 +72,10 @@
   1.117 +                     char *filename_im, char *filename_thumb);
   1.118 + void scrot_do_delay(void);
   1.119 + Imlib_Image scrot_sel_and_grab_image(void);
   1.120 ++Imlib_Image scrot_grab_focused(void);
   1.121 + void scrot_sel_area(int *x, int *y, int *w, int *h);
   1.122 ++void scrot_nice_clip(int *rx, int *ry, int *rw, int *rh);
   1.123 ++int scrot_get_geometry(Window target, int *rx, int *ry, int *rw, int *rh);
   1.124 + Window scrot_get_window(Display *display,Window window,int x,int y);
   1.125 + Window scrot_get_client_window(Display * display, Window target);
   1.126 + Window scrot_find_window_by_property(Display * display, const Window window,
   1.127 +--- scrot-0.8-orig/src/main.c
   1.128 ++++ scrot-0.8/src/main.c
   1.129 +@@ -48,7 +48,9 @@
   1.130 +   }
   1.131 + 
   1.132 + 
   1.133 +-  if (opt.select)
   1.134 ++  if (opt.focused)
   1.135 ++    image = scrot_grab_focused();
   1.136 ++  else if (opt.select)
   1.137 +     image = scrot_sel_and_grab_image();
   1.138 +   else {
   1.139 +     scrot_do_delay();
   1.140 +@@ -171,6 +173,22 @@
   1.141 + }
   1.142 + 
   1.143 + Imlib_Image
   1.144 ++scrot_grab_focused(void)
   1.145 ++{
   1.146 ++  Imlib_Image im = NULL;
   1.147 ++  int rx = 0, ry = 0, rw = 0, rh = 0;
   1.148 ++  Window target = None;
   1.149 ++  int ignored;
   1.150 ++
   1.151 ++  scrot_do_delay();
   1.152 ++  XGetInputFocus(disp, &target, &ignored);
   1.153 ++  if (!scrot_get_geometry(target, &rx, &ry, &rw, &rh)) return NULL;
   1.154 ++  scrot_nice_clip(&rx, &ry, &rw, &rh);
   1.155 ++  im = gib_imlib_create_image_from_drawable(root, 0, rx, ry, rw, rh, 1);
   1.156 ++  return im;
   1.157 ++}
   1.158 ++
   1.159 ++Imlib_Image
   1.160 + scrot_sel_and_grab_image(void)
   1.161 + {
   1.162 +   Imlib_Image im = NULL;
   1.163 +@@ -313,57 +331,10 @@
   1.164 +         rh = 0 - rh;
   1.165 +       }
   1.166 +     } else {
   1.167 +-      Window child;
   1.168 +-      XWindowAttributes attr;
   1.169 +-      int stat;
   1.170 +-
   1.171 +       /* else it's a window click */
   1.172 +-      /* get geometry of window and use that */
   1.173 +-      /* get windowmanager frame of window */
   1.174 +-      if (target != root) {
   1.175 +-        unsigned int d, x;
   1.176 +-        int status;
   1.177 +-
   1.178 +-        status = XGetGeometry(disp, target, &root, &x, &x, &d, &d, &d, &d);
   1.179 +-        if (status != 0) {
   1.180 +-          Window rt, *children, parent;
   1.181 +-
   1.182 +-          for (;;) {
   1.183 +-            /* Find window manager frame. */
   1.184 +-            status = XQueryTree(disp, target, &rt, &parent, &children, &d);
   1.185 +-            if (status && (children != None))
   1.186 +-              XFree((char *) children);
   1.187 +-            if (!status || (parent == None) || (parent == rt))
   1.188 +-              break;
   1.189 +-            target = parent;
   1.190 +-          }
   1.191 +-          /* Get client window. */
   1.192 +-          if (!opt.border)
   1.193 +-            target = scrot_get_client_window(disp, target);
   1.194 +-          XRaiseWindow(disp, target);
   1.195 +-        }
   1.196 +-      }
   1.197 +-      stat = XGetWindowAttributes(disp, target, &attr);
   1.198 +-      if ((stat == False) || (attr.map_state != IsViewable))
   1.199 +-        return NULL;
   1.200 +-      rw = attr.width;
   1.201 +-      rh = attr.height;
   1.202 +-      XTranslateCoordinates(disp, target, root, 0, 0, &rx, &ry, &child);
   1.203 ++      if (!scrot_get_geometry(target, &rx, &ry, &rw, &rh)) return NULL;
   1.204 +     }
   1.205 +-
   1.206 +-    /* clip rectangle nicely */
   1.207 +-    if (rx < 0) {
   1.208 +-      rw += rx;
   1.209 +-      rx = 0;
   1.210 +-    }
   1.211 +-    if (ry < 0) {
   1.212 +-      rh += ry;
   1.213 +-      ry = 0;
   1.214 +-    }
   1.215 +-    if ((rx + rw) > scr->width)
   1.216 +-      rw = scr->width - rx;
   1.217 +-    if ((ry + rh) > scr->height)
   1.218 +-      rh = scr->height - ry;
   1.219 ++    scrot_nice_clip(&rx, &ry, &rw, &rh);
   1.220 + 
   1.221 +     XBell(disp, 0);
   1.222 +     im = gib_imlib_create_image_from_drawable(root, 0, rx, ry, rw, rh, 1);
   1.223 +@@ -371,6 +342,72 @@
   1.224 +   return im;
   1.225 + }
   1.226 + 
   1.227 ++/* clip rectangle nicely */
   1.228 ++void
   1.229 ++scrot_nice_clip(int *rx, 
   1.230 ++		int *ry, 
   1.231 ++		int *rw, 
   1.232 ++		int *rh)
   1.233 ++{
   1.234 ++  if (*rx < 0) {
   1.235 ++    *rw += *rx;
   1.236 ++    *rx = 0;
   1.237 ++  }
   1.238 ++  if (*ry < 0) {
   1.239 ++    *rh += *ry;
   1.240 ++    *ry = 0;
   1.241 ++  }
   1.242 ++  if ((*rx + *rw) > scr->width)
   1.243 ++    *rw = scr->width - *rx;
   1.244 ++  if ((*ry + *rh) > scr->height)
   1.245 ++    *rh = scr->height - *ry;
   1.246 ++}
   1.247 ++
   1.248 ++/* get geometry of window and use that */
   1.249 ++int
   1.250 ++scrot_get_geometry(Window target,
   1.251 ++		   int *rx, 
   1.252 ++		   int *ry, 
   1.253 ++		   int *rw, 
   1.254 ++		   int *rh)
   1.255 ++{
   1.256 ++  Window child;
   1.257 ++  XWindowAttributes attr;
   1.258 ++  int stat;
   1.259 ++
   1.260 ++  /* get windowmanager frame of window */
   1.261 ++  if (target != root) {
   1.262 ++    unsigned int d, x;
   1.263 ++    int status;
   1.264 ++    
   1.265 ++    status = XGetGeometry(disp, target, &root, &x, &x, &d, &d, &d, &d);
   1.266 ++    if (status != 0) {
   1.267 ++      Window rt, *children, parent;
   1.268 ++      
   1.269 ++      for (;;) {
   1.270 ++	/* Find window manager frame. */
   1.271 ++	status = XQueryTree(disp, target, &rt, &parent, &children, &d);
   1.272 ++	if (status && (children != None))
   1.273 ++	  XFree((char *) children);
   1.274 ++	if (!status || (parent == None) || (parent == rt))
   1.275 ++	  break;
   1.276 ++	target = parent;
   1.277 ++      }
   1.278 ++      /* Get client window. */
   1.279 ++      if (!opt.border)
   1.280 ++	target = scrot_get_client_window(disp, target);
   1.281 ++      XRaiseWindow(disp, target);
   1.282 ++    }
   1.283 ++  }
   1.284 ++  stat = XGetWindowAttributes(disp, target, &attr);
   1.285 ++  if ((stat == False) || (attr.map_state != IsViewable))
   1.286 ++    return 0;
   1.287 ++  *rw = attr.width;
   1.288 ++  *rh = attr.height;
   1.289 ++  XTranslateCoordinates(disp, target, root, 0, 0, rx, ry, &child);
   1.290 ++  return 1;
   1.291 ++}
   1.292 ++
   1.293 + Window
   1.294 + scrot_get_window(Display * display,
   1.295 +                  Window window,
   1.296 +
   1.297 +## 05-addfocusedmanpage.dpatch by William Vera <billy@billy.com.mx>
   1.298 +## DP: Add a new option in the man page (focused option).
   1.299 +
   1.300 +--- scrot-0.8-orig/scrot.1
   1.301 ++++ scrot-0.8/scrot.1
   1.302 +@@ -43,6 +43,9 @@
   1.303 + .B -s, --select
   1.304 + Interactively select a window or rectangle with the mouse.
   1.305 + .TP 5
   1.306 ++.B -u, --focused
   1.307 ++Use the currently focused window.
   1.308 ++.TP 5
   1.309 + .B -t, --thumb NUM
   1.310 + generate thumbnail too. NUM is the percentage of the original size for the
   1.311 + thumbnail to be.
   1.312 +
   1.313 +## 06_manpagespace.dpatch by William Vera <billy@billy.com.mx>
   1.314 +## DP: Improve spacing in manual page.
   1.315 +
   1.316 +--- scrot-0.8-orig/scrot.1
   1.317 ++++ scrot-0.8/scrot.1
   1.318 +@@ -58,7 +58,7 @@
   1.319 + These options may be used to refer to the current date and time.
   1.320 + The second kind are internal to scrot and are prefixed by '$'
   1.321 + The following specifiers are recognised:
   1.322 +-.br
   1.323 ++.PP
   1.324 + .B $f
   1.325 + image path/filename (ignored when used in the filename)
   1.326 + .br
   1.327 +
   1.328 +## 07_fix-formatstring.dpatch by George Danchev <danchev@spnet.net>
   1.329 +## DP: Prevent arbitrary long file names
   1.330 +
   1.331 +--- scrot-0.8-orig/src/options.c
   1.332 ++++ scrot-0.8/src/options.c
   1.333 +@@ -124,6 +124,12 @@
   1.334 +          if (!opt.output_file)
   1.335 +          {
   1.336 +             opt.output_file = argv[optind++];
   1.337 ++
   1.338 ++            if ( strlen(opt.output_file) > 256 ) {
   1.339 ++               printf("output filename too long.\n");
   1.340 ++               exit(EXIT_FAILURE);
   1.341 ++            }
   1.342 ++
   1.343 +             if (opt.thumb)
   1.344 +                opt.thumb_file = name_thumbnail(opt.output_file);
   1.345 +          }
   1.346 +
   1.347 +## fix-beeping.dpatch by Ibragimov Rinat <ibragimovrinat@mail.ru>
   1.348 +## DP: Fix missing option for beep prevention.
   1.349 +
   1.350 +--- scrot-0.8-orig/scrot.1
   1.351 ++++ scrot-0.8/scrot.1
   1.352 +@@ -49,6 +49,9 @@
   1.353 + .B -t, --thumb NUM
   1.354 + generate thumbnail too. NUM is the percentage of the original size for the
   1.355 + thumbnail to be.
   1.356 ++.TP 5
   1.357 ++.B -z, --silent
   1.358 ++prevent beeping.
   1.359 + .SH SPECIAL STRINGS
   1.360 + Both the
   1.361 + .B --exec
   1.362 +--- scrot-0.8-orig/src/main.c
   1.363 ++++ scrot-0.8/src/main.c
   1.364 +@@ -154,7 +154,7 @@
   1.365 + {
   1.366 +   Imlib_Image im;
   1.367 + 
   1.368 +-  XBell(disp, 0);
   1.369 ++  if (! opt.silent) XBell(disp, 0);
   1.370 +   im =
   1.371 +     gib_imlib_create_image_from_drawable(root, 0, 0, 0, scr->width,
   1.372 +                                          scr->height, 1);
   1.373 +@@ -336,7 +336,7 @@
   1.374 +     }
   1.375 +     scrot_nice_clip(&rx, &ry, &rw, &rh);
   1.376 + 
   1.377 +-    XBell(disp, 0);
   1.378 ++    if (! opt.silent) XBell(disp, 0);
   1.379 +     im = gib_imlib_create_image_from_drawable(root, 0, rx, ry, rw, rh, 1);
   1.380 +   }
   1.381 +   return im;
   1.382 +--- scrot-0.8-orig/src/options.c
   1.383 ++++ scrot-0.8/src/options.c
   1.384 +@@ -44,7 +44,7 @@
   1.385 + static void
   1.386 + scrot_parse_option_array(int argc, char **argv)
   1.387 + {
   1.388 +-   static char stropts[] = "bcd:e:hmq:st:uv+:";
   1.389 ++   static char stropts[] = "bcd:e:hmq:st:uv+:z";
   1.390 +    static struct option lopts[] = {
   1.391 +       /* actions */
   1.392 +       {"help", 0, 0, 'h'},                  /* okay */
   1.393 +@@ -55,6 +55,7 @@
   1.394 +       {"focussed", 0, 0, 'u'},	/* macquarie dictionary has both spellings */
   1.395 +       {"border", 0, 0, 'b'},
   1.396 +       {"multidisp", 0, 0, 'm'},
   1.397 ++	  {"silent", 0, 0, 'z'},
   1.398 +       /* toggles */
   1.399 +       {"thumb", 1, 0, 't'},
   1.400 +       {"delay", 1, 0, 'd'},
   1.401 +@@ -109,6 +110,9 @@
   1.402 +         case 't':
   1.403 +            options_parse_thumbnail(optarg);
   1.404 +            break;
   1.405 ++        case 'z':
   1.406 ++           opt.silent = 1;
   1.407 ++           break;
   1.408 +         default:
   1.409 +            break;
   1.410 +       }
   1.411 +@@ -246,6 +250,7 @@
   1.412 +            "  -t, --thumb NUM           generate thumbnail too. NUM is the percentage\n"
   1.413 +            "                            of the original size for the thumbnail to be,\n"
   1.414 +            "                            or the geometry in percent, e.g. 50x60 or 80x20.\n"
   1.415 ++           "  -z, --silent              Prevent beeping\n"		   
   1.416 +            "\n" "  SPECIAL STRINGS\n"
   1.417 +            "  Both the --exec and filename parameters can take format specifiers\n"
   1.418 +            "  that are expanded by " PACKAGE " when encountered.\n"
   1.419 +--- scrot-0.8-orig/src/options.h
   1.420 ++++ scrot-0.8/src/options.h
   1.421 +@@ -35,6 +35,7 @@
   1.422 +    int focused;
   1.423 +    int quality;
   1.424 +    int border;
   1.425 ++   int silent;   
   1.426 +    int multidisp;
   1.427 +    int thumb;
   1.428 +    int thumb_width;
   1.429 +
   1.430 +## 09_fix-minusign.dpatch by William Vera <billy@billy.com.mx>
   1.431 +## DP: Fix a hyphen-used-as-minus-sign in a manpage.
   1.432 +
   1.433 +--- scrot-0.8-orig/scrot.1
   1.434 ++++ scrot-0.8/scrot.1
   1.435 +@@ -93,7 +93,7 @@
   1.436 + \\n prints a newline (ignored when used in the filename)
   1.437 + .fi
   1.438 + .SH EXAMPLE
   1.439 +-scrot '%Y-%m-%d_$wx$h.png' -e 'mv $f ~/shots/'
   1.440 ++scrot '%Y-%m-%d_$wx$h.png' \-e 'mv $f ~/shots/'
   1.441 + .br
   1.442 + This would create a file called something like
   1.443 + 2000-10-30_2560x1024.png and move it to your shots directory.