Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!apple!usc!orion.cf.uci.edu!uci-ics!zardoz!tgate!ka3ovk!drilex!axiom!adelie!ora!adrian From: adrian@ora.UUCP (Adrian Nye ) Newsgroups: comp.windows.x Subject: Re: XDrawPoints question Summary: a known problem, with a simple workaround Message-ID: <1670@ora.UUCP> Date: 14 Jul 89 19:58:49 GMT References: <10561@polya.Stanford.EDU> Organization: O'Reilly & Associates, Inc., Newton, MA Lines: 38 In article <10561@polya.Stanford.EDU>, caron@polya.Stanford.EDU (Ilan G. Caron) writes: > > It turns that in the following call, if npoints > ~15000 then I get > an X runtime error (bad request length or something akin). > > XDrawPoints(display, drawable, gc, points, npoints, mode); This is a known problem, that can also happen with all the poly requests; XDrawLines, XDrawSegments, XDrawArcs etc. Each server has a maximum request length, and your request of 15,000 points is too big for your server. The immediate solution is to chop your request into smaller pieces. To determine how small, you find out your server's maximum request size using the R3 function Xlib function XMaxRequestSize (or access the Display structure member directly in R2). Subtract 3, and this is the maximum number of points you can draw in a single XDrawPoints request. You can draw half this many lines, segments, or rectangles, and 1/3 this many arcs. These calculations are based on the sizes of the protocol requests. The reason you get the protocol error BadLength is that most current implementations of Xlib (like MIT R3) don't check to make sure that these requests are small enough. They just pass through your request to the server, and the server detects the error. There has been some talk in the X Consortium of changing Xlib to detect this problem and notify the programmer, or possibly to have Xlib split up the request itself so that applications can draw 15,000 points in a single call without problems. Which of these approaches (if in fact either) will be adopted for R4 has not been decided as far as I know. -- Adrian Nye (617) 527-4210 O'Reilly & Associates, Inc., Publishers of Nutshell Handbooks 981 Chestnut Street, Newton, MA 02164 UUCP: uunet!ora!adrian ARPA: adrian@ora.uu.net