wok-4.x annotate scrot/stuff/scrot.patch @ rev 12477

Up openssl 1.1.1n (bump packages curl, git, wget, python), up cherokee 1.2.104 and bdeps (automake, openldap, cyrus-sasl)
author Stanislas Leduc <shann@slitaz.org>
date Sun Apr 02 14:34:44 2023 +0000 (15 months ago)
parents
children
rev   line source
al@12354 1 # This patch was created manually from patches found here:
al@12354 2 # http://scrot.sourcearchive.com/downloads/0.8-12/scrot_0.8-12.debian.tar.gz
al@12354 3
al@12354 4 ## 01_manpagefix.dpatch by William Vera <billy@billy.com.mx>
al@12354 5 ## DP: Character cleanup for UTF-8 compatibility.
al@12354 6
al@12354 7 --- scrot-0.8-orig/scrot.1
al@12354 8 +++ scrot-0.8/scrot.1
al@12354 9 @@ -87,7 +87,7 @@
al@12354 10 \\n prints a newline (ignored when used in the filename)
al@12354 11 .fi
al@12354 12 .SH EXAMPLE
al@12354 13 -scrot '%Y-%m-%d_$wx$h.png' -e 'mv $f ~/shots/'
al@12354 14 +scrot '%Y\-%m\-%d_$wx$h.png' \-e 'mv $f ~/shots/'
al@12354 15 .br
al@12354 16 This would create a file called something like
al@12354 17 2000-10-30_2560x1024.png and move it to your shots directory.
al@12354 18
al@12354 19 ## 02_options.c.dpatch by William Vera <billy@billy.com.mx>
al@12354 20 ## DP: A little fix for wrong words.
al@12354 21
al@12354 22 --- scrot-0.8-orig/src/options.c
al@12354 23 +++ scrot-0.8/src/options.c
al@12354 24 @@ -229,7 +229,7 @@
al@12354 25 " low quality means high compression.\n"
al@12354 26 " -m, --multidisp For multiple heads, grab shot from each\n"
al@12354 27 " and join them together.\n"
al@12354 28 - " -s, --select interactively choose a window or rectnagle\n"
al@12354 29 + " -s, --select interactively choose a window or rectangle\n"
al@12354 30 " with the mouse\n"
al@12354 31 " -t, --thumb NUM generate thumbnail too. NUM is the percentage\n"
al@12354 32 " of the original size for the thumbnail to be,\n"
al@12354 33 @@ -238,7 +238,7 @@
al@12354 34 " Both the --exec and filename parameters can take format specifiers\n"
al@12354 35 " that are expanded by " PACKAGE " when encountered.\n"
al@12354 36 " There are two types of format specifier. Characters preceded by a '%%'\n"
al@12354 37 - " are interpretted by strftime(2). See man strftime for examples.\n"
al@12354 38 + " are interpreted by strftime(2). See man strftime for examples.\n"
al@12354 39 " These options may be used to refer to the current date and time.\n"
al@12354 40 " The second kind are internal to " PACKAGE
al@12354 41 " and are prefixed by '$'\n"
al@12354 42
al@12354 43 ## 003_descmanpage.dpatch by William Vera <billy@billy.com.mx>
al@12354 44 ## DP: Change the description on manpage.
al@12354 45
al@12354 46 --- scrot-0.8-orig/scrot.1
al@12354 47 +++ scrot-0.8/scrot.1
al@12354 48 @@ -1,6 +1,6 @@
al@12354 49 .TH scrot 1 "Oct 26, 2000"
al@12354 50 .SH NAME
al@12354 51 -scrot - Screen capture using imlib2
al@12354 52 +scrot - capture a screenshot using imlib2
al@12354 53 .SH SYNOPSIS
al@12354 54 scrot [options] [file]
al@12354 55 .SH DESCRIPTION
al@12354 56
al@12354 57 ## 04-focused.dpatch by James Cameron <quozl@us.netrek.org>
al@12354 58 ## DP: src/options.c (scrot_parse_option_array): add --focused option.
al@12354 59 ## DP: src/main.c (scrot_get_geometry, scrot_nice_clip): new functions
al@12354 60 ## for common code used by both selected and focused screenshot.
al@12354 61 ## DP: src/main.c (scrot_grab_focused): new function to grab currently
al@12354 62 ## focused window after specified delay.
al@12354 63
al@12354 64 --- scrot-0.8-orig/src/options.h
al@12354 65 +++ scrot-0.8/src/options.h
al@12354 66 @@ -32,6 +32,7 @@
al@12354 67 int delay;
al@12354 68 int countdown;
al@12354 69 int select;
al@12354 70 + int focused;
al@12354 71 int quality;
al@12354 72 int border;
al@12354 73 int multidisp;
al@12354 74 --- scrot-0.8-orig/src/options.c
al@12354 75 +++ scrot-0.8/src/options.c
al@12354 76 @@ -44,13 +44,15 @@
al@12354 77 static void
al@12354 78 scrot_parse_option_array(int argc, char **argv)
al@12354 79 {
al@12354 80 - static char stropts[] = "bcd:e:hmq:st:v+:";
al@12354 81 + static char stropts[] = "bcd:e:hmq:st:uv+:";
al@12354 82 static struct option lopts[] = {
al@12354 83 /* actions */
al@12354 84 {"help", 0, 0, 'h'}, /* okay */
al@12354 85 {"version", 0, 0, 'v'}, /* okay */
al@12354 86 {"count", 0, 0, 'c'},
al@12354 87 {"select", 0, 0, 's'},
al@12354 88 + {"focused", 0, 0, 'u'},
al@12354 89 + {"focussed", 0, 0, 'u'}, /* macquarie dictionary has both spellings */
al@12354 90 {"border", 0, 0, 'b'},
al@12354 91 {"multidisp", 0, 0, 'm'},
al@12354 92 /* toggles */
al@12354 93 @@ -95,6 +97,9 @@
al@12354 94 case 's':
al@12354 95 opt.select = 1;
al@12354 96 break;
al@12354 97 + case 'u':
al@12354 98 + opt.focused = 1;
al@12354 99 + break;
al@12354 100 case '+':
al@12354 101 opt.debug_level = atoi(optarg);
al@12354 102 break;
al@12354 103 @@ -231,6 +236,7 @@
al@12354 104 " and join them together.\n"
al@12354 105 " -s, --select interactively choose a window or rectangle\n"
al@12354 106 " with the mouse\n"
al@12354 107 + " -u, --focused use the currently focused window\n"
al@12354 108 " -t, --thumb NUM generate thumbnail too. NUM is the percentage\n"
al@12354 109 " of the original size for the thumbnail to be,\n"
al@12354 110 " or the geometry in percent, e.g. 50x60 or 80x20.\n"
al@12354 111 --- scrot-0.8-orig/src/scrot.h
al@12354 112 +++ scrot-0.8/src/scrot.h
al@12354 113 @@ -72,7 +72,10 @@
al@12354 114 char *filename_im, char *filename_thumb);
al@12354 115 void scrot_do_delay(void);
al@12354 116 Imlib_Image scrot_sel_and_grab_image(void);
al@12354 117 +Imlib_Image scrot_grab_focused(void);
al@12354 118 void scrot_sel_area(int *x, int *y, int *w, int *h);
al@12354 119 +void scrot_nice_clip(int *rx, int *ry, int *rw, int *rh);
al@12354 120 +int scrot_get_geometry(Window target, int *rx, int *ry, int *rw, int *rh);
al@12354 121 Window scrot_get_window(Display *display,Window window,int x,int y);
al@12354 122 Window scrot_get_client_window(Display * display, Window target);
al@12354 123 Window scrot_find_window_by_property(Display * display, const Window window,
al@12354 124 --- scrot-0.8-orig/src/main.c
al@12354 125 +++ scrot-0.8/src/main.c
al@12354 126 @@ -48,7 +48,9 @@
al@12354 127 }
al@12354 128
al@12354 129
al@12354 130 - if (opt.select)
al@12354 131 + if (opt.focused)
al@12354 132 + image = scrot_grab_focused();
al@12354 133 + else if (opt.select)
al@12354 134 image = scrot_sel_and_grab_image();
al@12354 135 else {
al@12354 136 scrot_do_delay();
al@12354 137 @@ -171,6 +173,22 @@
al@12354 138 }
al@12354 139
al@12354 140 Imlib_Image
al@12354 141 +scrot_grab_focused(void)
al@12354 142 +{
al@12354 143 + Imlib_Image im = NULL;
al@12354 144 + int rx = 0, ry = 0, rw = 0, rh = 0;
al@12354 145 + Window target = None;
al@12354 146 + int ignored;
al@12354 147 +
al@12354 148 + scrot_do_delay();
al@12354 149 + XGetInputFocus(disp, &target, &ignored);
al@12354 150 + if (!scrot_get_geometry(target, &rx, &ry, &rw, &rh)) return NULL;
al@12354 151 + scrot_nice_clip(&rx, &ry, &rw, &rh);
al@12354 152 + im = gib_imlib_create_image_from_drawable(root, 0, rx, ry, rw, rh, 1);
al@12354 153 + return im;
al@12354 154 +}
al@12354 155 +
al@12354 156 +Imlib_Image
al@12354 157 scrot_sel_and_grab_image(void)
al@12354 158 {
al@12354 159 Imlib_Image im = NULL;
al@12354 160 @@ -313,57 +331,10 @@
al@12354 161 rh = 0 - rh;
al@12354 162 }
al@12354 163 } else {
al@12354 164 - Window child;
al@12354 165 - XWindowAttributes attr;
al@12354 166 - int stat;
al@12354 167 -
al@12354 168 /* else it's a window click */
al@12354 169 - /* get geometry of window and use that */
al@12354 170 - /* get windowmanager frame of window */
al@12354 171 - if (target != root) {
al@12354 172 - unsigned int d, x;
al@12354 173 - int status;
al@12354 174 -
al@12354 175 - status = XGetGeometry(disp, target, &root, &x, &x, &d, &d, &d, &d);
al@12354 176 - if (status != 0) {
al@12354 177 - Window rt, *children, parent;
al@12354 178 -
al@12354 179 - for (;;) {
al@12354 180 - /* Find window manager frame. */
al@12354 181 - status = XQueryTree(disp, target, &rt, &parent, &children, &d);
al@12354 182 - if (status && (children != None))
al@12354 183 - XFree((char *) children);
al@12354 184 - if (!status || (parent == None) || (parent == rt))
al@12354 185 - break;
al@12354 186 - target = parent;
al@12354 187 - }
al@12354 188 - /* Get client window. */
al@12354 189 - if (!opt.border)
al@12354 190 - target = scrot_get_client_window(disp, target);
al@12354 191 - XRaiseWindow(disp, target);
al@12354 192 - }
al@12354 193 - }
al@12354 194 - stat = XGetWindowAttributes(disp, target, &attr);
al@12354 195 - if ((stat == False) || (attr.map_state != IsViewable))
al@12354 196 - return NULL;
al@12354 197 - rw = attr.width;
al@12354 198 - rh = attr.height;
al@12354 199 - XTranslateCoordinates(disp, target, root, 0, 0, &rx, &ry, &child);
al@12354 200 + if (!scrot_get_geometry(target, &rx, &ry, &rw, &rh)) return NULL;
al@12354 201 }
al@12354 202 -
al@12354 203 - /* clip rectangle nicely */
al@12354 204 - if (rx < 0) {
al@12354 205 - rw += rx;
al@12354 206 - rx = 0;
al@12354 207 - }
al@12354 208 - if (ry < 0) {
al@12354 209 - rh += ry;
al@12354 210 - ry = 0;
al@12354 211 - }
al@12354 212 - if ((rx + rw) > scr->width)
al@12354 213 - rw = scr->width - rx;
al@12354 214 - if ((ry + rh) > scr->height)
al@12354 215 - rh = scr->height - ry;
al@12354 216 + scrot_nice_clip(&rx, &ry, &rw, &rh);
al@12354 217
al@12354 218 XBell(disp, 0);
al@12354 219 im = gib_imlib_create_image_from_drawable(root, 0, rx, ry, rw, rh, 1);
al@12354 220 @@ -371,6 +342,72 @@
al@12354 221 return im;
al@12354 222 }
al@12354 223
al@12354 224 +/* clip rectangle nicely */
al@12354 225 +void
al@12354 226 +scrot_nice_clip(int *rx,
al@12354 227 + int *ry,
al@12354 228 + int *rw,
al@12354 229 + int *rh)
al@12354 230 +{
al@12354 231 + if (*rx < 0) {
al@12354 232 + *rw += *rx;
al@12354 233 + *rx = 0;
al@12354 234 + }
al@12354 235 + if (*ry < 0) {
al@12354 236 + *rh += *ry;
al@12354 237 + *ry = 0;
al@12354 238 + }
al@12354 239 + if ((*rx + *rw) > scr->width)
al@12354 240 + *rw = scr->width - *rx;
al@12354 241 + if ((*ry + *rh) > scr->height)
al@12354 242 + *rh = scr->height - *ry;
al@12354 243 +}
al@12354 244 +
al@12354 245 +/* get geometry of window and use that */
al@12354 246 +int
al@12354 247 +scrot_get_geometry(Window target,
al@12354 248 + int *rx,
al@12354 249 + int *ry,
al@12354 250 + int *rw,
al@12354 251 + int *rh)
al@12354 252 +{
al@12354 253 + Window child;
al@12354 254 + XWindowAttributes attr;
al@12354 255 + int stat;
al@12354 256 +
al@12354 257 + /* get windowmanager frame of window */
al@12354 258 + if (target != root) {
al@12354 259 + unsigned int d, x;
al@12354 260 + int status;
al@12354 261 +
al@12354 262 + status = XGetGeometry(disp, target, &root, &x, &x, &d, &d, &d, &d);
al@12354 263 + if (status != 0) {
al@12354 264 + Window rt, *children, parent;
al@12354 265 +
al@12354 266 + for (;;) {
al@12354 267 + /* Find window manager frame. */
al@12354 268 + status = XQueryTree(disp, target, &rt, &parent, &children, &d);
al@12354 269 + if (status && (children != None))
al@12354 270 + XFree((char *) children);
al@12354 271 + if (!status || (parent == None) || (parent == rt))
al@12354 272 + break;
al@12354 273 + target = parent;
al@12354 274 + }
al@12354 275 + /* Get client window. */
al@12354 276 + if (!opt.border)
al@12354 277 + target = scrot_get_client_window(disp, target);
al@12354 278 + XRaiseWindow(disp, target);
al@12354 279 + }
al@12354 280 + }
al@12354 281 + stat = XGetWindowAttributes(disp, target, &attr);
al@12354 282 + if ((stat == False) || (attr.map_state != IsViewable))
al@12354 283 + return 0;
al@12354 284 + *rw = attr.width;
al@12354 285 + *rh = attr.height;
al@12354 286 + XTranslateCoordinates(disp, target, root, 0, 0, rx, ry, &child);
al@12354 287 + return 1;
al@12354 288 +}
al@12354 289 +
al@12354 290 Window
al@12354 291 scrot_get_window(Display * display,
al@12354 292 Window window,
al@12354 293
al@12354 294 ## 05-addfocusedmanpage.dpatch by William Vera <billy@billy.com.mx>
al@12354 295 ## DP: Add a new option in the man page (focused option).
al@12354 296
al@12354 297 --- scrot-0.8-orig/scrot.1
al@12354 298 +++ scrot-0.8/scrot.1
al@12354 299 @@ -43,6 +43,9 @@
al@12354 300 .B -s, --select
al@12354 301 Interactively select a window or rectangle with the mouse.
al@12354 302 .TP 5
al@12354 303 +.B -u, --focused
al@12354 304 +Use the currently focused window.
al@12354 305 +.TP 5
al@12354 306 .B -t, --thumb NUM
al@12354 307 generate thumbnail too. NUM is the percentage of the original size for the
al@12354 308 thumbnail to be.
al@12354 309
al@12354 310 ## 06_manpagespace.dpatch by William Vera <billy@billy.com.mx>
al@12354 311 ## DP: Improve spacing in manual page.
al@12354 312
al@12354 313 --- scrot-0.8-orig/scrot.1
al@12354 314 +++ scrot-0.8/scrot.1
al@12354 315 @@ -58,7 +58,7 @@
al@12354 316 These options may be used to refer to the current date and time.
al@12354 317 The second kind are internal to scrot and are prefixed by '$'
al@12354 318 The following specifiers are recognised:
al@12354 319 -.br
al@12354 320 +.PP
al@12354 321 .B $f
al@12354 322 image path/filename (ignored when used in the filename)
al@12354 323 .br
al@12354 324
al@12354 325 ## 07_fix-formatstring.dpatch by George Danchev <danchev@spnet.net>
al@12354 326 ## DP: Prevent arbitrary long file names
al@12354 327
al@12354 328 --- scrot-0.8-orig/src/options.c
al@12354 329 +++ scrot-0.8/src/options.c
al@12354 330 @@ -124,6 +124,12 @@
al@12354 331 if (!opt.output_file)
al@12354 332 {
al@12354 333 opt.output_file = argv[optind++];
al@12354 334 +
al@12354 335 + if ( strlen(opt.output_file) > 256 ) {
al@12354 336 + printf("output filename too long.\n");
al@12354 337 + exit(EXIT_FAILURE);
al@12354 338 + }
al@12354 339 +
al@12354 340 if (opt.thumb)
al@12354 341 opt.thumb_file = name_thumbnail(opt.output_file);
al@12354 342 }
al@12354 343
al@12354 344 ## fix-beeping.dpatch by Ibragimov Rinat <ibragimovrinat@mail.ru>
al@12354 345 ## DP: Fix missing option for beep prevention.
al@12354 346
al@12354 347 --- scrot-0.8-orig/scrot.1
al@12354 348 +++ scrot-0.8/scrot.1
al@12354 349 @@ -49,6 +49,9 @@
al@12354 350 .B -t, --thumb NUM
al@12354 351 generate thumbnail too. NUM is the percentage of the original size for the
al@12354 352 thumbnail to be.
al@12354 353 +.TP 5
al@12354 354 +.B -z, --silent
al@12354 355 +prevent beeping.
al@12354 356 .SH SPECIAL STRINGS
al@12354 357 Both the
al@12354 358 .B --exec
al@12354 359 --- scrot-0.8-orig/src/main.c
al@12354 360 +++ scrot-0.8/src/main.c
al@12354 361 @@ -154,7 +154,7 @@
al@12354 362 {
al@12354 363 Imlib_Image im;
al@12354 364
al@12354 365 - XBell(disp, 0);
al@12354 366 + if (! opt.silent) XBell(disp, 0);
al@12354 367 im =
al@12354 368 gib_imlib_create_image_from_drawable(root, 0, 0, 0, scr->width,
al@12354 369 scr->height, 1);
al@12354 370 @@ -336,7 +336,7 @@
al@12354 371 }
al@12354 372 scrot_nice_clip(&rx, &ry, &rw, &rh);
al@12354 373
al@12354 374 - XBell(disp, 0);
al@12354 375 + if (! opt.silent) XBell(disp, 0);
al@12354 376 im = gib_imlib_create_image_from_drawable(root, 0, rx, ry, rw, rh, 1);
al@12354 377 }
al@12354 378 return im;
al@12354 379 --- scrot-0.8-orig/src/options.c
al@12354 380 +++ scrot-0.8/src/options.c
al@12354 381 @@ -44,7 +44,7 @@
al@12354 382 static void
al@12354 383 scrot_parse_option_array(int argc, char **argv)
al@12354 384 {
al@12354 385 - static char stropts[] = "bcd:e:hmq:st:uv+:";
al@12354 386 + static char stropts[] = "bcd:e:hmq:st:uv+:z";
al@12354 387 static struct option lopts[] = {
al@12354 388 /* actions */
al@12354 389 {"help", 0, 0, 'h'}, /* okay */
al@12354 390 @@ -55,6 +55,7 @@
al@12354 391 {"focussed", 0, 0, 'u'}, /* macquarie dictionary has both spellings */
al@12354 392 {"border", 0, 0, 'b'},
al@12354 393 {"multidisp", 0, 0, 'm'},
al@12354 394 + {"silent", 0, 0, 'z'},
al@12354 395 /* toggles */
al@12354 396 {"thumb", 1, 0, 't'},
al@12354 397 {"delay", 1, 0, 'd'},
al@12354 398 @@ -109,6 +110,9 @@
al@12354 399 case 't':
al@12354 400 options_parse_thumbnail(optarg);
al@12354 401 break;
al@12354 402 + case 'z':
al@12354 403 + opt.silent = 1;
al@12354 404 + break;
al@12354 405 default:
al@12354 406 break;
al@12354 407 }
al@12354 408 @@ -246,6 +250,7 @@
al@12354 409 " -t, --thumb NUM generate thumbnail too. NUM is the percentage\n"
al@12354 410 " of the original size for the thumbnail to be,\n"
al@12354 411 " or the geometry in percent, e.g. 50x60 or 80x20.\n"
al@12354 412 + " -z, --silent Prevent beeping\n"
al@12354 413 "\n" " SPECIAL STRINGS\n"
al@12354 414 " Both the --exec and filename parameters can take format specifiers\n"
al@12354 415 " that are expanded by " PACKAGE " when encountered.\n"
al@12354 416 --- scrot-0.8-orig/src/options.h
al@12354 417 +++ scrot-0.8/src/options.h
al@12354 418 @@ -35,6 +35,7 @@
al@12354 419 int focused;
al@12354 420 int quality;
al@12354 421 int border;
al@12354 422 + int silent;
al@12354 423 int multidisp;
al@12354 424 int thumb;
al@12354 425 int thumb_width;
al@12354 426
al@12354 427 ## 09_fix-minusign.dpatch by William Vera <billy@billy.com.mx>
al@12354 428 ## DP: Fix a hyphen-used-as-minus-sign in a manpage.
al@12354 429
al@12354 430 --- scrot-0.8-orig/scrot.1
al@12354 431 +++ scrot-0.8/scrot.1
al@12354 432 @@ -93,7 +93,7 @@
al@12354 433 \\n prints a newline (ignored when used in the filename)
al@12354 434 .fi
al@12354 435 .SH EXAMPLE
al@12354 436 -scrot '%Y-%m-%d_$wx$h.png' -e 'mv $f ~/shots/'
al@12354 437 +scrot '%Y-%m-%d_$wx$h.png' \-e 'mv $f ~/shots/'
al@12354 438 .br
al@12354 439 This would create a file called something like
al@12354 440 2000-10-30_2560x1024.png and move it to your shots directory.