Path: utzoo!attcan!uunet!lll-winken!ames!amdahl!kucharsk From: kucharsk@uts.amdahl.com (William Kucharski) Newsgroups: comp.windows.x Subject: Bug in xwd(1) Keywords: bug xwd Message-ID: Date: 6 Nov 89 00:17:51 GMT Organization: Amdahl Coup, UTS Products Hen House Lines: 96 I've already sent this to xbugs, but thought I'd post it anyway: X Window System Bug Report xbugs@expo.lcs.mit.edu VERSION: R3 CLIENT MACHINE and OPERATING SYSTEM: All DISPLAY: All WINDOW MANAGER: All AREA: xwd SYNOPSIS: The "-nobdrs" option does not work correctly. Also, trying to dump a window clipped in height by the root window will cause a invalid parameter error from XGetImage. DESCRIPTION: The logic in determining the window area to save when the "-nobdrs" option is selected is wrong, and would account for a window's border width too many times. Also, due to a typo in the code, a window's width would be adjusted if the height of the save area was clipped by the display size, resulting in an invalid width parameter. REPEAT BY: xwd -nobdrs > foo; xwud -in foo Place window partially off bottom of display; do an xwd dump of that window. SAMPLE FIX: *** xwd.c.orig Sun Nov 5 15:53:44 1989 --- xwd.c Sun Nov 5 15:55:10 1989 *************** *** 184,191 **** if(!XGetWindowAttributes(dpy, window, &win_info)) Fatal_Error("Can't get target window attributes."); ! absx = win_info.x + (nobdrs ? win_info.border_width : 0); ! absy = win_info.y + (nobdrs ? win_info.border_width : 0); width = win_info.width + (nobdrs ? 0 : (2 * win_info.border_width)); height = win_info.height + (nobdrs ? 0 : (2 * win_info.border_width)); dwidth = DisplayWidth (dpy, screen); --- 184,191 ---- if(!XGetWindowAttributes(dpy, window, &win_info)) Fatal_Error("Can't get target window attributes."); ! absx = win_info.x; ! absy = win_info.y; width = win_info.width + (nobdrs ? 0 : (2 * win_info.border_width)); height = win_info.height + (nobdrs ? 0 : (2 * win_info.border_width)); dwidth = DisplayWidth (dpy, screen); *************** *** 195,201 **** if (absx < 0) width += absx, absx = 0; if (absy < 0) height += absy, absy = 0; if (absx + width > dwidth) width = dwidth - absx; ! if (absy + height > dheight) width = dheight - absy; XFetchName(dpy, window, &win_name); if (!win_name || !win_name[0]) --- 195,201 ---- if (absx < 0) width += absx, absx = 0; if (absy < 0) height += absy, absy = 0; if (absx + width > dwidth) width = dwidth - absx; ! if (absy + height > dheight) height = dheight - absy; XFetchName(dpy, window, &win_name); if (!win_name || !win_name[0]) -- =============================================================================== | ARPA: kucharsk@uts.amdahl.com | William Kucharski | | UUCP: ...!{ames,apple,sun,uunet}!amdahl!kucharsk | Amdahl Corporation | =============================================================================== | Saying: "It's a window system named 'X,' NOT a system named 'X Windows'" | =============================================================================== | Disclaimer: "The opinions expressed above may not agree with mine at any | | other moment in time, so they certainly can't be those of my | | employer." | ===============================================================================