GNOME Bugzilla – Bug 52790
Shouldn't GTK+ be compiled with -D(G|GTK|GDK)_DISABLE_DEPRECATED?
Last modified: 2011-02-04 16:11:52 UTC
Probably. Though it is probably some effort, and even more to get it going with get it going with GDK_DISABLE_DEPRECATED/GDK_DISABLE_COMPAT_H, which also should be present. So, if someone wanted to take that on, that would be great.
While doing that I noticed, that it is obviously your intention to get rid of (gtk/gdk)compat.h and so I first did that. The patch is attached. It simply moves the content of (gtk/gdk)compat.h to the corresponding include files, of course guarded by (GTK/GDK)_DISABLE_DEPRECATED. The versioning system of gtkcompat.h.in went to gtkversion.h.in The GTK_HAVE_ macros are deleted, because now is a good time to get rid of them for good. If you approve, I'm going to check that in and try to make it compile with -DG_DISABLE_DEPRECATED, -DGDK_DISABLE_DEPRECATED and -DGTK_DISABLE_DEPRECATED
Created attachment 479 [details] [review] patch to get rid of (GTK|GDK)_DISABLE_COMPAT_H and (gtk|gdk)compat.h in favour of (GDK|GTK)_DISABLE_DEPRECATED
GTK won't be buildable with -DGTK_DISABLE_DEPRECATED, you need some of the deprecated headers to keep deprecated features working. Instead you'll notice a few files have #define GTK_DISABLE_DEPRECATED at the top - i.e. we are cleaning up individual files that don't need the deprecated features. Doing that for as many files as possible would be good. GTK should probably use G_DISABLE_DEPRECATED and GDK_DISABLE_DEPRECATED though.
Actually I don't notice a few files have #define GTK_DISABLE_DEPRECATED at the top, because none has. But I see the point. I would take a look at that. Please look at the patch removing (gdk/gtk)compat.h first.
I guess I mean some have #define GTK_ENABLE_BROKEN, sorry. I think the patch is right, but Owen/Tim may disagree.
The patch looks very good to me; I don't know how close it is to applying after 6 months :-(. The #defines for GTK_TYPE_GDK_WINDOW_TYPE etc. that have since been added to gtkcompat.h.in could go in gtktypeutils.h for lack of a better location.
Actually most of this is commited Aug 22 by you. Seems you're working to much ;-) Take a rest..... Some things still missing and others just discovered: * remove gdk/gdkcompat.h gtk/gtkcompat.h.in from CVS. * update some non-unix makefiles. * s/GDK_DISABLE_COMPAT_H/GDK_DISABLE_DEPRECATED/ in docs/Changes-2.0. These are so trivial, that I'll go ahead and commit. I'm not closing the bug though, as GTK+ is not yet compiled with -DG_DISABLE_DEPRECATED, -DGDK_DISABLE_DEPRECATED and -DGTK_DISABLE_DEPRECATED. Will have a look.
*** Bug 51127 has been marked as a duplicate of this bug. ***
I've taken a look at atk, pango and gtk+/gdk-pixbuf so far. atk and pango were more than easy. After adding -DG_DISABLE_DEPRECATED both still compiled fine. gtk+/gdk-pixbuf was a bit more ugly. I hope, I havn't overreacted in my patch. Basically I made the _ref/_unref functions (which were just calling g_object_(un|)ref) macros guarded by GDK_DISABLE_DEPRECATED (I wouldn't want to introduce another GDK_PIXBUF_DISABLE_DEPRECATED, and GDK_... seemed the closest). That meant some changes to the docs to (e.g. --scan-options). I'll attach all three patched here.
Created attachment 5959 [details] [review] Patch to compile atk with -DG_DISABLE_DEPRECATED
Created attachment 5960 [details] [review] patch to compile pango with -DG_DISABLE_DEPRECATED
Created attachment 5961 [details] [review] patch to compile gtk+/gdk-pixbuf with -DG_DISABLE_DEPRECATED and -DGDK_DISABLE_DEPRECATED
In the above gdk-pixbuf patch I also removed all G_OBJECT() casts from g_object_(ref|unref), as those functions accept gpointer and check themself... I agree, should have been in another patch...
*** Bug 60865 has been marked as a duplicate of this bug. ***
The atk and pango patches look fine. gdk_pixbuf_ref/unref were deprecated as of: 2001-12-05 Matthias Clasen <matthiasc@poet.de> * gdk-pixbuf.h (gdk_pixbuf_ref, gdk_pixbuf_unref, gdk_pixbuf_animation_ref, gdk_pixbuf_animation_unref): Deprecate. (#66208) The rest of the gdk-pixbuf patch looks fine.
I've committed the atk, pango and gdk-pixbuf parts. I'll have a look at gdk/gtk soon.
Created attachment 6443 [details] [review] GtkViewport sans deprecated and with slight signal improvement.
Created attachment 6475 [details] [review] patch to make GDK compile clean with G_DISABLE_DEPRECATED
Created attachment 6479 [details] [review] TreeView and friends sans deprecated
Created attachment 6481 [details] [review] editable widgets sans deprecated
Created attachment 6482 [details] [review] Gtk*Dialog sans deprecated
Created attachment 6493 [details] [review] GtkSpinButton sans deprecated
Comments on viewport patch: - There is a reason we didn't add g_signal_handlers_disconnect_by_data(); (too much danger of disconnecting the wrong handlers) instead of emulating that with g_signal_handlers_disconnect_matched(), use multiple calls g_signal_handlers_disconnect(). - We should be removing (gpointer) casts as in the g_signal_connect() calls... they aren't necessary.
Created attachment 6696 [details] [review] patch to compile gtk+/gtk (all the files) with -DG_DISABLE_DEPRECATED and DGDK_DISABLE_DEPRECATED flag
I think we need to wait to apply these patches until afer 2.0.0 is out; we're too close to the release to do this much code churn (even safe code churn) for no immediate benefits; there will be conflicts with other outstanding patches, and even pretty automatic patches need review. I apologize to everyone who has worked on these for not being able to get to them sooner; not getting to these patches has to do with outstanding work elsewhere, not with the quality of the patches.
Putting on 2.2, because there is no point in putting these changes on the 2.0.x branch and merging.
If we wait much longer before starting to integrate these patches, we'll be too close to a release again, which would be a pity.
This is more or less done now. There are a few places where deprecated functions are still used, for compatibility mainly. I'm not sure how much worth it would be to do the preprocessor contortions to get around that.
What do you mean by pre-processor contortions?
Adding -DGDK_DISABLE_DEPRECATED and -DGTK_DISABLE_DEPRECATED to the Makefile means either #undefing those for the files that still need those functions, or doing special casing to get around that (#ifdef GTK_COMPILATION or such).
What are you doing now -- adding the #undef?
Nothing right now. I wanted some input from others of what they think would be the best way (or, leave as is, i.e. not worth the extra work).
You mean, you aren't adding the -DGDK_DISABLE_DEPRECATED and -DGTK_DISABLE_DEPRECATED to the Makefile?
Flags added to Makefiles, and some preprocessor magic finished. Currently in CVS.