Path: utzoo!mnetor!uunet!husc6!ut-sally!srinivas From: srinivas@ut-sally.UUCP (Srini Sankaran) Newsgroups: comp.windows.x Subject: What's wrong with this code? Message-ID: <10856@ut-sally.UUCP> Date: 22 Mar 88 10:42:08 GMT Organization: U. Texas CS Dept., Austin, Texas Lines: 70 Keywords: Xtk and Xlib combined. The following code doesn't work if XTKVIEWPORT is defined. It works (i.e., draw 10 circles) if it is not defined. Can someone help me by explaining why? -thanks srinivas@sally.utexas.edu ...!ut-sally!srinivas -----------------------BEGIN CODE------------------------------------- #include #include #include #include #define XSIZE 512 #define YSIZE 512 static Arg arglist[] = { {XtNwidth, (XtArgVal)XSIZE}, {XtNheight,(XtArgVal)YSIZE}, } ; int main(argc, argv) unsigned int argc; char **argv; { Widget toplevel, viewport; Window win; Display *dpy; GC gc; XSetWindowAttributes xswa; int i; toplevel = XtInitialize("FOO", "FOO", NULL, 0, &argc, argv); viewport = XtCreateManagedWidget("viewport", viewportWidgetClass, toplevel, arglist, XtNumber(arglist)); XtRealizeWidget(toplevel); xswa.background_pixel = 0; xswa.border_pixel = 1; dpy = XtDisplay(viewport); #ifdef XTKVIEWPORT /* Does not work */ win = XtWindow(viewport); #else /* Works */ win = XCreateWindow(dpy, XtWindow(viewport), 0, 0, XSIZE, YSIZE, 2, DefaultDepth(dpy, DefaultScreen(dpy)), InputOutput, DefaultVisual(dpy, DefaultScreen(dpy)), CWBackPixel | CWBorderPixel, &xswa); XMapWindow(dpy, win); #endif gc = XCreateGC(dpy, win, 0, 0); XSetForeground(dpy, gc, 1); XSetBackground(dpy, gc, 0); XSetLineAttributes(dpy, gc, 1, LineSolid, CapButt, JoinMiter); for(;;) { for(i = 0 ; i < 10 ; i ++) { XDrawArc(dpy, win, gc, XSIZE >> 1, YSIZE >> 1, i * (XSIZE >> 5) , i * (YSIZE >> 5), 0, 64*360); XSync(dpy, 0); } } }