[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#217052: marked as done (xbase-clients: [xwd] would like feature to take multiple screenshots)



Your message dated Sat, 19 Oct 2013 18:57:38 +0000
with message-id <5262D622.2060100@solveig.org>
and subject line Re: xbase-clients: [xwd] would like feature to take multiple screenshots - closing
has caused the Debian Bug report #217052,
regarding xbase-clients: [xwd] would like feature to take multiple screenshots
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@bugs.debian.org
immediately.)


-- 
217052: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=217052
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems
--- Begin Message ---
Package: xbase-clients
Version: 4.2.1-12.1
Severity: wishlist
File: /usr/X11R6/bin/xwd
Tags: patch

Bonjour,
I would like to take snapshots of an animated window.
Searching the net, I could not find a program to do so. But I found 
evidence that other people where looking for the same functionnality. 
It is possible but very slow to use a shell loop to do so. I could 
whip a small patch to enable this feature. I you are interested, I 
maybe could update the man page. 

The new option are :
-n number of snapshots (defaults to 1) 
-w number of microseconds to wait between snapshots
-out file is now mandatory if more than one snapshots are to be taken. 
It is then prefixed with the image number.

Be indulgent with my code, I haven't coded in C for ages.
I could be more efficient, but I went for the simple approach.

Hoping to be helpful,
Bernard

-- System Information:
Debian Release: testing/unstable
Architecture: i386
Kernel: Linux  2.2.18pre21 #1 Sat Nov 18 18:47:15 EST 2000 i686
Locale: LANG=fr_FR.UTF-8@euro, LC_CTYPE=fr_FR.UTF-8@euro (ignored: 
LC_ALL set to fr_FR@euro.UTF-8)

Versions of packages xbase-clients depends on:
ii  cpp-3.2                   1:3.2.3-8      The GNU C preprocessor
ii  libc6                     2.3.2-8        GNU C Library: Shared 
libraries an
ii  libdps1                   4.2.1-12.1     Display PostScript (DPS) 
client li
ii  libfreetype6              2.1.5-2        FreeType 2 font engine, 
shared lib
ii  libncurses5               5.3.20030719-3 Shared libraries for 
terminal hand
ii  libxaw7                   4.2.1-12.1     X Athena widget set 
library
ii  xlibmesa3-gl [libgl1]     4.2.1-12.1     Mesa 3D graphics library 
[XFree86]
ii  xlibmesa3-glu [libglu1]   4.2.1-12.1     Mesa OpenGL utility 
library [XFree
ii  xlibs                     4.2.1-12.1     X Window System client 
libraries

-- debconf information:
* xbase-clients/default_100dpi: 
* xbase-clients/default_nolisten_tcp: 
--- xwd.c	2002-09-19 02:19:56.000000000 +0200
+++ myxwd.c	2003-10-22 14:50:13.000000000 +0200
@@ -1,5 +1,4 @@
 /* $Xorg: xwd.c,v 1.5 2001/02/09 02:06:03 xorgcvs Exp $ */
-
 /*
 
 Copyright 1987, 1998  The Open Group
@@ -70,7 +69,8 @@
 #include <errno.h>
 #include <X11/Xos.h>
 #include <stdlib.h>
-
+#include <string.h>
+#include <unistd.h>
 #include <X11/Xlib.h>
 #include <X11/Xutil.h>
 
@@ -108,10 +108,36 @@
 extern int Get_XColors(XWindowAttributes *, XColor **);
 extern void _swapshort(register char *, register unsigned);
 extern void _swaplong(register char *, register unsigned);
+static char *make_filename(char *, long, long);
 static long parse_long(char *);
 static int Get24bitDirectColors(XColor **);
 static int ReadColors(Visual *, Colormap, XColor **);
 
+/*
+ * If necessary (limit >1), prefixes filename with numbers starting from 0.
+ * Number of digits is computed to represent the maximum value.
+ */
+
+static char *make_filename(char *filename, long current, long limit){
+  /*
+   * if only one take, filename is to be used unprefixed
+   */
+  if (limit == 1)
+    return strdup(filename);
+  /*
+   * compute number of digit to represent (max-1)
+   * I know it's dumb to recompute nb_digits and realloc result every time
+   */
+  int nb_digits=1;
+  long i;
+  for(i=10; i <limit; i*=10) 
+    ++nb_digits;
+  char *result=(char*)malloc(nb_digits+strlen(filename)+1);
+  if(!result)
+    Fatal_Error("Out of memory!");
+  sprintf(result,"%0*ld%s", nb_digits, current, filename);
+  return result;
+}
 
 static long parse_long (s)
     char *s;
@@ -138,7 +164,9 @@
     Window target_win;
     FILE *out_file = stdout;
     Bool frame_only = False;
-
+    long wait_value = 0L;
+    long nb_takes = 1L;
+    char* filename=NULL;
     INIT_NAME;
 
     Setup_Display_And_Screen(&argc, argv);
@@ -159,8 +187,7 @@
 	  usage();
 	if (!strcmp(argv[i], "-out")) {
 	    if (++i >= argc) usage();
-	    if (!(out_file = fopen(argv[i], "wb")))
-	      Fatal_Error("Can't open output file as specified.");
+	    filename=argv[i];
 	    standard_out = False;
 	    continue;
 	}
@@ -181,6 +208,16 @@
 	    add_pixel_value = parse_long (argv[i]);
 	    continue;
 	}
