I'm trying to implement in my GTK 2.0 application the advice from question How to create a cairo_t on a Gtk 2 window, and I am perplexed by the result. The error output is
planes_view.c: In function ‘draw_lines_planes’:
planes_view.c:145:33: warning: passing argument 1 of ‘gdk_cairo_create’ from incompatible pointer type [enabled by default]
cr = gdk_cairo_create((struct GdkDrawable *)(view->drawing_area));
^
In file included from /usr/include/gtk-2.0/gdk/gdk.h:33:0,
from /usr/include/gtk-2.0/gtk/gtk.h:32,
from planes_view.h:35,
from planes_view.c:34:
/usr/include/gtk-2.0/gdk/gdkcairo.h:33:10: note: expected ‘struct GdkDrawable *’ but argument is of type ‘struct GdkDrawable *’
cairo_t *gdk_cairo_create (GdkDrawable *drawable);
^
Note that the two conflicting types are identical. How can this be? Perhaps two types with the same name? Even if so, I need to know how to do this right.
The offending line was originally
cr = gdk_cairo_create(view->drawing_area);
And the complaint was that the drawing area's declared type is GtkWidget *, so I tried a normal typecast thus:
cr = gdk_cairo_create((struct GdkDrawable *)(view->drawing_area));
with the results shown above.