GNOME Bugzilla – Bug 552513
gtkmm does not build against GTK+ 2.14 on Windows
Last modified: 2008-09-23 17:25:14 UTC
Two functions have changed their signature from GTK+ 2.12 to GTK+ 2.14: gdk_drag_get_protocol_for_display now returns a GdkNativeWindow instead of a guint32, and gdk_selection_send_notify_for_display takes a GdkNativeWindow instead of a guint32 as second parameter. On linux, those two are probably the same. However, on Windows, they are not. The C++ wrappers for these therefore do not compile on Windows. For gdk_drag_get_protocol_for_display we can probably just change the return type, since this does not change the ABI (does it?) For gdk_selection_send_notify_for_display we cannot simply change the parameter since this would break the ABI. I wonder whether we can simply add an overload for this, even if GdkNativeWindow and guint32 are the same on Linux. If not, then we could add the overload for Windows only. Note that this is actually a slight API change. However, since GTK+ did the same change it's probably OK for us as long as the ABI stays compatible. See also http://mail.gnome.org/archives/gtkmm-list/2008-September/msg00056.html.
I can't say much about the compatibility issue but here is a fix that worked for me. I used the modified gtkmm to build a simple app that works.
Created attachment 118851 [details] [review] gtkmm-2.13.7\gdk\gdkmm\display.h updates to match the gtk functions
Created attachment 118852 [details] [review] gtkmm-2.13.7\gdk\gdkmm\display.cc update to match the gtk functions
I removed #define GTK_DISABLE_DEPRECATED from toolbar.ccg and toolbar.cc. Compiling gtkmm 2.12.7 almost works but toolbar.cc compile fails at Toolbar::get_tooltips_object() with an error that says _tooltips is not a member. The troublemaker seems to be gtktoolbar.h where GtkToolbar has this member #ifndef GTK_DISABLE_DEPRECATED GtkTooltips *GSEAL (tooltips); #else gpointer GSEAL (_tooltips); #endif Why the name change (tooltips to _tooltips) in Gtk? To force problems like this to show up? I suppose there are several solutions. gtkmm could contain the #ifndef GTK_DISABLE_DEPRECATED but that seems messy. I could mask the problem by keeping the #define GTK_DISABLE_DEPRECATED in toolbar.cc For now I just commented the cc function to see if there were any other compile problems with the #define GTK_DISABLE_DEPRECATED removed. It appears that is the only problem. With the GdkNativeWindow fix (patch submitted) and commenting out Toolbar::get_tooltips_object() the gtkmm compiled ok. Should gtk be fixed to eliminate that tooltip/_tooltip difference? What is the best solution for this problem?
As pointed out on the mailing list, the toolbar issue has already been fixed in recent versions of gtkmm. In the current toolbar.ccg, Toolbar::get_tooltips_object() always returns 0: http://svn.gnome.org/viewvc/gtkmm/trunk/gtk/src/toolbar.ccg?view=markup
Created attachment 118945 [details] [review] Proposed patch This patch fixes the issue by changing the parameters and return values of these functions to GdkNativeWindow, as proposed by Damon. On Linux, this is the same as guint32, so this is not a problem (I tested this). On Windows, the old functions are kept for compatibility.
> gdk_selection_send_notify_for_display() we cannot simply change the parameter since this would break the ABI. This didn't seem to bother the GTK+ maintainers. If they can just change the types, why can't we?
In C++, the types of a function's arguments are part of the ABI because the function can be overloaded. That's not the case in C.
Oh, yeah, of course that's not true for C. Please apply the patch, but please add real doxygen comments for those deprecated functions.
2008-09-18 Armin Burgmeier <armin@arbur.net> * gdk/src/gdk_methods.def: Regenerated. * gdk/src/display.hg: * gdk/src/display.ccg: Changed window ID parameters and return values for get_drag_protocol and selection_send_notify from guint32 to GdkNativeWindow. These are the same on Linux, so this is not a problem. On Windows, GdkNativeWindow is a pointer, so we keep the old functions to preserve ABI (doing some nasty casts in the implementation). Bug #552513 (Damon Register).