GNOME Bugzilla – Bug 629344
[API break in GTK+ 2.21.7]: gdk no longer exporting some variables
Last modified: 2010-09-13 17:15:57 UTC
I get the following compile failure: screen.c: In function ‘wnck_screen_construct’: screen.c:585:25: error: ‘gdk_display’ undeclared (first use in this function) screen.c:585:25: note: each undeclared identifier is reported only once for each function it appears in screen.c: In function ‘wnck_screen_get’: screen.c:627:3: error: ‘gdk_display’ undeclared (first use in this function) screen.c: In function ‘_wnck_screen_get_existing’: screen.c:651:3: error: ‘gdk_display’ undeclared (first use in this function) screen.c: In function ‘wnck_screen_get_default’: screen.c:673:20: error: ‘gdk_display’ undeclared (first use in this function) screen.c: In function ‘wnck_screen_get_for_root’: screen.c:701:14: error: ‘gdk_display’ undeclared (first use in this function) make[2]: *** [screen.lo] Error 1 make[2]: Leaving directory `/home/hussam/packages/libwnck/trunk/src/libwnck-2.30.3/libwnck' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/home/hussam/packages/libwnck/trunk/src/libwnck-2.30.3'
That's an API break in GTK+ 2.221.7: * GDK no longer exports variables: gdk_threads_lock, gdk_threads_unlock, gdk_threads_mutex and gdk_display are no longer available This will cause other issues. (will still fix the issue in libwnck)
Just to clarify: I see 2.21.7 has not been released and I quoted the NEWS from 2.90.7 :-) But commit a3c3031a0e1b7a6adece0d859f1f682ba7642672 really does this: it requires GDK_COMPILATION to be defined.
Just to make it clear: It is in the master branch that the gdk variables you mention are no longer exported. In the gtk-2-22 branch just gdk_display has been deprecated. I think the real bug here is that in gtk-2-22, gdkx.h requires GDK_COMPILATION to be defined, in addition to GDK_DISABLE_DEPRECATED and GDK_MULTIHEAD_SAFE being undefined, for gdk_display to be declared. The intent of the GDK_COMPILATION macro is to indicated that libgdk is being compiled, it is never supposed to be set when compiling libgdk-using code. So probably just slight confusion here, and what is intended is that gdk_display should be declared if *either* GDK_DISPLAY_DEPRECATED and GDK_MULTIHEAD_SAFE are defined *or* GDK_COMPILATION is defined.
(That is how GDK_COMPILATION is used before in gdkx.h.)
(In reply to comment #3) > I think the real bug here is that in gtk-2-22, gdkx.h requires GDK_COMPILATION > to be defined, in addition to GDK_DISABLE_DEPRECATED and GDK_MULTIHEAD_SAFE > being undefined, for gdk_display to be declared. > > The intent of the GDK_COMPILATION macro is to indicated that libgdk is being > compiled, it is never supposed to be set when compiling libgdk-using code. > > So probably just slight confusion here, and what is intended is that > gdk_display should be declared if *either* GDK_DISPLAY_DEPRECATED and > GDK_MULTIHEAD_SAFE are defined *or* GDK_COMPILATION is defined. Yep, agree. FWIW, I fixed libwnck to stop using gdk_display.
Created attachment 170021 [details] [review] Suggested patch
Review of attachment 170021 [details] [review]: Only a minor comment: ::: gdk/x11/gdkx.h @@ +35,3 @@ G_BEGIN_DECLS +#if (!defined (GDK_DISABLE_DEPRECATED) && !defined (GDK_MULTIHEAD_SAFE) || defined (GDK_COMPILATION) I think you missed a ")" here, should be #if (!defined (GDK_DISABLE_DEPRECATED) && !defined (GDK_MULTIHEAD_SAFE)) || defined (GDK_COMPILATION)
Thanks, obviously a logic error on my part.