Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!ucbvax!gilan.Berkeley.EDU!elf From: elf@gilan.Berkeley.EDU (Marc Singer) Newsgroups: comp.windows.x Subject: Simple programming quiz Message-ID: <29675@ucbvax.BERKELEY.EDU> Date: 14 Jun 89 21:45:10 GMT Sender: usenet@ucbvax.BERKELEY.EDU Lines: 54 Why does this apparently simple X program not work? ---------------------- /* test.c */ #include static char szLabel[] = "Hi there."; main() { Display *display; Window xwnd; XSetWindowAttributes attrib; XGCValues xgcv; GC gc; char ch; display = XOpenDisplay(0); attrib.background_pixel = WhilePixel(display, 0); attrib.border_pixel = BlackPixel(display, 0); xwnd = XCreateWindow(display, RootWindow(display, 0), 10, 10, 500, 40, 2, CopyFromParent, InputOutput, CopyFromParent, CWBackPixel | CWBorderPixel | CWEventMask, &attrib); XMapWindow(display, xwnd); XFlush(display); /* xgcv.foreground = BlackPixel(display, 0); */ /* xgcv.function = GXinvert; */ /* xgcv.plane_mask = AllPlanes; */ /* gc = XCreateGC(display, xwnd, GCForeground | GCFunction | GCPlaneMask, &xgcv); */ gc = XCreateGC(display, xwnd, 0, 0); XDrawString(display, xwnd, gc, 10, 10, szLabel, strlen(szLabel)); XDrawLine(display, xwnd, gc, 0, 0, 500, 40); /* XFillRectangle(display, xwnd, gc, 0, 0, 1000, 1000); */ XFlush(display); ch = getchar(); } /* main */ ------------------ I know that some of the attributes for the window and the GC are redundant. And I have tried specifying the visual and depth of the XCreateWindow explicitly. Still, why do I not get anything other than a background in the window? Marc Singer "When fullness is taken from fullness, fullness still remains." Invocation of the Isha Upanishad