From 31109df5fdf0e69c3b097296f34ed135bd932c98 Mon Sep 17 00:00:00 2001 From: Jeremy Huddleston Date: Tue, 13 Dec 2011 15:53:02 -0800 Subject: [PATCH 01/16] Dead code removal Change-Id: Iee409b5576cd6f4d011a85abf814f3825403783c Signed-off-by: Jeremy Huddleston --- multiVis.c | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/multiVis.c b/multiVis.c index 086aacd..a445129 100644 --- a/multiVis.c +++ b/multiVis.c @@ -386,25 +386,11 @@ ReadRegionsInList(Display *disp, Visual *fakeVis, int depth, int format, XImage *reg_image,*ximage ; int srcRect_x,srcRect_y,srcRect_width,srcRect_height ; - int rem ; int bytes_per_line; int bitmap_unit; bitmap_unit = sizeof (long); - if (format == ZPixmap) - bytes_per_line = width*depth/8; - else - bytes_per_line = width/8; - - /* Find out how many more bytes are required for padding so that - ** bytes per scan line will be multiples of bitmap_unit bits */ - if (format == ZPixmap) { - rem = (bytes_per_line*8)%bitmap_unit; - if (rem) - bytes_per_line += (rem/8 + 1); - } - ximage = XCreateImage(disp,fakeVis,depth,format,0,NULL,width,height, 8,0) ; bytes_per_line = ximage->bytes_per_line; -- 2.7.4 From d4cfdec1abe74a7f11572db0aed5716f29ba92bc Mon Sep 17 00:00:00 2001 From: Jeremy Huddleston Date: Tue, 13 Dec 2011 15:54:13 -0800 Subject: [PATCH 02/16] Mark usage as _X_NORETURN Change-Id: I4f787ce33f7c1985d7a35d43378a01fa9b6fd976 Signed-off-by: Jeremy Huddleston --- dsimple.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dsimple.h b/dsimple.h index 7bf4d47..895ee83 100644 --- a/dsimple.h +++ b/dsimple.h @@ -61,7 +61,7 @@ Display *Open_Display(const char *); void Setup_Display_And_Screen(int *, char **); void Close_Display(void); Window Select_Window_Args(int *, char **); -void usage(void); +void usage(void) _X_NORETURN; #define X_USAGE "[host:display]" /* X arguments handled by Get_Display_Name */ -- 2.7.4 From 20bb0ba625cbe5501311ad3a7acc4d590df19c60 Mon Sep 17 00:00:00 2001 From: Jeremy Huddleston Date: Tue, 13 Dec 2011 15:56:47 -0800 Subject: [PATCH 03/16] Silence -Wshadow warnings Change-Id: I73d8405af1e3a16bae26f6a51470000835143bad Signed-off-by: Jeremy Huddleston --- dsimple.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/dsimple.c b/dsimple.c index a7e0d4c..fa31f14 100644 --- a/dsimple.c +++ b/dsimple.c @@ -230,19 +230,19 @@ Window Select_Window_Args( * Routine to let user select a window using the mouse */ -Window Select_Window(Display *dpy, int descend) +Window Select_Window(Display *disp, int descend) { int status; Cursor cursor; XEvent event; - Window target_win = None, root = RootWindow(dpy,screen); + Window target_win = None, root = RootWindow(disp,screen); int buttons = 0; /* Make the target cursor */ - cursor = XCreateFontCursor(dpy, XC_crosshair); + cursor = XCreateFontCursor(disp, XC_crosshair); /* Grab the pointer using target cursor, letting it room all over */ - status = XGrabPointer(dpy, root, False, + status = XGrabPointer(disp, root, False, ButtonPressMask|ButtonReleaseMask, GrabModeSync, GrabModeAsync, root, cursor, CurrentTime); if (status != GrabSuccess) Fatal_Error("Can't grab the mouse."); @@ -250,8 +250,8 @@ Window Select_Window(Display *dpy, int descend) /* Let the user select a window... */ while ((target_win == None) || (buttons != 0)) { /* allow one more event */ - XAllowEvents(dpy, SyncPointer, CurrentTime); - XWindowEvent(dpy, root, ButtonPressMask|ButtonReleaseMask, &event); + XAllowEvents(disp, SyncPointer, CurrentTime); + XWindowEvent(disp, root, ButtonPressMask|ButtonReleaseMask, &event); switch (event.type) { case ButtonPress: if (target_win == None) { @@ -267,12 +267,12 @@ Window Select_Window(Display *dpy, int descend) } } - XUngrabPointer(dpy, CurrentTime); /* Done with pointer */ + XUngrabPointer(disp, CurrentTime); /* Done with pointer */ if (!descend || (target_win == root)) return(target_win); - target_win = Find_Client(dpy, root, target_win); + target_win = Find_Client(disp, root, target_win); return(target_win); } @@ -286,7 +286,7 @@ Window Select_Window(Display *dpy, int descend) * are looked at. Normally, top should be the RootWindow. */ Window Window_With_Name( - Display *dpy, + Display *disp, Window top, const char *name) { @@ -296,14 +296,14 @@ Window Window_With_Name( Window w=0; char *window_name; - if (XFetchName(dpy, top, &window_name) && !strcmp(window_name, name)) + if (XFetchName(disp, top, &window_name) && !strcmp(window_name, name)) return(top); - if (!XQueryTree(dpy, top, &dummy, &dummy, &children, &nchildren)) + if (!XQueryTree(disp, top, &dummy, &dummy, &children, &nchildren)) return(0); for (i=0; i Date: Wed, 22 Feb 2012 20:19:03 -0800 Subject: [PATCH 04/16] xwd 1.0.5 Change-Id: I4ed2e9b9ada84dfb053108003180d1343fe8ab4f Signed-off-by: Alan Coopersmith --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 9091163..888d35d 100644 --- a/configure.ac +++ b/configure.ac @@ -23,7 +23,7 @@ dnl Process this file with autoconf to create configure. # Initialize Autoconf AC_PREREQ([2.60]) -AC_INIT([xwd], [1.0.4], +AC_INIT([xwd], [1.0.5], [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], [xwd]) AC_CONFIG_SRCDIR([Makefile.am]) AC_CONFIG_HEADERS([config.h]) -- 2.7.4 From 10c8b5aff7fa75c5d183626f06368a36670c153d Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Mon, 19 Mar 2012 13:09:52 -0700 Subject: [PATCH 05/16] Move Pixel typedef from xwd.c to wsutils.h Removes need for including in multiVis.c just to get the Pixel typedef, which resolves https://bugs.freedesktop.org/show_bug.cgi?id=47462 without adding a dependency on libXt. Change-Id: I3fd3b94a6e38fe939f8be232f6c6ccef584c2fef Signed-off-by: Alan Coopersmith Reviewed-by: Jeremy Huddleston --- multiVis.c | 1 - wsutils.h | 2 ++ xwd.c | 1 - 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/multiVis.c b/multiVis.c index a445129..78375af 100644 --- a/multiVis.c +++ b/multiVis.c @@ -38,7 +38,6 @@ from The Open Group. #include #include #include -#include #include #include "list.h" #include "wsutils.h" diff --git a/wsutils.h b/wsutils.h index 67aba90..bf43a18 100644 --- a/wsutils.h +++ b/wsutils.h @@ -41,6 +41,8 @@ from The Open Group. * ******************************************************************************/ +typedef unsigned long Pixel; + /* This is the actual structure returned by the X server describing the * SERVER_OVERLAY_VISUAL property. */ diff --git a/xwd.c b/xwd.c index 30752f8..49adc46 100644 --- a/xwd.c +++ b/xwd.c @@ -71,7 +71,6 @@ in this Software without prior written authorization from The Open Group. #include #include -typedef unsigned long Pixel; #include "X11/XWDFile.h" #define FEEP_VOLUME 0 -- 2.7.4 From ae8d6a2013edf35bf672d85917ec008734c1bda7 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Mon, 19 Mar 2012 13:16:20 -0700 Subject: [PATCH 06/16] Optionally enable existing code to call XkbStdBell from libxkbfile Copied from similar check in oclock/configure.ac Change-Id: Iccdf84cac227416ce160c602477b678753ab34b2 Signed-off-by: Alan Coopersmith Reviewed-by: Jeremy Huddleston --- configure.ac | 12 +++++++++++- xwd.c | 4 ++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 888d35d..28ee5d1 100644 --- a/configure.ac +++ b/configure.ac @@ -38,8 +38,18 @@ m4_ifndef([XORG_MACROS_VERSION], XORG_MACROS_VERSION(1.8) XORG_DEFAULT_OPTIONS +# Optional dependencies +AC_ARG_WITH(xkb, + AS_HELP_STRING([--without-xkb], + [Disable use of XKB to sound bells (Default is with-xkb)]), + use_xkb="$withval", use_xkb="yes") +if test x$use_xkb != xno ; then + XKBMODULE="xkbfile" + AC_DEFINE([XKB],1,[Define to use XkbStdBell]) +fi + # Checks for pkg-config packages -PKG_CHECK_MODULES(XWD, [x11 xproto >= 7.0.17]) +PKG_CHECK_MODULES(XWD, [x11 xproto >= 7.0.17 ${XKBMODULE}]) AC_CONFIG_FILES([ Makefile diff --git a/xwd.c b/xwd.c index 49adc46..5b40121 100644 --- a/xwd.c +++ b/xwd.c @@ -63,6 +63,10 @@ in this Software without prior written authorization from The Open Group. *% color can be supported. %*/ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include #include #include -- 2.7.4 From 387a35ee121974363e8755ab6d9bb1ba8fe6bf22 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Fri, 19 Jul 2013 23:33:19 -0700 Subject: [PATCH 07/16] Fix gcc warnings about discarding const qualifiers Change-Id: Ia63048860e0417359b0390528c122813fb6704f4 Signed-off-by: Alan Coopersmith --- dsimple.c | 6 +++--- dsimple.h | 6 +++--- xwd.c | 3 ++- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/dsimple.c b/dsimple.c index fa31f14..d2d52a4 100644 --- a/dsimple.c +++ b/dsimple.c @@ -54,7 +54,7 @@ from The Open Group. /* This stuff is defined in the calling program by just_display.h */ -char *program_name = "unknown_program"; +const char *program_name = "unknown_program"; Display *dpy = NULL; int screen = 0; @@ -318,7 +318,7 @@ Window Window_With_Name( * printf with up to 7 arguments. */ void -outl(char *msg, ...) +outl(const char *msg, ...) { va_list args; fflush(stdout); @@ -334,7 +334,7 @@ outl(char *msg, ...) * Standard fatal error routine - call like printf but maximum of 7 arguments. * Does not require dpy or screen defined. */ -void Fatal_Error(char *msg, ...) +void Fatal_Error(const char *msg, ...) { va_list args; fflush(stdout); diff --git a/dsimple.h b/dsimple.h index 895ee83..c249b45 100644 --- a/dsimple.h +++ b/dsimple.h @@ -47,7 +47,7 @@ from The Open Group. /* Global variables used by routines in just_display.c */ -extern char *program_name; /* Name of this program */ +extern const char *program_name; /* Name of this program */ extern Display *dpy; /* The current display */ extern int screen; /* The current screen */ @@ -76,5 +76,5 @@ void usage(void) _X_NORETURN; Window Select_Window(Display *, int); Window Window_With_Name(Display *, Window, const char *); -void Fatal_Error(char *, ...) _X_NORETURN; -void outl(char *, ...); +void Fatal_Error(const char *, ...) _X_NORETURN; +void outl(const char *, ...); diff --git a/xwd.c b/xwd.c index 5b40121..d4cc449 100644 --- a/xwd.c +++ b/xwd.c @@ -255,6 +255,7 @@ Window_Dump(Window window, FILE *out) int header_size; int ncolors, i; char *win_name; + char default_win_name[] = "xwdump"; Bool got_win_name; XWindowAttributes win_info; XImage *image; @@ -327,7 +328,7 @@ Window_Dump(Window window, FILE *out) XFetchName(dpy, window, &win_name); if (!win_name || !win_name[0]) { - win_name = "xwdump"; + win_name = default_win_name; got_win_name = False; } else { got_win_name = True; -- 2.7.4 From 23e82c82f78c0e4edb3a83605e5411cf06bf5949 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Fri, 19 Jul 2013 23:38:46 -0700 Subject: [PATCH 08/16] Add printf attributes as suggested by gcc -Wmissing-format-attribute Change-Id: Ibc927c7f9a64f0060404942c317a194f2f298618 Signed-off-by: Alan Coopersmith --- dsimple.c | 5 ++--- dsimple.h | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/dsimple.c b/dsimple.c index d2d52a4..38576f7 100644 --- a/dsimple.c +++ b/dsimple.c @@ -314,8 +314,7 @@ Window Window_With_Name( /* * outl: a debugging routine. Flushes stdout then prints a message on stderr * and flushes stderr. Used to print messages when past certain points - * in code so we can tell where we are. Outl may be invoked like - * printf with up to 7 arguments. + * in code so we can tell where we are. Outl may be invoked like printf. */ void outl(const char *msg, ...) @@ -331,7 +330,7 @@ outl(const char *msg, ...) /* - * Standard fatal error routine - call like printf but maximum of 7 arguments. + * Standard fatal error routine - call like printf. * Does not require dpy or screen defined. */ void Fatal_Error(const char *msg, ...) diff --git a/dsimple.h b/dsimple.h index c249b45..b0422bd 100644 --- a/dsimple.h +++ b/dsimple.h @@ -76,5 +76,5 @@ void usage(void) _X_NORETURN; Window Select_Window(Display *, int); Window Window_With_Name(Display *, Window, const char *); -void Fatal_Error(const char *, ...) _X_NORETURN; -void outl(const char *, ...); +void Fatal_Error(const char *, ...) _X_NORETURN _X_ATTRIBUTE_PRINTF(1, 2); +void outl(const char *, ...) _X_ATTRIBUTE_PRINTF(1, 2); -- 2.7.4 From aa0c94260e006b949fc511c9e675153e2d609641 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Fri, 19 Jul 2013 23:40:37 -0700 Subject: [PATCH 09/16] Rename new_list variable to not shadow new_list function MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Silences gcc warning: list.c: In function ‘dup_list_head’: list.c:104:14: warning: declaration of ‘new_list’ shadows a global declaration [-Wshadow] list.c:80:10: warning: shadowed declaration is here [-Wshadow] Change-Id: Icd36196f63a565918e10864e866bd8c9f636d28a Signed-off-by: Alan Coopersmith --- list.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/list.c b/list.c index c1caff6..55f50f1 100644 --- a/list.c +++ b/list.c @@ -101,16 +101,16 @@ list_ptr new_list (void) -------------------------------------------------------------------- **/ list_ptr dup_list_head(list_ptr lp, int start_at_curr) { - list_ptr new_list; + list_ptr new_listp; - if ((new_list = (list_ptr) malloc( sizeof( list_item))) == NULL) { + if ((new_listp = (list_ptr) malloc( sizeof( list_item))) == NULL) { return (list_ptr)NULL; } - new_list->next = start_at_curr ? lp->ptr.curr : lp->next; - new_list->ptr.curr = lp->ptr.curr; + new_listp->next = start_at_curr ? lp->ptr.curr : lp->next; + new_listp->ptr.curr = lp->ptr.curr; - return new_list; + return new_listp; } -- 2.7.4 From 87f7a42799eb594ca3aca1ecec6cd51f915a9923 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Fri, 19 Jul 2013 23:41:56 -0700 Subject: [PATCH 10/16] Remove unused bitmap_unit variable from ReadRegionsInList() MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit multiVis.c: In function ‘ReadRegionsInList’: multiVis.c:389:25: warning: variable ‘bitmap_unit’ set but not used [-Wunused-but-set-variable] Change-Id: I3219f1cf0bcf842a58bcfe7ede1b13c1369f2349 Signed-off-by: Alan Coopersmith --- multiVis.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/multiVis.c b/multiVis.c index 78375af..e2b0bc2 100644 --- a/multiVis.c +++ b/multiVis.c @@ -386,9 +386,6 @@ ReadRegionsInList(Display *disp, Visual *fakeVis, int depth, int format, XImage *reg_image,*ximage ; int srcRect_x,srcRect_y,srcRect_width,srcRect_height ; int bytes_per_line; - int bitmap_unit; - - bitmap_unit = sizeof (long); ximage = XCreateImage(disp,fakeVis,depth,format,0,NULL,width,height, 8,0) ; -- 2.7.4 From 4d99a7d03e27d508cea34b089d87c687b4ce70ba Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Fri, 19 Jul 2013 23:45:05 -0700 Subject: [PATCH 11/16] Quiet gcc warnings about potentially uninitialized variables It should have been impossible for these to be used without being initialized, but following the logic to prove that was trickier than the compiler was willing to unravel. Change-Id: Ib51714d5b5d048923388fcd55eff3fb062526d0e Signed-off-by: Alan Coopersmith --- multiVis.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/multiVis.c b/multiVis.c index e2b0bc2..4ee06d5 100644 --- a/multiVis.c +++ b/multiVis.c @@ -299,7 +299,7 @@ static void TransferImage(Display *disp, XImage *reg_image, { int i,j,old_pixel,new_pixel,red_ind,green_ind,blue_ind ; XColor *colors; - int rShift,gShift,bShift; + int rShift = 0, gShift = 0, bShift = 0; (void) QueryColorMap(disp,reg->cmap,reg->vis,&colors, &rShift,&gShift,&bShift) ; -- 2.7.4 From a97b0c4cfe6e7883c0adf522af2b3b5de71e127a Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Sat, 20 Jul 2013 00:07:30 -0700 Subject: [PATCH 12/16] Fix some clang warnings about integer size/sign conversions Change-Id: Ia9f9f72ad60197f10878533e155161f540db1577 Signed-off-by: Alan Coopersmith --- clientwin.c | 4 ++-- dsimple.c | 2 +- multiVis.c | 20 +++++++++----------- xwd.c | 6 +++--- 4 files changed, 15 insertions(+), 17 deletions(-) diff --git a/clientwin.c b/clientwin.c index cce35ad..afb06f8 100644 --- a/clientwin.c +++ b/clientwin.c @@ -117,7 +117,7 @@ Find_Client_In_Children(Display * dpy, Window win) * Find virtual roots (_NET_VIRTUAL_ROOTS) */ static unsigned long * -Find_Roots(Display * dpy, Window root, unsigned int *num) +Find_Roots(Display * dpy, Window root, unsigned long *num) { Atom type_ret; int format_ret; @@ -179,7 +179,7 @@ Window Find_Client(Display * dpy, Window root, Window subwin) { unsigned long *roots; - unsigned int i, n_roots; + unsigned long i, n_roots; Window win; /* Check if subwin is a virtual root */ diff --git a/dsimple.c b/dsimple.c index 38576f7..503ed88 100644 --- a/dsimple.c +++ b/dsimple.c @@ -292,7 +292,7 @@ Window Window_With_Name( { Window *children, dummy; unsigned int nchildren; - int i; + unsigned int i; Window w=0; char *window_name; diff --git a/multiVis.c b/multiVis.c index 4ee06d5..654691d 100644 --- a/multiVis.c +++ b/multiVis.c @@ -116,7 +116,7 @@ extern unsigned int list_length(); */ /* Prototype Declarations for Static Functions */ -static int QueryColorMap( +static void QueryColorMap( Display *, Colormap , Visual *, XColor **, int *, int *, int * ); @@ -125,8 +125,8 @@ static void TransferImage( XImage *,int ,int ); static XImage * ReadRegionsInList( - Display *, Visual *, int ,int ,int , - int , XRectangle, list_ptr + Display *, Visual *, int, int, unsigned int, + unsigned int, XRectangle, list_ptr ); static list_ptr make_region_list( @@ -179,16 +179,16 @@ void initFakeVisual(Visual *Vis) Vis->bits_per_rgb = 8 ; } -static int +static void QueryColorMap(Display *disp, Colormap src_cmap, Visual *src_vis, XColor **src_colors, int *rShift, int *gShift, int *bShift) { - int ncolors,i ; + unsigned int ncolors,i ; unsigned long redMask, greenMask, blueMask; int redShift, greenShift, blueShift; XColor *colors ; - ncolors = src_vis->map_entries ; + ncolors = (unsigned) src_vis->map_entries ; *src_colors = colors = (XColor *)malloc(ncolors * sizeof(XColor) ) ; if(src_vis->class != TrueColor && src_vis->class != DirectColor) @@ -233,9 +233,7 @@ QueryColorMap(Display *disp, Colormap src_cmap, Visual *src_vis, } } - - XQueryColors(disp, src_cmap, colors, ncolors); - return ncolors ; + XQueryColors(disp, src_cmap, colors, (int) ncolors); } int @@ -301,7 +299,7 @@ static void TransferImage(Display *disp, XImage *reg_image, XColor *colors; int rShift = 0, gShift = 0, bShift = 0; - (void) QueryColorMap(disp,reg->cmap,reg->vis,&colors, + QueryColorMap(disp,reg->cmap,reg->vis,&colors, &rShift,&gShift,&bShift) ; switch (reg->vis->class) { @@ -375,7 +373,7 @@ static void TransferImage(Display *disp, XImage *reg_image, static XImage * ReadRegionsInList(Display *disp, Visual *fakeVis, int depth, int format, - int width,int height, + unsigned int width, unsigned int height, XRectangle bbox, /* bounding box of grabbed area */ list_ptr regions) /* list of regions to read from */ { diff --git a/xwd.c b/xwd.c index d4cc449..93f9da2 100644 --- a/xwd.c +++ b/xwd.c @@ -251,8 +251,8 @@ Window_Dump(Window window, FILE *out) unsigned long swaptest = 1; XColor *colors; unsigned buffer_size; - int win_name_size; - int header_size; + size_t win_name_size; + CARD32 header_size; int ncolors, i; char *win_name; char default_win_name[] = "xwdump"; @@ -407,7 +407,7 @@ Window_Dump(Window window, FILE *out) * Calculate header size. */ if (debug) outl("xwd: Calculating header size.\n"); - header_size = SIZEOF(XWDheader) + win_name_size; + header_size = SIZEOF(XWDheader) + (CARD32) win_name_size; /* * Write out header information. -- 2.7.4 From 3f7d544f6ec2ac44fe5a4a7685f405049502770b Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Sat, 20 Jul 2013 00:08:51 -0700 Subject: [PATCH 13/16] Strip trailing whitespace Change-Id: I17978519a1635c0b587a7033916c42a67eb87019 Signed-off-by: Alan Coopersmith --- Makefile.am | 6 +-- configure.ac | 4 +- dsimple.c | 6 +-- list.c | 4 +- list.h | 20 ++++---- multiVis.c | 158 +++++++++++++++++++++++++++++------------------------------ multiVis.h | 2 +- xwd.c | 26 +++++----- 8 files changed, 113 insertions(+), 113 deletions(-) diff --git a/Makefile.am b/Makefile.am index 497be4a..03bead7 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,6 +1,6 @@ -# +# # Copyright 2005 Red Hat, Inc. -# +# # Permission to use, copy, modify, distribute, and sell this software and its # documentation for any purpose is hereby granted without fee, provided that # the above copyright notice appear in all copies and that both that @@ -10,7 +10,7 @@ # specific, written prior permission. Red Hat makes no # representations about the suitability of this software for any purpose. It # is provided "as is" without express or implied warranty. -# +# # RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, # INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO # EVENT SHALL RED HAT BE LIABLE FOR ANY SPECIAL, INDIRECT OR diff --git a/configure.ac b/configure.ac index 28ee5d1..5ce7549 100644 --- a/configure.ac +++ b/configure.ac @@ -1,6 +1,6 @@ dnl Copyright 2005 Red Hat, Inc. -dnl +dnl dnl Permission to use, copy, modify, distribute, and sell this software and its dnl documentation for any purpose is hereby granted without fee, provided that dnl the above copyright notice appear in all copies and that both that @@ -10,7 +10,7 @@ dnl advertising or publicity pertaining to distribution of the software without dnl specific, written prior permission. Red Hat makes no dnl representations about the suitability of this software for any purpose. It dnl is provided "as is" without express or implied warranty. -dnl +dnl dnl RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, dnl INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO dnl EVENT SHALL RED HAT BE LIABLE FOR ANY SPECIAL, INDIRECT OR diff --git a/dsimple.c b/dsimple.c index 503ed88..fa31e8f 100644 --- a/dsimple.c +++ b/dsimple.c @@ -139,7 +139,7 @@ void Close_Display(void) { if (dpy == NULL) return; - + XCloseDisplay(dpy); dpy = NULL; } @@ -215,7 +215,7 @@ Window Select_Window_Args( COPYOPT; } ARGC = nargc; - + return(w); } @@ -265,7 +265,7 @@ Window Select_Window(Display *disp, int descend) buttons--; break; } - } + } XUngrabPointer(disp, CurrentTime); /* Done with pointer */ diff --git a/list.c b/list.c index 55f50f1..6e9a7a4 100644 --- a/list.c +++ b/list.c @@ -74,7 +74,7 @@ int add_to_list(list_ptr lp, void *item) /** ------------------------------------------------------------------------ - Creates a new list and sets its pointers to NULL. + Creates a new list and sets its pointers to NULL. Returns a pointer to the new list. -------------------------------------------------------------------- **/ list_ptr new_list (void) @@ -161,7 +161,7 @@ void *delete_from_list(list_ptr lp, void *item) /** ------------------------------------------------------------------------ Deletes each node in the list *except the head*. This allows the deletion of lists where the head is not malloced or created - with new_list(). If free_items is true, each item pointed to + with new_list(). If free_items is true, each item pointed to from the node is freed, in addition to the node itself. -------------------------------------------------------------------- **/ void delete_list(list_ptr lp, int free_items) diff --git a/list.h b/list.h index a2b3622..664075d 100644 --- a/list.h +++ b/list.h @@ -56,8 +56,8 @@ typedef void (*DESTRUCT_FUNC_PTR)( void * ); -void zero_list( - list_ptr +void zero_list( + list_ptr ); int add_to_list ( list_ptr , void * @@ -66,28 +66,28 @@ list_ptr new_list ( void ); list_ptr dup_list_head ( - list_ptr , int + list_ptr , int ); -unsigned int list_length( - list_ptr +unsigned int list_length( + list_ptr ); void *delete_from_list ( list_ptr , void * ); -void delete_list( - list_ptr , int +void delete_list( + list_ptr , int ); void delete_list_destroying ( list_ptr , DESTRUCT_FUNC_PTR ); void *first_in_list ( - list_ptr + list_ptr ); void *next_in_list ( - list_ptr + list_ptr ); int list_is_empty ( - list_ptr + list_ptr ); #endif diff --git a/multiVis.c b/multiVis.c index 654691d..86e9634 100644 --- a/multiVis.c +++ b/multiVis.c @@ -1,6 +1,6 @@ /** ------------------------------------------------------------------------ This file contains functions to create a list of regions which - tile a specified window. Each region contains all visible + tile a specified window. Each region contains all visible portions of the window which are drawn with the same visual. If the window consists of subwindows of two different visual types, there will be two regions in the list. The list can be traversed @@ -68,7 +68,7 @@ typedef struct { Window parent; /* id of parent (for debugging) */ } image_win_type; -/* Items in short list of regions that tile the grabbed area. May have +/* Items in short list of regions that tile the grabbed area. May have multiple windows in the region. */ typedef struct { @@ -83,7 +83,7 @@ typedef struct { } image_region_type; /** ------------------------------------------------------------------------ - Returns TRUE if the two structs pointed to have the same "vis" & + Returns TRUE if the two structs pointed to have the same "vis" & "cmap" fields and s2 lies completely within s1. s1 and s2 can point to structs of image_win_type or image_region_type. ------------------------------------------------------------------------ **/ @@ -117,45 +117,45 @@ extern unsigned int list_length(); /* Prototype Declarations for Static Functions */ static void QueryColorMap( - Display *, Colormap , Visual *, + Display *, Colormap , Visual *, XColor **, int *, int *, int * ); static void TransferImage( Display *, XImage *,int, int , image_region_type*, - XImage *,int ,int + XImage *,int ,int ); static XImage * ReadRegionsInList( Display *, Visual *, int, int, unsigned int, unsigned int, XRectangle, list_ptr ); -static list_ptr make_region_list( +static list_ptr make_region_list( Display*, Window, XRectangle*, int*, int, XVisualInfo**, int * ); -static void destroy_region_list( - list_ptr +static void destroy_region_list( + list_ptr ) ; -static void subtr_rect_from_image_region( - image_region_type *, int , int , int , int +static void subtr_rect_from_image_region( + image_region_type *, int , int , int , int ); -static void add_rect_to_image_region( +static void add_rect_to_image_region( image_region_type *, - int , int , int , int + int , int , int , int ); -static int src_in_region_list( - image_win_type *, list_ptr +static int src_in_region_list( + image_win_type *, list_ptr ); static void add_window_to_list( list_ptr, Window, int, int , int , int , int , int, int, Visual*, Colormap, Window ); -static int src_in_image( +static int src_in_image( image_win_type *, int , XVisualInfo** ); -static int src_in_overlay( +static int src_in_overlay( image_region_type *, int, OverlayInfo *, int*, int* ); static void make_src_list( @@ -270,9 +270,9 @@ GetMultiVisualRegions(Display *disp, *vis_regions = *vis_image_regions = NULL ; if ((*vis_regions = make_region_list( disp, srcRootWinid, &bbox, &hasNonDefault, *numImageVisuals, - *pImageVisuals, allImage)) == NULL) + *pImageVisuals, allImage)) == NULL) return 0 ; - + if (*transparentOverlays) { *allImage = 1; /* until proven otherwise, @@ -284,7 +284,7 @@ GetMultiVisualRegions(Display *disp, /* if there is a second region in any of the two lists return 1 **/ if ( ( *vis_regions && (*vis_regions)->next && (*vis_regions)->next->next ) || - ( *vis_image_regions && (*vis_image_regions)->next && + ( *vis_image_regions && (*vis_image_regions)->next && (*vis_image_regions)->next->next ) ) return 1 ; else return 0 ; @@ -303,7 +303,7 @@ static void TransferImage(Display *disp, XImage *reg_image, &rShift,&gShift,&bShift) ; switch (reg->vis->class) { - case TrueColor : + case TrueColor : for(i=0 ; i < srch ; i++) { for(j=0 ; j < srcw ; j++) @@ -311,43 +311,43 @@ static void TransferImage(Display *disp, XImage *reg_image, old_pixel = XGetPixel(reg_image,j,i) ; if( reg->vis->map_entries == 16) { - + red_ind = (old_pixel & reg->vis->red_mask) >> rShift ; green_ind = (old_pixel & reg->vis->green_mask) >> gShift ; blue_ind = (old_pixel & reg->vis->blue_mask) >> bShift ; - new_pixel = ( + new_pixel = ( ((colors[red_ind].red >> 8) << RED_SHIFT) |((colors[green_ind].green >> 8) << GREEN_SHIFT) |((colors[blue_ind].blue >> 8) << BLUE_SHIFT) ); } - else + else new_pixel = old_pixel; XPutPixel(target_image,dst_x+j, dst_y+i,new_pixel); - + } } break; case DirectColor : for(i=0 ; i < srch ; i++) { - + for(j=0 ; j < srcw ; j++) { old_pixel = XGetPixel(reg_image,j,i) ; red_ind = (old_pixel & reg->vis->red_mask) >> rShift ; green_ind = (old_pixel & reg->vis->green_mask) >> gShift ; blue_ind = (old_pixel & reg->vis->blue_mask) >> bShift ; - - new_pixel = ( + + new_pixel = ( ((colors[red_ind].red >> 8) << RED_SHIFT) |((colors[green_ind].green >> 8) << GREEN_SHIFT) |((colors[blue_ind].blue >> 8) << BLUE_SHIFT) ); XPutPixel(target_image,dst_x+j, dst_y+i,new_pixel); - + } } break; @@ -357,14 +357,14 @@ static void TransferImage(Display *disp, XImage *reg_image, for(j=0 ; j < srcw ; j++) { old_pixel = XGetPixel(reg_image,j,i) ; - - new_pixel = ( + + new_pixel = ( ((colors[old_pixel].red >> 8) << RED_SHIFT) |((colors[old_pixel].green >> 8) << GREEN_SHIFT) |((colors[old_pixel].blue >> 8) << BLUE_SHIFT) ); XPutPixel(target_image,dst_x+j, dst_y+i,new_pixel); - + } } break; @@ -383,8 +383,8 @@ ReadRegionsInList(Display *disp, Visual *fakeVis, int depth, int format, XImage *reg_image,*ximage ; int srcRect_x,srcRect_y,srcRect_width,srcRect_height ; - int bytes_per_line; - + int bytes_per_line; + ximage = XCreateImage(disp,fakeVis,depth,format,0,NULL,width,height, 8,0) ; bytes_per_line = ximage->bytes_per_line; @@ -395,26 +395,26 @@ ReadRegionsInList(Display *disp, Visual *fakeVis, int depth, int format, ximage->data = malloc(height*bytes_per_line*depth); ximage->bits_per_pixel = depth; /** Valid only if format is ZPixmap ***/ - + for (reg = (image_region_type *) first_in_list( regions); reg; - reg = (image_region_type *) next_in_list( regions)) + reg = (image_region_type *) next_in_list( regions)) { int rect; struct my_XRegion *vis_reg; vis_reg = (struct my_XRegion *)(reg->visible_region); - for (rect = 0; + for (rect = 0; rect < vis_reg->numRects; rect++) { /** ------------------------------------------------------------------------ - Intersect bbox with visible part of region giving src rect & output + Intersect bbox with visible part of region giving src rect & output location. Width is the min right side minus the max left side. Similar for height. Offset src rect so x,y are relative to origin of win, not the root-relative visible rect of win. ------------------------------------------------------------------------ **/ - srcRect_width = MIN( vis_reg->rects[rect].x2, bbox.width + bbox.x) - + srcRect_width = MIN( vis_reg->rects[rect].x2, bbox.width + bbox.x) - MAX( vis_reg->rects[rect].x1, bbox.x); - srcRect_height = MIN( vis_reg->rects[rect].y2, bbox.height + bbox.y) - + srcRect_height = MIN( vis_reg->rects[rect].y2, bbox.height + bbox.y) - MAX( vis_reg->rects[rect].y1, bbox.y); diff = bbox.x - vis_reg->rects[rect].x1; srcRect_x = MAX( 0, diff) + (vis_reg->rects[rect].x1 - reg->x_rootrel - reg->border); @@ -441,7 +441,7 @@ XImage *ReadAreaToImage(Display *disp, /* root rel UL corner of bounding box of grab */ int x, int y, /* size of bounding box of grab */ - unsigned int width, unsigned int height, + unsigned int width, unsigned int height, int numVisuals, XVisualInfo *pVisuals, int numOverlayVisuals, OverlayInfo *pOverlayVisuals, int numImageVisuals, XVisualInfo **pImageVisuals, @@ -504,7 +504,7 @@ XImage *ReadAreaToImage(Display *disp, int test = 0 ; srcRect_width = MIN( reg->width + reg->x_vis, bbox.width + bbox.x) - MAX( reg->x_vis, bbox.x); - srcRect_height = MIN( reg->height + reg->y_vis, bbox.height + srcRect_height = MIN( reg->height + reg->y_vis, bbox.height + bbox.y) - MAX( reg->y_vis, bbox.y); diff = bbox.x - reg->x_vis; srcRect_x = MAX( 0, diff) + (reg->x_vis - reg->x_rootrel - reg->border); @@ -513,7 +513,7 @@ XImage *ReadAreaToImage(Display *disp, srcRect_y = MAX( 0, diff) + (reg->y_vis - reg->y_rootrel - reg->border); dst_y = MAX( 0, -diff) ; /* let's test some pixels for transparency */ - image = XGetImage(disp, reg->win, srcRect_x, srcRect_y, + image = XGetImage(disp, reg->win, srcRect_x, srcRect_y, srcRect_width, srcRect_height, 0xffffffff, ZPixmap); /* let's assume byte per pixel for overlay image for now */ @@ -535,7 +535,7 @@ XImage *ReadAreaToImage(Display *disp, #endif pixel = XGetPixel(ximage_ipm,dst_x+x1,dst_y+y1) ; XPutPixel(ximage,dst_x+x1, dst_y+y1,pixel); - + if(!test){ test = 1 ; } @@ -650,13 +650,13 @@ static void make_src_list(Display *disp, list_ptr image_wins, XQueryTree( disp, curr, &root, &parent, &child, &nchild ); save_child_list = child; /* so we can free list when we're done */ - add_window_to_list( image_wins, curr, x_rootrel, y_rootrel, - pclip->x, pclip->y, - pclip->width, pclip->height, - curr_attrs->border_width,curr_attrs->visual, + add_window_to_list( image_wins, curr, x_rootrel, y_rootrel, + pclip->x, pclip->y, + pclip->width, pclip->height, + curr_attrs->border_width,curr_attrs->visual, curr_attrs->colormap, parent); - + /** ------------------------------------------------------------------------ set RR coords of right (Rt), left (X), bottom (Bt) and top (Y) of rect we clip all children by. This is our own clip rect (pclip) @@ -667,10 +667,10 @@ static void make_src_list(Display *disp, list_ptr image_wins, curr_clipX = MAX( pclip->x, x_rootrel + (int) curr_attrs->border_width); curr_clipY = MAX( pclip->y, y_rootrel + (int) curr_attrs->border_width); curr_clipRt = MIN( pclip->x + (int) pclip->width, - x_rootrel + (int) curr_attrs->width + + x_rootrel + (int) curr_attrs->width + 2 * (int) curr_attrs->border_width); curr_clipBt = MIN( pclip->y + (int) pclip->height, - y_rootrel + (int) curr_attrs->height + + y_rootrel + (int) curr_attrs->height + 2 * (int) curr_attrs->border_width); while (nchild--) { @@ -688,17 +688,17 @@ static void make_src_list(Display *disp, list_ptr image_wins, if (new_width >= 0) { child_clip.width = new_width; - child_yrr = y_rootrel + child_attrs.y + + child_yrr = y_rootrel + child_attrs.y + curr_attrs->border_width; child_clip.y = MAX( curr_clipY, child_yrr); - new_height = MIN( curr_clipBt, - child_yrr + (int) child_attrs.height + - 2 * child_attrs.border_width) + new_height = MIN( curr_clipBt, + child_yrr + (int) child_attrs.height + + 2 * child_attrs.border_width) - child_clip.y; if (new_height >= 0) { child_clip.height = new_height; - make_src_list( disp, image_wins, bbox, *child, - child_xrr, child_yrr, + make_src_list( disp, image_wins, bbox, *child, + child_xrr, child_yrr, &child_attrs, &child_clip); } } @@ -714,7 +714,7 @@ static void make_src_list(Display *disp, list_ptr image_wins, window. Each region contains all visible portions of the window which are drawn with the same visual. For example, if the window consists of subwindows of two different visual types, - there will be two regions in the list. + there will be two regions in the list. Returns a pointer to the list. ------------------------------------------------------------------------ **/ static list_ptr make_region_list(Display *disp, Window win, XRectangle *bbox, @@ -731,8 +731,8 @@ static list_ptr make_region_list(Display *disp, Window win, XRectangle *bbox, XRectangle clip; int image_only; - int count=0 ; - + int count=0 ; + *hasNonDefault = False; XUnionRectWithRegion( bbox, bbox_region, bbox_region); XGetWindowAttributes( disp, win, &win_attrs); @@ -742,14 +742,14 @@ static list_ptr make_region_list(Display *disp, Window win, XRectangle *bbox, clip.y = 0; clip.width = win_attrs.width; clip.height = win_attrs.height; - make_src_list( disp, &image_wins, bbox, win, + make_src_list( disp, &image_wins, bbox, win, 0 /* x_rootrel */, 0 /* y_rootrel */, &win_attrs, &clip); image_regions = new_list(); - image_only = (*allImage) ? True:False; + image_only = (*allImage) ? True:False; for (base_src = (image_win_type *) first_in_list( &image_wins); base_src; - base_src = (image_win_type *) next_in_list( &image_wins)) + base_src = (image_win_type *) next_in_list( &image_wins)) { /* test for image visual */ if (!image_only || src_in_image(base_src, numImageVisuals, pImageVisuals)) @@ -757,12 +757,12 @@ static list_ptr make_region_list(Display *disp, Window win, XRectangle *bbox, /* find a window whose visual hasn't been put in list yet */ if (!src_in_region_list( base_src, image_regions)) { - if (! (new_reg = (image_region_type *) + if (! (new_reg = (image_region_type *) malloc( sizeof( image_region_type)))) { return (list_ptr) NULL; } - count++; - + count++; + new_reg->visible_region = XCreateRegion(); new_reg->win = base_src->win; new_reg->vis = base_src->vis; @@ -774,28 +774,28 @@ static list_ptr make_region_list(Display *disp, Window win, XRectangle *bbox, new_reg->width = base_src->width; new_reg->height = base_src->height; new_reg->border = base_src->border_width; - + srcs_left = (list_ptr) dup_list_head( &image_wins, START_AT_CURR); for (src = (image_win_type *) first_in_list( srcs_left); src; src = (image_win_type *) next_in_list( srcs_left)) { if (SAME_REGIONS( base_src, src)) { - add_rect_to_image_region( new_reg, src->x_vis, src->y_vis, + add_rect_to_image_region( new_reg, src->x_vis, src->y_vis, src->width, src->height); } else { if (!image_only || src_in_image(src, numImageVisuals, pImageVisuals)) - { + { subtr_rect_from_image_region( new_reg, src->x_vis, src->y_vis, src->width, src->height); - } + } } } - XIntersectRegion( bbox_region, new_reg->visible_region, + XIntersectRegion( bbox_region, new_reg->visible_region, new_reg->visible_region); if (! XEmptyRegion( new_reg->visible_region)) { add_to_list( image_regions, new_reg); if (new_reg->vis != DefaultVisualOfScreen( win_attrs.screen) || - new_reg->cmap != DefaultColormapOfScreen( + new_reg->cmap != DefaultColormapOfScreen( win_attrs.screen)) { *hasNonDefault = True; } @@ -847,7 +847,7 @@ static void subtr_rect_from_image_region(image_region_type *image_region, rect.width = width; rect.height = height; XUnionRectWithRegion( &rect, rect_region, rect_region); - XSubtractRegion( image_region->visible_region, rect_region, + XSubtractRegion( image_region->visible_region, rect_region, image_region->visible_region); XDestroyRegion( rect_region); } @@ -865,7 +865,7 @@ static void add_rect_to_image_region(image_region_type *image_region, rect.y = y; rect.width = width; rect.height = height; - XUnionRectWithRegion( &rect, image_region->visible_region, + XUnionRectWithRegion( &rect, image_region->visible_region, image_region->visible_region); } @@ -894,7 +894,7 @@ static int src_in_region_list(image_win_type *src, list_ptr image_regions) Makes a new entry in image_wins with the given fields filled in. ------------------------------------------------------------------------ **/ static void add_window_to_list(list_ptr image_wins, Window w, - int xrr, int yrr, int x_vis, int y_vis, + int xrr, int yrr, int x_vis, int y_vis, int width, int height, int border_width, Visual *vis, Colormap cmap, Window parent) { @@ -941,7 +941,7 @@ static int src_in_image(image_win_type *src, int numImageVisuals, and transparency is possible, FALSE otherwise. ------------------------------------------------------------------------ **/ static int src_in_overlay(image_region_type *src, int numOverlayVisuals, - OverlayInfo *pOverlayVisuals, + OverlayInfo *pOverlayVisuals, int *transparentColor, int *transparentType) { int i; @@ -955,10 +955,10 @@ static int src_in_overlay(image_region_type *src, int numOverlayVisuals, *transparentType = pOverlayVisuals[i].transparentType; return 1; } - + else { } - + } return 0; } @@ -1041,14 +1041,14 @@ int GetXVisualInfo(/* Which X server (aka "display"). */ Atom overlayVisualsAtom; /* Parameters for XGetWindowProperty */ Atom actualType; unsigned long numLongs, bytesAfter; - int actualFormat; + int actualFormat; int nImageVisualsAlloced; /* Values to process the XVisualInfo */ int imageVisual; /* array */ /* First, get the list of visuals for this screen. */ getVisInfo.screen = screen; - mask = VisualScreenMask; + mask = VisualScreenMask; *pVisuals = XGetVisualInfo(display, mask, &getVisInfo, numVisuals); if ((nVisuals = *numVisuals) <= 0) diff --git a/multiVis.h b/multiVis.h index 271d787..28b940b 100644 --- a/multiVis.h +++ b/multiVis.h @@ -39,7 +39,7 @@ extern int GetMultiVisualRegions( unsigned int, int *, int *, XVisualInfo **, int *, OverlayInfo **, int *, XVisualInfo ***, list_ptr *, list_ptr *, int * -); +); extern XImage *ReadAreaToImage( Display *, Window, int, int, unsigned int, diff --git a/xwd.c b/xwd.c index 93f9da2..85734ea 100644 --- a/xwd.c +++ b/xwd.c @@ -27,22 +27,22 @@ in this Software without prior written authorization from The Open Group. /* * xwd.c MIT Project Athena, X Window system window raster image dumper. * - * This program will dump a raster image of the contents of a window into a + * This program will dump a raster image of the contents of a window into a * file for output on graphics printers or for other uses. * * Author: Tony Della Fera, DEC * 17-Jun-85 - * + * * Modification history: * * 11/14/86 Bill Wyatt, Smithsonian Astrophysical Observatory - * - Removed Z format option, changing it to an XY option. Monochrome + * - Removed Z format option, changing it to an XY option. Monochrome * windows will always dump in XY format. Color windows will dump * in Z format by default, but can be dumped in XY format with the * -xy option. * * 11/18/86 Bill Wyatt - * - VERSION 6 is same as version 5 for monchrome. For colors, the + * - VERSION 6 is same as version 5 for monchrome. For colors, the * appropriate number of Color structs are dumped after the header, * which has the number of colors (=0 for monochrome) in place of the * V5 padding at the end. Up to 16-bit displays are supported. I @@ -202,7 +202,7 @@ main(int argc, char **argv) if (standard_out) _setmode(fileno(out_file), _O_BINARY); #endif - + /* * Let the user select the target window. */ @@ -265,7 +265,7 @@ Window_Dump(Window window, FILE *out) Window dummywin; XWDFileHeader header; XWDColor xwdcolor; - + int transparentOverlays , multiVis; int numVisuals; XVisualInfo *pVisuals; @@ -294,13 +294,13 @@ Window_Dump(Window window, FILE *out) * Get the parameters of the window being dumped. */ if (debug) outl("xwd: Getting target window information.\n"); - if(!XGetWindowAttributes(dpy, window, &win_info)) + if(!XGetWindowAttributes(dpy, window, &win_info)) Fatal_Error("Can't get target window attributes."); /* handle any frame window */ if (!XTranslateCoordinates (dpy, window, RootWindow (dpy, screen), 0, 0, &absx, &absy, &dummywin)) { - fprintf (stderr, + fprintf (stderr, "%s: unable to translate window coordinates (%d,%d)\n", program_name, absx, absy); exit (1); @@ -344,18 +344,18 @@ Window_Dump(Window window, FILE *out) x = absx - win_info.x; y = absy - win_info.y; - multiVis = GetMultiVisualRegions(dpy,RootWindow(dpy, screen), - absx, absy, + multiVis = GetMultiVisualRegions(dpy,RootWindow(dpy, screen), + absx, absy, width, height,&transparentOverlays,&numVisuals, &pVisuals, &numOverlayVisuals,&pOverlayVisuals,&numImageVisuals, &pImageVisuals,&vis_regions,&vis_image_regions,&allImage) ; if (on_root || multiVis) { if(!multiVis) - image = XGetImage (dpy, RootWindow(dpy, screen), absx, absy, + image = XGetImage (dpy, RootWindow(dpy, screen), absx, absy, width, height, AllPlanes, format); else - image = ReadAreaToImage(dpy, RootWindow(dpy, screen), absx, absy, + image = ReadAreaToImage(dpy, RootWindow(dpy, screen), absx, absy, width, height, numVisuals,pVisuals,numOverlayVisuals,pOverlayVisuals, numImageVisuals, pImageVisuals,vis_regions, @@ -581,7 +581,7 @@ ReadColors(Visual *vis, Colormap cmap, XColor **colors) } XQueryColors(dpy, cmap, *colors, ncolors); - + return(ncolors); } -- 2.7.4 From 7780f6aff5768471794ba1d986d0a31c12fe0437 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Thu, 8 Aug 2013 21:12:15 -0700 Subject: [PATCH 14/16] xwd 1.0.6 Change-Id: Ic9f0f1d6c948e79228fa6b2c0c7dcc56d3a42a3f Signed-off-by: Alan Coopersmith --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 5ce7549..e9ec0a0 100644 --- a/configure.ac +++ b/configure.ac @@ -23,7 +23,7 @@ dnl Process this file with autoconf to create configure. # Initialize Autoconf AC_PREREQ([2.60]) -AC_INIT([xwd], [1.0.5], +AC_INIT([xwd], [1.0.6], [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], [xwd]) AC_CONFIG_SRCDIR([Makefile.am]) AC_CONFIG_HEADERS([config.h]) -- 2.7.4 From 43362b4dbc9322fbe074cba26f22871995bd2e41 Mon Sep 17 00:00:00 2001 From: Sung-Jin Park Date: Tue, 3 Sep 2013 04:28:06 -0400 Subject: [PATCH 15/16] Add a spec file for packaging Change-Id: Idd425c7c2d283d36db18347e789ef7b782b0b99e --- packaging/xwd.spec | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100755 packaging/xwd.spec diff --git a/packaging/xwd.spec b/packaging/xwd.spec new file mode 100755 index 0000000..eb96716 --- /dev/null +++ b/packaging/xwd.spec @@ -0,0 +1,73 @@ +Summary: dump an image of an X Window +Name: xwd +# NOTE: The package version should be set to the X11 major release from which +# the OS release is based upon. +Version: 1.0.6 +Release: 1 +License: MIT +Group: User Interface/X +URL: http://www.x.org + +Source: %{name}-%{version}.tar.gz + +#Source2: ftp://ftp.x.org/pub/individual/app/xwd-1.0.4.tar.bz2 + +BuildRequires: autoconf automake + +#BuildRequires: xorg-x11-xutils-dev +# xfd needs gettext +BuildRequires: gettext +BuildRequires: zlib-devel +BuildRequires: libfontenc-devel +BuildRequires: libX11-devel +BuildRequires: libXmu-devel +BuildRequires: libXext-devel +BuildRequires: libXt-devel +BuildRequires: libXaw-devel +BuildRequires: libXpm-devel +BuildRequires: libXft-devel +BuildRequires: libXrender-devel +BuildRequires: libxkbfile-devel +BuildRequires: libXcursor-devel +BuildRequires: libpng-devel +BuildRequires: libXfixes-devel +BuildRequires: libXi-devel >= 1.2 +BuildRequires: libXxf86vm-devel +BuildRequires: xorg-x11-xbitmaps + +Provides: xwd + +%description +X Window System window dumping utility. Xwd allows X users to store +window images in a specially formatted dump file. This file can then be read +by various other X utilities for redisplay, printing, editing, formatting, ar‐ +chiving, image processing, etc. The target window is selected by clicking the +pointer in the desired window. The keyboard bell is rung once at the begin‐ +ning of the dump and twice when the dump is completed. + +%prep +%setup -q + +%build +%configure +make + +%install +rm -rf $RPM_BUILD_ROOT +mkdir -p %{buildroot}/usr/share/license +cp -af COPYING %{buildroot}/usr/share/license/%{name} + +{ + make install DESTDIR=$RPM_BUILD_ROOT +} + +%remove_docs + +%clean +rm -rf $RPM_BUILD_ROOT + +%files +%defattr(-,root,root,-) +%{_bindir}/* +/usr/share/license/%{name} +#%{_bindir}/xwd -- 2.7.4 From d22ee41060487e1662dd367aaca3f51d31d1f504 Mon Sep 17 00:00:00 2001 From: Boram Park Date: Sat, 19 Jul 2014 12:22:27 +0900 Subject: [PATCH 16/16] not build without x Change-Id: Id9b4b08641bfbf8d8d091e6dd9bd1e18dfc1fe18 --- packaging/xwd.spec | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/packaging/xwd.spec b/packaging/xwd.spec index eb96716..f082114 100755 --- a/packaging/xwd.spec +++ b/packaging/xwd.spec @@ -1,3 +1,5 @@ +%bcond_with x + Summary: dump an image of an X Window Name: xwd # NOTE: The package version should be set to the X11 major release from which @@ -33,10 +35,14 @@ BuildRequires: libpng-devel BuildRequires: libXfixes-devel BuildRequires: libXi-devel >= 1.2 BuildRequires: libXxf86vm-devel -BuildRequires: xorg-x11-xbitmaps +BuildRequires: pkgconfig(xbitmaps) Provides: xwd +%if !%{with x} +ExclusiveArch: +%endif + %description X Window System window dumping utility. Xwd allows X users to store window images in a specially formatted dump file. This file can then be read @@ -49,8 +55,8 @@ ning of the dump and twice when the dump is completed. %setup -q %build -%configure -make +%autogen --disable-static +make %{?_smp_mflags} %install rm -rf $RPM_BUILD_ROOT -- 2.7.4