]> Pileus Git - ~andy/gtk/commitdiff
x11: typedef GdkX11Display to GdkDisplay
authorBenjamin Otte <otte@redhat.com>
Mon, 20 Dec 2010 22:43:04 +0000 (23:43 +0100)
committerMatthias Clasen <mclasen@redhat.com>
Tue, 21 Dec 2010 17:07:07 +0000 (12:07 -0500)
This is for compatibility reasons. We want to change APIs that operate
on X11 objects to take the X11 objects as arguments. However, this would
break a lot of APIs and we'd like to avoid this, so we play this little
trick (we will use the same trick for the other X11 objects). Also,
gobject-introspection and other bindings can correctly attach the
functions to the correct types as it is the same scheme that GDK2 used
for pixmaps, windows and drawables.

For GTK 4, we will remove this trick, so apps should properly cast their
objects right now.
Unfortunately, I don't think there is a way to use
GDK_DISABLE_DEPRECATED or similar macros to check for proper type casts
while compiling ensure compatibility with future GDK versions. I'm free
to consider them though.

gdk/x11/gdkx11display.h

index 70e8a140d5cc2a78d8f568cb6d910a31eb5d8bb0..b544ac47bc5f864708a3df1f0a9e5ca609bc6939 100644 (file)
 
 G_BEGIN_DECLS
 
+#ifdef GDK_COMPILATION
 typedef struct _GdkX11Display GdkX11Display;
+#else
+typedef GdkDisplay GdkX11Display;
+#endif
 typedef struct _GdkX11DisplayClass GdkX11DisplayClass;
 
 #define GDK_TYPE_X11_DISPLAY              (gdk_x11_display_get_type())