GNOME Bugzilla – Bug 471397
Gdk::Cairo::set_source_color() should take a const reference to RefPtr
Last modified: 2007-08-30 21:30:21 UTC
The signature for Gdk::Cairo::set_source_color() is as follows: void set_source_color (Cairo::RefPtr<Cairo::Context>& context, const Gdk::Color& color) This makes it impossible to use this function from within a function such as this: void render_foo (const Cairo::RefPtr<Cairo::Context>& cr) { Gdk::Cairo::set_source_color (cr, foo); // won't compile } this is rather annoying since it should work just fine. It would be nice if the set_source_color() function took a const reference to RefPtr, as in: void set_source_color (const Cairo::RefPtr<::Cairo::Context>& context, const Gdk::Color& color)
Oops. And I think some more functions have this problem in this general.[h|cc] file. I guess we should add a const version of these methods and deprecate the non-const ones. Could you prepare a patch and then ask for a freeze-break approval from the release-team? http://live.gnome.org/ReleasePlanning/RequestingFreezeBreaks I doubt that they will have any objection.
Created attachment 94552 [details] [review] Add overloaded functions, deprecate old functions This patch adds overloaded functions that take a const reference for the first parameter instead of a non-const reference and deprecates the old versions of these functions. It also fixes a TODO in the code by introducing new names for two deprecated functions: Gdk::Cairo::rectangle() is deprecated, use Gdk::Cairo::add_rectangle_to_path() instead Gdk::Cairo::region() is deprecated, use Gdk::Cairo::add_regioN_to_path() instead Murray, when you've looked at the patch and are happy with it, let me know so I can propose the change to the release team -- or feel free to do it yourself.
Created attachment 94553 [details] [review] Add overloaded functions, deprecate old functions This patch adds overloaded functions that take a const reference for the first parameter instead of a non-const reference and deprecates the old versions of these functions. It also fixes a TODO in the code by introducing new names for two deprecated functions: Gdk::Cairo::rectangle() is deprecated, use Gdk::Cairo::add_rectangle_to_path() instead Gdk::Cairo::region() is deprecated, use Gdk::Cairo::add_regioN_to_path() instead Murray, when you've looked at the patch and are happy with it, let me know so I can propose the change to the release team -- or feel free to do it yourself.
sorry about the duplicate attachments, bugzilla was misbehaving. there's no difference between the two.
It looks good, though I'd prefer "Use the other overloaded function instead" to read specifically "Use the overloaded function that takes a const RefPtr reference." Please ask for the freeze break now.
I got 2 approvals from the release team (elijah newren and frederic crozat). OK to commit (with the doc changes)?
Yes. Thanks for getting this done.
Committed to trunk with updated documentation (rev 895)
hmm, sorry. I guess I actually committed this to branch gtkmm-2-12. I suppose I should add it to trunk as well.