kucharsk@number6.Solbourne.COM (William Kucharski) (07/14/90)
After seeing this behavior in the MIT sample server and not seeing the question explicitly resolved in the protocol, I thought I'd ask. Should a 1 pixel filled arc draw anything to the screen? I know that 0 pixel arcs drawn with XDrawArc produce a line, and they do not when drawn with XFillArc. Can anyone clarify this protocol issue? A sample program which shows the issue at hand is included below; thanks in advance. ==================================[ Cut Here ]================================== #include <stdio.h> #include <X11/cursorfont.h> #include <X11/Xlib.h> #include <X11/Xutil.h> static char * msg(err) int err; /* error # to return message for */ { extern int sys_nerr; /* # errors we have messages for */ extern char *sys_errlist[]; /* list of error messages */ char errmsg[27]; if (err < sys_nerr) return(sys_errlist[err]); else { sprintf(errmsg, "Unknown errno (%d)", err); return(errmsg); } } main(argc, argv) int argc; char *argv[]; { extern char *getenv(); extern int errno; Display *dpy; /* display to use */ GC mygc; /* GC */ Window root; /* root window */ Window lastwin, wind, wind2; /* windows to create */ XEvent ev; /* Event holder */ int exposed = 0; /* Is window exposed? */ XSizeHints hints; /* WM Hints */ XGCValues values; /* GC values */ XSetWindowAttributes xswa; /* Window attributes */ XTextProperty winname; /* window name */ unsigned long mask; /* valuemask */ int xr, yr; unsigned int dr, wr, hr, bwr; Window rr; char *display = NULL; char *winnme = "Filled Arcs"; char *wnname; if ((dpy = XOpenDisplay(display)) == NULL) { fprintf(stderr, "%s: Can't Open Display \"%s\" (%s)\n", argv[0], (display ? display : (getenv("DISPLAY") ? getenv("DISPLAY") : "unknown display")), msg(errno)); exit(2); } root = DefaultRootWindow(dpy); /* use root window for a drawable */ XGetGeometry(dpy, DefaultRootWindow(dpy), &rr, &xr, &yr, &wr, &hr, &bwr, &dr); xswa.background_pixel = BlackPixel(dpy, DefaultScreen(dpy)); xswa.cursor = XCreateFontCursor(dpy, XC_leftbutton); xswa.event_mask = ButtonPressMask | ExposureMask; mask = CWBackPixel | CWCursor | CWEventMask; wind = XCreateWindow(dpy, rr, xr, yr, 200, 200, CopyFromParent, CopyFromParent, InputOutput, CopyFromParent, mask, &xswa); wind2 = XCreateWindow(dpy, rr, xr, yr, 200, 200, CopyFromParent, CopyFromParent, InputOutput, CopyFromParent, mask, &xswa); values.foreground = WhitePixel(dpy, DefaultScreen(dpy)); values.background = BlackPixel(dpy, DefaultScreen(dpy)); values.function = GXcopy; values.graphics_exposures = False; mask = GCFunction | GCForeground | GCBackground | GCGraphicsExposures; mygc = XCreateGC(dpy, wind, mask, &values); hints.width = 200; hints.height = 200; hints.base_width = 200; hints.base_height = 200; hints.min_width = 200; hints.min_height = 200; hints.flags = PSize | PMinSize | PBaseSize; wnname = winnme; if (!XStringListToTextProperty(&wnname, 1, &winname)) { fprintf(stderr, "%s: Could not convert window name to Text Property!\n", argv[0]); fflush(stderr); exit(1); } XSetWMProperties(dpy, wind, &winname, NULL, argv, argc, &hints, NULL, NULL); wnname = winnme = "Just Arcs"; if (!XStringListToTextProperty(&wnname, 1, &winname)) { fprintf(stderr, "%s: Could not convert window name to Text Property!\n", argv[0]); fflush(stderr); exit(1); } XSetWMProperties(dpy, wind2, &winname, NULL, argv, argc, &hints, NULL, NULL); XMapRaised(dpy, wind); /* map window */ XMapRaised(dpy, wind2); /* map window */ while(1) { XNextEvent(dpy, &ev); if (ev.type == Expose) { if (exposed < 2) { if (ev.xexpose.window != lastwin) { exposed++; lastwin = ev.xexpose.window; } } } else if (ev.type == ButtonPress) { switch(ev.xbutton.button) { case 1: if (exposed == 2) { XClearWindow(dpy, wind); XClearWindow(dpy, wind2); XFillArc(dpy, wind, mygc, 0, 0, 0, 0, 0, 360*64); XFillArc(dpy, wind, mygc, 10, 10, 5, 0, 0, 360*64); XFillArc(dpy, wind, mygc, 20, 20, 0, 5, 0, 360*64); XFillArc(dpy, wind, mygc, 30, 30, 5, 1, 0, 360*64); XFillArc(dpy, wind, mygc, 40, 40, 1, 5, 0, 360*64); XFillArc(dpy, wind, mygc, 50, 50, 1, 1, 0, 360*64); XFillArc(dpy, wind, mygc, 70, 70, 5, 5, 0, 360*64); XFillArc(dpy, wind, mygc, 120, 120, 25, 25, 0, 360*64); XDrawArc(dpy, wind2, mygc, 0, 0, 0, 0, 0, 360*64); XDrawArc(dpy, wind2, mygc, 10, 10, 5, 0, 0, 360*64); XDrawArc(dpy, wind2, mygc, 20, 20, 0, 5, 0, 360*64); XDrawArc(dpy, wind2, mygc, 30, 30, 5, 1, 0, 360*64); XDrawArc(dpy, wind2, mygc, 40, 40, 1, 5, 0, 360*64); XDrawArc(dpy, wind2, mygc, 50, 50, 1, 1, 0, 360*64); XDrawArc(dpy, wind2, mygc, 70, 70, 5, 5, 0, 360*64); XDrawArc(dpy, wind2, mygc, 120, 120, 25, 25, 0, 360*64); XBell(dpy); XFlush(dpy); } break; case 3: XDestroyWindow(dpy, wind); XDestroyWindow(dpy, wind2); XCloseDisplay(dpy); exit(0); default: break; } } } } ==================================[ Cut Here ]================================== -- =============================================================================== | Internet: kucharsk@Solbourne.COM | William Kucharski | | uucp: ...!{boulder,sun,uunet}!stan!kucharsk | Solbourne Computer, Inc. | = The opinions above are mine alone and NOT those of Solbourne Computer, Inc. =
rws@EXPO.LCS.MIT.EDU (Bob Scheifler) (07/14/90)
After seeing this behavior in the MIT sample server and not seeing the question explicitly resolved in the protocol, I thought I'd ask. Seems unambiguous to me. Should a 1 pixel filled arc draw anything to the screen? Nope. It's trivial to see if you draw the picture.