On Sunday, April 13, 2008 at 23:30:00 (-0500) Maurice LeBrun writes: > Here's the proposed code to be added to plplot.h: > > > +/* > > + * Structure for passing external drawables to xcairo devices via > > + * the PLESC_DEVINIT escape function. > > + */ > > +#if defined(PLD_xcairo) > > +#include <X11/X.h> > > +#include <X11/Xlib.h> > > +typedef struct { > > + Display *display; > > + Drawable drawable; > > +} PLXcairoDrawableInfo; > > +#endif > > We've managed to keep X11 and other driver-specific headers out of plplot.h > for a long time, and I hesitate to start now. Although a particular > plplot distribution may have PLD_xcairo defined, that doesn't mean the user > has any need for it. In which case you are sucking in a lot of unnecessary > stuff to all user code that includes plplot.h. > > So I'd prefer an alternate solution, something along the lines of one of: > > 1. Given that this kind of capability may be useful and/or desired for more > than one driver, generalize the concept. The pointer could be a (void *), > easy enough. The Drawable on my system resolves to: > > X.h:typedef XID Drawable; > Xdefs.h:typedef unsigned long XID; > > so an unsigned long would do the trick. Then cast accordingly in the > driver. > > This approach has been generally followed in the past with colors, input > events, event handlers, etc. But it can be tricky. > > 2. Give up on the idea of genericity for everything and go with a separate > X-windows specific plplot include file, e.g. plplotX.h. This is tempting > since you could add as many convenient definitions as you wished. I've > almost done this on several occasions. But resisted the temptation since > I thought the generic solution was a better way to go, when practical.
Just thought of: 3. Leave it inside the plplot.h header, but only activated if PLD_xcairo AND some user-defined macro were defined. Something like PL_activate_X_headers, or whatever. That way it's always off by default. -- Maurice LeBrun ------------------------------------------------------------------------- This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone _______________________________________________ Plplot-devel mailing list Plplot-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/plplot-devel