+	if (!strcmp(argv[i], "-w")){
+	  if (++i >= argc) usage();
+	  wait_value = parse_long (argv[i]);
+	  continue;
+	}
+	if (!strcmp(argv[i], "-n")){
+	  if (++i >= argc) usage();
+	  nb_takes = parse_long (argv[i]);
+	  continue;
+	}
 	if (!strcmp(argv[i], "-frame")) {
 	    frame_only = True;
 	    continue;
@@ -195,6 +232,10 @@
     if (standard_out)
 	_setmode(fileno(out_file), _O_BINARY);
 #endif
+    /*
+     * Standard output is not allowed if nb_takes >1
+     */
+    if( standard_out && (nb_takes >1)) usage();
     
     /*
      * Let the user select the target window.
@@ -214,18 +255,29 @@
 	      target_win = XmuClientWindow (dpy, target_win);
 	}
     }
-
-
-    /*
-     * Dump it!
-     */
-    Window_Dump(target_win, out_file);
-
-    XCloseDisplay(dpy);
-    if (fclose(out_file)) {
+    long current_take;
+    for(current_take=0; current_take != nb_takes; ++current_take){
+        if (!standard_out){
+	    char *current_filename=make_filename(filename, current_take, nb_takes);
+	    if (!(out_file = fopen(current_filename, "wb")))
+	        Fatal_Error("Can't open output file as specified.");
+	    free(current_filename);
+      }
+	
+      /*
+       * Dump it!
+       */
+      
+      Window_Dump(target_win, out_file);
+      
+      if (fclose(out_file)) {
 	perror("xwd");
 	exit(1);
+      }
+      if(wait_value)
+	usleep(wait_value);
     }
+    XCloseDisplay(dpy);
     exit(0);
 }
 
@@ -535,7 +587,8 @@
     fprintf (stderr,
 "usage: %s [-display host:dpy] [-debug] [-help] %s [-nobdrs] [-out <file>]",
 	   program_name, "[{-root|-id <id>|-name <name>}]");
-    fprintf (stderr, " [-xy] [-add value] [-frame]\n");
+    fprintf (stderr, " [-xy] [-add value] [-frame] [-w microsecs delay] [-n nb of takes]\n");
+    fprintf(stderr," -out <file> is mandatory if nb of takes > 1 it will then be prefixed\n");
     exit(1);
 }
 

--- End Message ---
--- Begin Message ---
Hi! I'm closing this bug, since it was tagged "wontfix" for some
years, without answer. If you have new reasons to point out this
problem, please feel free to re-open it.

--- End Message ---

Reply to: