Currently the PLXcairoDrawableInfo structure used to pass an external X
drawable in to the xcairo driver is private to cairo.h.  This means that
anyone using this feature must define their own structure to do this which
opens up the possibility that they could get the field ordering wrong.  It
also makes it much harder for us to update the structure in future if this
were ever an issue since it would force all users of external X drawables
to find their structure definitions and change them.  If an error were made
the compiler would not pick it up and this could lead to some very odd
symptoms.

The patch below (against svn rev 8364) addresses this by moving the
definition of PLXcairoDrawableInfo from drivers/cairo.c into
include/plplot.h.  It is still protected by the PLD_xcairo so at least in
theory its presence should not cause any trouble when plplot is compiled on
a system without X windows. However, I do not profess to be an expert in
this area so I'll defer to the judgement of others.  Is this a reasonable
solution to the problem?

Even if this particular solution is not adopted I think we need to come up
with some way of making PLXcairoDrawableInfo visible to users.

Regards
  jonathan

diff -ru plplot/drivers/cairo.c plplot-rev/drivers/cairo.c
--- plplot/drivers/cairo.c      2008-04-09 08:58:38.000000000 +0930
+++ plplot-rev/drivers/cairo.c  2008-04-09 09:12:27.000000000 +0930
@@ -124,17 +124,6 @@
 #endif
 ;
 
-/* 
- * Structure for passing external drawables to xcairo devices via
- * the PLESC_DEVINIT escape function.
- */
-#if defined(PLD_xcairo)
-typedef struct {
-  Display *display;
-  Drawable drawable;
-} PLXcairoDrawableInfo;
-#endif
-
 //---------------------------------------------------------------------
 // Font style and weight lookup tables (copied
 // from the psttf driver).
diff -ru plplot/include/plplot.h plplot-rev/include/plplot.h
--- plplot/include/plplot.h     2008-04-09 08:58:35.000000000 +0930
+++ plplot-rev/include/plplot.h 2008-04-09 09:25:13.000000000 +0930
@@ -408,6 +408,18 @@
 #define PLESC_DOUBLEBUFFERING_DISABLE    2
 #define PLESC_DOUBLEBUFFERING_QUERY      3
 
+/* 
+ * 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
 
 /*--------------------------------------------------------------------------*\
  *             BRAINDEAD-ness

-------------------------------------------------------------------------
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

Reply via email to