strauss@AEROSPACE.AERO.ORG (09/15/90)
X Window System Bug Report xbugs@expo.lcs.mit.edu VERSION: R4 CLIENT MACHINE and OPERATING SYSTEM: Any (Tested on Sun4) DISPLAY TYPE: Any (Tested on CGsix) WINDOW MANAGER: TWM AREA: TWM SYNOPSIS: TWM does not correctly handle a configure notify event to that changes the height of a window. DESCRIPTION: There are really two problems here. First, the SetupWindow routine in resize.c says that the height should be "the height of the frame window w/o border" but the height being passed in has bw added in. This doesn't affect the actual operation. The reason for this is that the child is enlarged by the border width, but the frame paints the border over, so the extra area isn't visible. The second problem is that Scr->TitleHeight is being added instead of Tmp_win->title_height so that the size of the title bar is being added even when the window does not have a title bar. This makes the window taller by the height of the title bar. REPEAT BY: Compile this program (bug.c) as cc -o bug bug.c -lX11. #include <stdio.h> #include <X11/Xlib.h> main() { Display *dpy; Window w; if (!(dpy=XOpenDisplay(NULL))) { fprintf(stderr, "Failed to open display\n"); exit(0); } XSynchronize(dpy, 1); /* Create a 100x100 window */ if (!(w=XCreateSimpleWindow(dpy, RootWindow(dpy, DefaultScreen(dpy)), 0, 0, 100, 100, 2, BlackPixel(dpy, DefaultScreen(dpy)), WhitePixel(dpy, DefaultScreen(dpy))))) { fprintf(stderr, "Failed to create window\n"); exit(0); } XMapWindow(dpy, w); sleep(5); /* Resize it to 100x100 but notice that TWM makes it 100x125 */ XResizeWindow(dpy, w, 100, 100); XBell(dpy, 100); while (1); } Place "Untitled" in the NoTitle section of your .twmrc file. Then run bug and drop the window that appears. It will wait 5 seconds and then resize the window so that it should remain 100x100, you will see instead that the window has gotten taller by the size of you titlebar. SAMPLE FIX: *** events.c.dist Fri Jul 13 15:07:48 1990 --- events.c Fri Sep 14 18:28:35 1990 *************** *** 2198,2204 **** width = cre->width; } if (cre->value_mask & CWHeight) { ! height = cre->height + Scr->TitleHeight + bw; } if (width != Tmp_win->frame_width || height != Tmp_win->frame_height) --- 2198,2204 ---- width = cre->width; } if (cre->value_mask & CWHeight) { ! height = cre->height + Tmp_win->title_height; } if (width != Tmp_win->frame_width || height != Tmp_win->frame_height) Sincerely, - |Daryll ------------------------------------------------------------------------------- Daryll Strauss f The Aerospace Corp. strauss@aero.org n Mail Stop: M1-102 ...!uunet!aero.org!strauss o P.O. Box 92957 r Los Angeles, Ca. 90009 "Just another X hacker" appologies R. Schwartz d (213) 336-9358 -------------------------------------------------------------------------------