[gtkmm] Update for the latest gtk+4



commit c0e79e35feaec8de9d85f242a18d4696884339b1
Author: Kjell Ahlstedt <kjellahlstedt gmail com>
Date:   Fri Oct 27 12:57:14 2017 +0200

    Update for the latest gtk+4
    
    Most updates are replacements of Gdk::Pixbuf by Cairo::Surface.
    Gtk+ is moving away from GdkPixbuf.
    
    * gdk/gdkmm/cairoutils.[h|cc]: New files with code that simplifies the use
    of _WRAP_METHOD() for methods that return a Cairo::RefPtr<Cairo::Surface> or
    a std::vector<Cairo::RefPtr<Cairo::Surface>>.

 demos/gtk-demo/demowindow.cc     |    2 +-
 demos/gtk-demo/example_images.cc |   12 ++--
 gdk/gdkmm/cairoutils.cc          |   42 +++++++++++++
 gdk/gdkmm/cairoutils.h           |  124 ++++++++++++++++++++++++++++++++++++++
 gdk/gdkmm/filelist.am            |    4 +-
 gdk/src/dragcontext.hg           |    2 -
 gdk/src/window.ccg               |    1 +
 gdk/src/window.hg                |    5 +-
 gtk/src/aboutdialog.ccg          |    1 +
 gtk/src/aboutdialog.hg           |   11 ++--
 gtk/src/cellrenderer.hg          |    2 -
 gtk/src/cellrendererpixbuf.hg    |    2 +-
 gtk/src/clipboard.ccg            |    1 +
 gtk/src/clipboard.hg             |    3 +
 gtk/src/entry.ccg                |    8 +-
 gtk/src/entry.hg                 |   17 +++---
 gtk/src/iconinfo.ccg             |    1 +
 gtk/src/iconinfo.hg              |    3 +-
 gtk/src/icontheme.ccg            |    1 +
 gtk/src/icontheme.hg             |    5 +-
 gtk/src/iconview.ccg             |    1 +
 gtk/src/iconview.hg              |    4 +-
 gtk/src/image.ccg                |    6 +--
 gtk/src/image.hg                 |   26 +++------
 gtk/src/printjob.ccg             |    1 +
 gtk/src/printjob.hg              |    7 +--
 gtk/src/recentinfo.hg            |    6 --
 gtk/src/treeview.ccg             |    1 +
 gtk/src/treeview.hg              |    1 -
 gtk/src/window.ccg               |    1 +
 gtk/src/window.hg                |   31 +++++-----
 tools/m4/convert_gtk.m4          |    3 +
 32 files changed, 245 insertions(+), 90 deletions(-)
---
diff --git a/demos/gtk-demo/demowindow.cc b/demos/gtk-demo/demowindow.cc
index 5a7a057..8febc54 100644
--- a/demos/gtk-demo/demowindow.cc
+++ b/demos/gtk-demo/demowindow.cc
@@ -392,7 +392,7 @@ void DemoWindow::add_data_tabs(const std::string& filename)
     Gtk::Widget* widget = nullptr;
     auto image = new Gtk::Image();
     image->set_from_resource(resource_name);
-    if (image->get_pixbuf() || image->get_animation())
+    if (image->get_surface())
     {
       widget = image;
     }
diff --git a/demos/gtk-demo/example_images.cc b/demos/gtk-demo/example_images.cc
index e7896f9..787a79e 100644
--- a/demos/gtk-demo/example_images.cc
+++ b/demos/gtk-demo/example_images.cc
@@ -244,17 +244,17 @@ void Example_Images::on_loader_area_prepared()
 
 void Example_Images::on_loader_area_updated(int/*x*/, int/*y*/, int/*width*/, int/*height*/)
 {
-  /* We know the pixbuf inside the Gtk::Image has changed, but the image
-   * itself doesn't know this; so give it a hint by setting the pixbuf
+  /* We know the cairo surface inside the Gtk::Image has changed, but the image
+   * itself doesn't know this; so give it a hint by setting the surface
    * again. Queuing a redraw used to be sufficient, but nowadays Gtk::Image
-   * uses GtkIconHelper which caches the pixbuf state and will just redraw
+   * uses GtkIconHelper which caches the surface state and will just redraw
    * from the cache.
    * If we wanted to be really efficient, we could use a drawing area or
    * something instead of a Gtk::Image, so we could control the exact
-   * position of the pixbuf on the display, then we could queue a draw
+   * position of the surface on the display, then we could queue a draw
    * for only the updated area of the image.
    */
-  auto refPixbuf = m_Image_Progressive.get_pixbuf();
-  m_Image_Progressive.set(refPixbuf);
+  auto refSurface = m_Image_Progressive.get_surface();
+  m_Image_Progressive.set(refSurface);
 }
 
diff --git a/gdk/gdkmm/cairoutils.cc b/gdk/gdkmm/cairoutils.cc
new file mode 100644
index 0000000..3e3cbe9
--- /dev/null
+++ b/gdk/gdkmm/cairoutils.cc
@@ -0,0 +1,42 @@
+/* Copyright (C) 2017 The gtkmm Development Team
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <gdkmm/cairoutils.h>
+
+namespace Gdk
+{
+
+namespace Cairo
+{
+
+::Cairo::RefPtr< ::Cairo::Context> wrap(cairo_t* cobject, bool has_reference)
+{
+  return ::Cairo::make_refptr_for_instance< ::Cairo::Context>(cobject ? new ::Cairo::Context(cobject, 
has_reference) : nullptr);
+}
+
+::Cairo::RefPtr< ::Cairo::Region> wrap(cairo_region_t* cobject, bool has_reference)
+{
+  return ::Cairo::make_refptr_for_instance< ::Cairo::Region>(cobject ? new ::Cairo::Region(cobject, 
has_reference) : nullptr);
+}
+
+::Cairo::RefPtr< ::Cairo::Surface> wrap(cairo_surface_t* cobject, bool has_reference)
+{
+  return ::Cairo::make_refptr_for_instance< ::Cairo::Surface>(cobject ? new ::Cairo::Surface(cobject, 
has_reference) : nullptr);
+}
+
+} // namespace Cairo
+
+} // namespace Gdk
diff --git a/gdk/gdkmm/cairoutils.h b/gdk/gdkmm/cairoutils.h
new file mode 100644
index 0000000..e10f513
--- /dev/null
+++ b/gdk/gdkmm/cairoutils.h
@@ -0,0 +1,124 @@
+/* Copyright (C) 2017 The gtkmm Development Team
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef _GDKMM_CAIROUTILS_H
+#define _GDKMM_CAIROUTILS_H
+
+#include <cairomm/context.h>
+#include <cairomm/region.h>
+#include <cairomm/surface.h>
+#include <glibmm/containerhandle_shared.h>
+#include <type_traits>
+
+namespace Gdk
+{
+namespace Cairo
+{
+
+// Cairomm has no wrap() functions, similar to Glib::wrap().
+// They are used in _CONVERSION() macros and in TypeTraits<Cairo::RefPtr<T>>.
+
+/** Creates a Cairo::RefPtr with a C++ wrapper for the C instance.
+ *
+ * @param cobject The C instance.
+ * @param has_reference Whether we already have a reference. Otherwise, the
+ *        function will take an extra reference.
+ * @returns A C++ instance that wraps this C instance. If @a cobject is a nullptr,
+ *          returns an empty Cairo::RefPtr.
+ *
+ * @newin{3,92}
+ */
+::Cairo::RefPtr< ::Cairo::Context> wrap(cairo_t* cobject, bool has_reference = true);
+
+/** Creates a Cairo::RefPtr with a C++ wrapper for the C instance.
+ *
+ * @param cobject The C instance.
+ * @param has_reference Whether we already have a reference. Otherwise, the
+ *        function will take an extra reference.
+ * @returns A C++ instance that wraps this C instance. If @a cobject is a nullptr,
+ *          returns an empty Cairo::RefPtr.
+ *
+ * @newin{3,92}
+ */
+::Cairo::RefPtr< ::Cairo::Region> wrap(cairo_region_t* cobject, bool has_reference = true);
+
+/** Creates a Cairo::RefPtr with a C++ wrapper for the C instance.
+ *
+ * @param cobject The C instance.
+ * @param has_reference Whether we already have a reference. Otherwise, the
+ *        function will take an extra reference.
+ * @returns A C++ instance that wraps this C instance. If @a cobject is a nullptr,
+ *          returns an empty Cairo::RefPtr.
+ *
+ * @newin{3,92}
+ */
+::Cairo::RefPtr< ::Cairo::Surface> wrap(cairo_surface_t* cobject, bool has_reference = true);
+
+} //namespace Cairo
+} //namespace Gdk
+
+namespace Glib
+{
+namespace Container_Helpers
+{
+// Used by Glib::ArrayHandler<>, Glib::ListHandler<>, Glib::SListHandler<>.
+// It's not possible to make a specialization like
+//   template <T>
+//   struct TypeTraits<Cairo::RefPtr<T>>
+// because both Glib::RefPtr and Cairo:RefPtr are typedef'ed std::shared_ptr.
+// The compiler would see template <T> struct TypeTraits<Cairo::RefPtr<T>> as
+// an illegal redefinition of template <T> struct TypeTraits<Glib::RefPtr<T>>.
+
+/** Specialization for pointers to cairo surfaces.
+ * The C++ type is always a Cairo::RefPtr<>.
+ *
+ * @newin{3,92}
+ */
+template <>
+struct TypeTraits<::Cairo::RefPtr<::Cairo::Surface>>
+{
+  using CppType = ::Cairo::RefPtr<::Cairo::Surface>;
+  using CType = ::Cairo::Surface::cobject*;
+  using CTypeNonConst = ::Cairo::Surface::cobject*;
+
+  static CType to_c_type(const CppType& ptr) { return ptr ? ptr->cobj() : nullptr; }
+  static CType to_c_type(CType ptr) { return ptr; }
+  static CppType to_cpp_type(CType ptr) { return Gdk::Cairo::wrap(ptr, false); }
+  static void release_c_type(CType ptr) { cairo_surface_destroy(ptr); }
+};
+
+/** Specialization for pointers to const cairo surfaces.
+ * The C++ type is always a Cairo::RefPtr<>.
+ *
+ * @newin{3,92}
+ */
+template <>
+struct TypeTraits<::Cairo::RefPtr<const ::Cairo::Surface>>
+{
+  using CppType = Cairo::RefPtr<const ::Cairo::Surface>;
+  using CType = const ::Cairo::Surface::cobject*;
+  using CTypeNonConst = ::Cairo::Surface::cobject*;
+
+  static CType to_c_type(const CppType& ptr) { return ptr ? ptr->cobj() : nullptr; }
+  static CType to_c_type(CType ptr) { return ptr; }
+  static CppType to_cpp_type(CType ptr) { return Gdk::Cairo::wrap(const_cast<CTypeNonConst>(ptr), false); }
+  static void release_c_type(CType ptr) { cairo_surface_destroy(const_cast<CTypeNonConst>(ptr)); }
+};
+
+} // namespace Container_Helpers
+} // namespace Glib
+
+#endif //_GDKMM_CAIROUTILS_H
diff --git a/gdk/gdkmm/filelist.am b/gdk/gdkmm/filelist.am
index b51bdd6..e013943 100644
--- a/gdk/gdkmm/filelist.am
+++ b/gdk/gdkmm/filelist.am
@@ -4,6 +4,6 @@ gdkmm_files_built_cc = $(gdkmm_files_used_hg:.hg=.cc) wrap_init.cc
 gdkmm_files_built_h  = $(gdkmm_files_used_hg:.hg=.h)
 gdkmm_files_built_ph = $(patsubst %.hg,private/%_p.h,$(gdkmm_files_used_hg))
 
-gdkmm_files_extra_cc = general.cc value_cairo.cc
-gdkmm_files_extra_h  = general.h value_cairo.h wrap_init.h
+gdkmm_files_extra_cc = cairoutils.cc general.cc value_cairo.cc
+gdkmm_files_extra_h  = cairoutils.h general.h value_cairo.h wrap_init.h
 gdkmm_files_extra_ph =
diff --git a/gdk/src/dragcontext.hg b/gdk/src/dragcontext.hg
index 9e637e5..e48d8e0 100644
--- a/gdk/src/dragcontext.hg
+++ b/gdk/src/dragcontext.hg
@@ -71,8 +71,6 @@ public:
   #m4 _CONVERSION(`const ::Cairo::RefPtr< ::Cairo::Surface>&',`cairo_surface_t*',`($3) ? 
const_cast<cairo_surface_t*>(($3)->cobj()) : nullptr')
   _WRAP_METHOD(void set_icon(const ::Cairo::RefPtr< ::Cairo::Surface>& surface), gtk_drag_set_icon_surface)
 
-  _WRAP_METHOD(void set_icon(const Glib::RefPtr<Gdk::Pixbuf>& pixbuf, int hot_x, int hot_y), 
gtk_drag_set_icon_pixbuf)
-
   _WRAP_METHOD(void set_icon_name(const Glib::ustring& name, int hot_x, int hot_y), gtk_drag_set_icon_name)
   _WRAP_METHOD(void set_icon(), gtk_drag_set_icon_default)
 
diff --git a/gdk/src/window.ccg b/gdk/src/window.ccg
index f88e6c9..3631308 100644
--- a/gdk/src/window.ccg
+++ b/gdk/src/window.ccg
@@ -16,6 +16,7 @@
  */
 
 #include <gdk/gdk.h>
+#include <gdkmm/cairoutils.h>
 #include <gdkmm/cursor.h>
 #include <gdkmm/device.h>
 #include <gdkmm/types.h>
diff --git a/gdk/src/window.hg b/gdk/src/window.hg
index 4a4fae6..bba7176 100644
--- a/gdk/src/window.hg
+++ b/gdk/src/window.hg
@@ -45,7 +45,6 @@ _WRAP_ENUM(FullscreenMode, GdkFullscreenMode,
   s#^ALL_MONITORS$#ON_ALL_MONITORS#)
 
 class Cursor;
-class Pixbuf;
 class GLContext;
 class DrawContext;
 class DrawingContext;
@@ -211,8 +210,8 @@ public:
   _WRAP_METHOD(EventMask get_source_events(InputSource source) const, gdk_window_get_source_events)
   _WRAP_METHOD(void set_source_events(InputSource source, EventMask event_mask), 
gdk_window_set_source_events)
 
-#m4 _CONVERSION(`const std::vector< Glib::RefPtr<Gdk::Pixbuf> 
&',`GList*',`Glib::ListHandler<Glib::RefPtr<Gdk::Pixbuf> >::vector_to_list($3).data ()')
-  _WRAP_METHOD(void set_icon_list(const std::vector< Glib::RefPtr<Gdk::Pixbuf> >& pixbufs), 
gdk_window_set_icon_list)
+#m4 _CONVERSION(`const 
std::vector<::Cairo::RefPtr<::Cairo::Surface>>&',`GList*',`Glib::ListHandler<::Cairo::RefPtr<::Cairo::Surface>>::vector_to_list($3).data()')
+  _WRAP_METHOD(void set_icon_list(const std::vector<::Cairo::RefPtr<::Cairo::Surface>>& surfaces), 
gdk_window_set_icon_list)
   void unset_icon();
   _WRAP_METHOD(void set_icon_name(const Glib::ustring& name), gdk_window_set_icon_name)
 
diff --git a/gtk/src/aboutdialog.ccg b/gtk/src/aboutdialog.ccg
index 6382f3c..5088569 100644
--- a/gtk/src/aboutdialog.ccg
+++ b/gtk/src/aboutdialog.ccg
@@ -17,6 +17,7 @@
  */
 
 #include <glibmm/vectorutils.h>
+#include <gdkmm/cairoutils.h>
 
 #include <gtk/gtk.h>
 
diff --git a/gtk/src/aboutdialog.hg b/gtk/src/aboutdialog.hg
index dc5a6dc..379e931 100644
--- a/gtk/src/aboutdialog.hg
+++ b/gtk/src/aboutdialog.hg
@@ -21,6 +21,7 @@ _CONFIGINCLUDE(gtkmmconfig.h)
 #include <vector>
 
 #include <gtkmm/dialog.h>
+#include <gdkmm/value_cairo.h>
 
 _DEFS(gtkmm,gtk)
 _PINCLUDE(gtkmm/private/dialog_p.h)
@@ -100,12 +101,12 @@ public:
   _WRAP_METHOD(Glib::ustring get_translator_credits() const, gtk_about_dialog_get_translator_credits)
   _WRAP_METHOD(void set_translator_credits(const Glib::ustring& translator_credits), 
gtk_about_dialog_set_translator_credits)
 
-  _WRAP_METHOD(Glib::RefPtr<Gdk::Pixbuf> get_logo(), gtk_about_dialog_get_logo)
-  _WRAP_METHOD(Glib::RefPtr<const Gdk::Pixbuf> get_logo() const, gtk_about_dialog_get_logo, constversion)
+  _WRAP_METHOD(Cairo::RefPtr<Cairo::Surface> get_logo(), gtk_about_dialog_get_logo, refreturn)
+  _WRAP_METHOD(Cairo::RefPtr<const Cairo::Surface> get_logo() const, gtk_about_dialog_get_logo, 
constversion, refreturn)
 
-  _WRAP_METHOD(void set_logo(const Glib::RefPtr<Gdk::Pixbuf>& logo), gtk_about_dialog_set_logo)
+  _WRAP_METHOD(void set_logo(const Cairo::RefPtr<Cairo::Surface>& logo), gtk_about_dialog_set_logo)
 
-  /** Sets the pixbuf to be displayed as logo in the about dialog.
+  /** Sets the surface to be displayed as logo in the about dialog.
    * The logo is set to the default window icon set with
    * Gtk::Window::set_default_icon() or Gtk::Window::set_default_icon_list().
    *
@@ -134,7 +135,7 @@ public:
   _WRAP_PROPERTY("documenters", std::vector<Glib::ustring>)
   _WRAP_PROPERTY("translator_credits", std::vector<Glib::ustring>)
   _WRAP_PROPERTY("artists", std::vector<Glib::ustring>)
-  _WRAP_PROPERTY("logo", Glib::RefPtr<Gdk::Pixbuf>)
+  _WRAP_PROPERTY("logo", Cairo::RefPtr<Cairo::Surface>)
   _WRAP_PROPERTY("logo_icon_name", Glib::ustring)
   _WRAP_PROPERTY("wrap_license", bool)
 
diff --git a/gtk/src/cellrenderer.hg b/gtk/src/cellrenderer.hg
index 524ef05..8e6af01 100644
--- a/gtk/src/cellrenderer.hg
+++ b/gtk/src/cellrenderer.hg
@@ -44,8 +44,6 @@ class CellRenderer :
   _CLASS_GTKOBJECT(CellRenderer,GtkCellRenderer,GTK_CELL_RENDERER,Gtk::Object,GObject)
 public:
 
-  _IGNORE(gtk_cell_renderer_get_size) //Deprecated
-
   _WRAP_METHOD(SizeRequestMode get_request_mode() const, gtk_cell_renderer_get_request_mode)
   _WRAP_METHOD(void get_preferred_width(Widget& widget, int& minimum_width, int& natural_width) const, 
gtk_cell_renderer_get_preferred_width)
   _WRAP_METHOD(void get_preferred_height_for_width(Widget& widget, int width, int& minimum_height, int& 
natural_height) const, gtk_cell_renderer_get_preferred_height_for_width)
diff --git a/gtk/src/cellrendererpixbuf.hg b/gtk/src/cellrendererpixbuf.hg
index a834bb2..0b4bb55 100644
--- a/gtk/src/cellrendererpixbuf.hg
+++ b/gtk/src/cellrendererpixbuf.hg
@@ -51,7 +51,7 @@ public:
   _WRAP_PROPERTY("stock_detail", Glib::ustring)
   _WRAP_PROPERTY("icon-name", Glib::ustring)
   _WRAP_PROPERTY("gicon", Glib::RefPtr<Gio::Icon>)
-  _WRAP_PROPERTY("surface", ::Cairo::RefPtr< ::Cairo::Surface>)
+  _WRAP_PROPERTY("surface", Cairo::RefPtr<Cairo::Surface>)
 
   Glib::PropertyProxy_Base _property_renderable() override;
 };
diff --git a/gtk/src/clipboard.ccg b/gtk/src/clipboard.ccg
index b45dc86..f4c24bc 100644
--- a/gtk/src/clipboard.ccg
+++ b/gtk/src/clipboard.ccg
@@ -18,6 +18,7 @@
 
 #include <glibmm/vectorutils.h>
 
+#include <gdkmm/cairoutils.h>
 #include <gdkmm/types.h>
 
 #include <gtkmm/textbuffer.h>
diff --git a/gtk/src/clipboard.hg b/gtk/src/clipboard.hg
index dce708d..bc58903 100644
--- a/gtk/src/clipboard.hg
+++ b/gtk/src/clipboard.hg
@@ -121,6 +121,7 @@ public:
   _IGNORE(gtk_clipboard_set_text)
 
   _WRAP_METHOD(void set_image(const Glib::RefPtr<Gdk::Pixbuf>& pixbuf), gtk_clipboard_set_image)
+  _WRAP_METHOD(void set_surface(const Cairo::RefPtr<Cairo::Surface>& surface), gtk_clipboard_set_surface)
 
   /// For instance: void on_received(const SelectionData& selection_data);
   typedef sigc::slot<void(const SelectionData&)> SlotReceived;
@@ -255,6 +256,8 @@ public:
   //Maybe the result should be const, but constness is not so clear-cut here. murrayc
   _WRAP_METHOD(Glib::RefPtr<Gdk::Pixbuf> wait_for_image() const, gtk_clipboard_wait_for_image)
 
+  // wait_for_surface() is const because it returns a newly allocated cairo surface.
+  _WRAP_METHOD(Cairo::RefPtr<Cairo::Surface> wait_for_surface() const, gtk_clipboard_wait_for_surface)
   _WRAP_METHOD(bool wait_is_text_available() const, gtk_clipboard_wait_is_text_available)
   _WRAP_METHOD(bool wait_is_rich_text_available(const Glib::RefPtr<TextBuffer>& buffer) const, 
gtk_clipboard_wait_is_rich_text_available)
   _WRAP_METHOD(bool wait_is_image_available() const, gtk_clipboard_wait_is_image_available)
diff --git a/gtk/src/entry.ccg b/gtk/src/entry.ccg
index 0d2dc91..62dd47c 100644
--- a/gtk/src/entry.ccg
+++ b/gtk/src/entry.ccg
@@ -17,16 +17,16 @@
  */
 
 #include <gtk/gtk.h>
+#include <gdkmm/cairoutils.h>
 
 using IconPosition = Gtk::Entry::IconPosition;
 
 namespace Gtk
 {
 
-
-void Entry::set_icon_from_pixbuf(const Glib::RefPtr<Gdk::Pixbuf>& pixbuf, IconPosition icon_pos)
+void Entry::set_icon_from_surface(const ::Cairo::RefPtr< ::Cairo::Surface>& surface, IconPosition icon_pos)
 {
-  gtk_entry_set_icon_from_pixbuf(gobj(), static_cast<GtkEntryIconPosition>(icon_pos), Glib::unwrap(pixbuf));
+  gtk_entry_set_icon_from_surface(gobj(), static_cast<GtkEntryIconPosition>(icon_pos), surface ? 
surface->cobj() : nullptr);
 }
 
 void Entry::set_icon_from_icon_name(const Glib::ustring& icon_name, IconPosition icon_pos)
@@ -42,7 +42,7 @@ void Entry::set_icon_from_gicon(const Glib::RefPtr<Gio::Icon>& icon, IconPositio
 void Entry::unset_icon(IconPosition icon_pos)
 {
   //We could use any one of these set_icon_from_* functions:
-  gtk_entry_set_icon_from_pixbuf(gobj(), static_cast<GtkEntryIconPosition>(icon_pos), nullptr);
+  gtk_entry_set_icon_from_surface(gobj(), static_cast<GtkEntryIconPosition>(icon_pos), nullptr);
 }
 
 void Entry::set_icon_activatable(bool activatable, IconPosition icon_pos)
diff --git a/gtk/src/entry.hg b/gtk/src/entry.hg
index f63f3e4..f97fb22 100644
--- a/gtk/src/entry.hg
+++ b/gtk/src/entry.hg
@@ -25,6 +25,7 @@
 #include <gtkmm/image.h> //For Image::Type.
 #include <gtkmm/border.h>
 #include <gtkmm/entrybuffer.h>
+#include <gdkmm/value_cairo.h>
 #include <pangomm/attrlist.h>
 #include <pangomm/tabarray.h>
 
@@ -114,9 +115,9 @@ public:
   _WRAP_METHOD(void set_placeholder_text(const Glib::ustring& text), gtk_entry_set_placeholder_text)
 
   //We hand-code these so we can change the parameter order, so we can have a default parameter value:
-  _WRAP_METHOD_DOCS_ONLY(gtk_entry_set_icon_from_pixbuf)
-  void set_icon_from_pixbuf(const Glib::RefPtr<Gdk::Pixbuf>& pixbuf, IconPosition icon_pos = 
IconPosition::PRIMARY);
-  _IGNORE(gtk_entry_set_icon_from_pixbuf)
+  _WRAP_METHOD_DOCS_ONLY(gtk_entry_set_icon_from_surface)
+  void set_icon_from_surface(const Cairo::RefPtr<Cairo::Surface>& surface, IconPosition icon_pos = 
IconPosition::PRIMARY);
+  _IGNORE(gtk_entry_set_icon_from_surface)
 
   _WRAP_METHOD_DOCS_ONLY(gtk_entry_set_icon_from_icon_name)
   void set_icon_from_icon_name(const Glib::ustring& icon_name, IconPosition icon_pos = 
IconPosition::PRIMARY);
@@ -127,7 +128,7 @@ public:
   _IGNORE(gtk_entry_set_icon_from_gicon)
 
   /** Do not show any icon in the specified position.
-   * See set_icon_from_pixbuf(), set_icon_from_icon_name(), and set_icon_from_gicon().
+   * See set_icon_from_surface(), set_icon_from_icon_name(), and set_icon_from_gicon().
    *
    * @param icon_pos The icon position.
    *
@@ -136,8 +137,8 @@ public:
   void unset_icon(IconPosition icon_pos = IconPosition::PRIMARY);
 
   _WRAP_METHOD(Image::Type get_icon_storage_type(IconPosition icon_pos = IconPosition::PRIMARY) const, 
gtk_entry_get_icon_storage_type)
-  _WRAP_METHOD(Glib::RefPtr<Gdk::Pixbuf> get_icon_pixbuf(IconPosition icon_pos = IconPosition::PRIMARY), 
gtk_entry_get_icon_pixbuf, refreturn)
-  _WRAP_METHOD(Glib::RefPtr<const Gdk::Pixbuf> get_icon_pixbuf(IconPosition icon_pos = 
IconPosition::PRIMARY) const, gtk_entry_get_icon_pixbuf, refreturn, constversion)
+  _WRAP_METHOD(Cairo::RefPtr<Cairo::Surface> get_icon_surface(IconPosition icon_pos = 
IconPosition::PRIMARY), gtk_entry_get_icon_surface)
+  _WRAP_METHOD(Cairo::RefPtr<const Cairo::Surface> get_icon_surface(IconPosition icon_pos = 
IconPosition::PRIMARY) const, gtk_entry_get_icon_surface, constversion)
   _WRAP_METHOD(Glib::ustring get_icon_name(IconPosition icon_pos = IconPosition::PRIMARY) const, 
gtk_entry_get_icon_name)
   _WRAP_METHOD(Glib::RefPtr<Gio::Icon> get_icon_gicon(IconPosition icon_pos = IconPosition::PRIMARY), 
gtk_entry_get_icon_gicon, refreturn)
   _WRAP_METHOD(Glib::RefPtr<const Gio::Icon> get_icon_gicon(IconPosition icon_pos = IconPosition::PRIMARY) 
const, gtk_entry_get_icon_gicon, refreturn, constversion)
@@ -242,8 +243,8 @@ public:
   _WRAP_PROPERTY("caps-lock-warning", bool)
   _WRAP_PROPERTY("progress-fraction", double)
   _WRAP_PROPERTY("progress-pulse-step", double)
-  _WRAP_PROPERTY("primary-icon-pixbuf", Glib::RefPtr<Gdk::Pixbuf>)
-  _WRAP_PROPERTY("secondary-icon-pixbuf", Glib::RefPtr<Gdk::Pixbuf>)
+  _WRAP_PROPERTY("primary-icon-surface", Cairo::RefPtr<Cairo::Surface>)
+  _WRAP_PROPERTY("secondary-icon-surface", Cairo::RefPtr<Cairo::Surface>)
   _WRAP_PROPERTY("primary-icon-name", Glib::ustring)
   _WRAP_PROPERTY("secondary-icon-name", Glib::ustring)
   _WRAP_PROPERTY("primary-icon-gicon", Glib::RefPtr<Gio::Icon>)
diff --git a/gtk/src/iconinfo.ccg b/gtk/src/iconinfo.ccg
index 0ad43bd..d7d239e 100644
--- a/gtk/src/iconinfo.ccg
+++ b/gtk/src/iconinfo.ccg
@@ -18,6 +18,7 @@
 #include <glibmm/vectorutils.h>
 
 #include <gtk/gtk.h>
+#include <gdkmm/cairoutils.h>
 #include <gtkmm/icontheme.h>
 //TODO: Install and use this? #include <giomm/slot_async.h>
 
diff --git a/gtk/src/iconinfo.hg b/gtk/src/iconinfo.hg
index 4903ec3..2435304 100644
--- a/gtk/src/iconinfo.hg
+++ b/gtk/src/iconinfo.hg
@@ -52,8 +52,7 @@ public:
   _WRAP_METHOD(Glib::ustring get_filename() const, gtk_icon_info_get_filename)
   _WRAP_METHOD(Glib::RefPtr<Gdk::Pixbuf> load_icon(), gtk_icon_info_load_icon, errthrow)
 
- #m4 _CONVERSION(`cairo_surface_t*',`::Cairo::RefPtr< ::Cairo::Surface>',`::Cairo::make_refptr_for_instance< 
::Cairo::Surface>(new Cairo::Surface($3, true /* do not take reference */))')
-  _WRAP_METHOD(::Cairo::RefPtr< ::Cairo::Surface> load_surface(const Glib::RefPtr<Gdk::Window>& for_window), 
gtk_icon_info_load_surface, errthrow)
+  _WRAP_METHOD(Cairo::RefPtr<const Cairo::Surface> load_surface(const Glib::RefPtr<Gdk::Window>& for_window) 
const, gtk_icon_info_load_surface, errthrow)
 
   //TODO: Documentation
   Glib::RefPtr<Gdk::Pixbuf> load_symbolic(const Gdk::RGBA& fg, const Gdk::RGBA& success_color, const 
Gdk::RGBA& warning_color, const Gdk::RGBA& error_color, bool& was_symbolic);
diff --git a/gtk/src/icontheme.ccg b/gtk/src/icontheme.ccg
index de6ddda..058fcfb 100644
--- a/gtk/src/icontheme.ccg
+++ b/gtk/src/icontheme.ccg
@@ -16,6 +16,7 @@
  */
 
 #include <glibmm/vectorutils.h>
+#include <gdkmm/cairoutils.h>
 
 #include <gtk/gtk.h> //For gtk_icon_theme_error_get_type().
 
diff --git a/gtk/src/icontheme.hg b/gtk/src/icontheme.hg
index 64427c9..f392d72 100644
--- a/gtk/src/icontheme.hg
+++ b/gtk/src/icontheme.hg
@@ -73,8 +73,9 @@ public:
   _WRAP_METHOD(Glib::RefPtr<Gdk::Pixbuf> load_icon(const Glib::ustring& icon_name, int size, IconLookupFlags 
flags = (IconLookupFlags)0) const, gtk_icon_theme_load_icon, errthrow)
     _WRAP_METHOD(Glib::RefPtr<Gdk::Pixbuf> load_icon(const Glib::ustring& icon_name, int size, int scale, 
IconLookupFlags flags = (IconLookupFlags)0) const, gtk_icon_theme_load_icon_for_scale, errthrow)
 
- #m4 _CONVERSION(`cairo_surface_t*',`::Cairo::RefPtr< ::Cairo::Surface>',`::Cairo::make_refptr_for_instance< 
::Cairo::Surface>(new Cairo::Surface($3, true /* do not take reference */))')
-  _WRAP_METHOD(::Cairo::RefPtr< ::Cairo::Surface> load_surface(const Glib::ustring& icon_name, int size, int 
scale, const Glib::RefPtr<Gdk::Window>& for_window, IconLookupFlags flags = (IconLookupFlags)0), 
gtk_icon_theme_load_surface, errthrow)
+  _WRAP_METHOD(Cairo::RefPtr<const Cairo::Surface> load_surface(const Glib::ustring& icon_name,
+    int size, int scale, const Glib::RefPtr<Gdk::Window>& for_window, IconLookupFlags flags = 
(IconLookupFlags)0) const,
+    gtk_icon_theme_load_surface, errthrow)
 
 #m4 _CONVERSION(`GList*',`std::vector<Glib::ustring>',`Glib::ListHandler<Glib::ustring>::list_to_vector($3, 
Glib::OWNERSHIP_DEEP)')
   _WRAP_METHOD(std::vector<Glib::ustring> list_icons(const Glib::ustring& context) const, 
gtk_icon_theme_list_icons)
diff --git a/gtk/src/iconview.ccg b/gtk/src/iconview.ccg
index 36750cf..a7adb01 100644
--- a/gtk/src/iconview.ccg
+++ b/gtk/src/iconview.ccg
@@ -17,6 +17,7 @@
 
 #include <glibmm/vectorutils.h>
 
+#include <gdkmm/cairoutils.h>
 #include <gtkmm/adjustment.h>
 #include <gtk/gtk.h>
 
diff --git a/gtk/src/iconview.hg b/gtk/src/iconview.hg
index 170a77c..14d28be 100644
--- a/gtk/src/iconview.hg
+++ b/gtk/src/iconview.hg
@@ -330,8 +330,8 @@ public:
   bool get_dest_item_at_pos(int drag_x, int drag_y, DropPosition& pos) const;
   _IGNORE(gtk_icon_view_get_dest_item_at_pos)
 
-#m4 
_CONVERSION(`cairo_surface_t*',`Cairo::RefPtr<Cairo::Surface>',`Cairo::make_refptr_for_instance<Cairo::Surface>(new
 Cairo::Surface($3, false /* take reference */))')
-  _WRAP_METHOD(Cairo::RefPtr<Cairo::Surface> create_drag_icon( const TreeModel::Path& path), 
gtk_icon_view_create_drag_icon)
+  // create_drag_icon() is const because it returns a newly created cairo surface.
+  _WRAP_METHOD(Cairo::RefPtr<Cairo::Surface> create_drag_icon(const TreeModel::Path& path) const, 
gtk_icon_view_create_drag_icon)
 
 #m4 _INITIALIZATION(`Gdk::Rectangle&',`GdkRectangle', `$3 = Glib::wrap(&($4))')
   _WRAP_METHOD(bool get_cell_rect(const TreeModel::Path& path, const CellRenderer& cell{?}, Gdk::Rectangle& 
rect{.>>}) const, gtk_icon_view_get_cell_rect)
diff --git a/gtk/src/image.ccg b/gtk/src/image.ccg
index 9e177ae..d8aa449 100644
--- a/gtk/src/image.ccg
+++ b/gtk/src/image.ccg
@@ -17,17 +17,13 @@
  */
 
 #include <gtk/gtk.h>
+#include <gdkmm/cairoutils.h>
 
 using Type = Gtk::Image::Type;
 
 namespace Gtk
 {
 
-Image::Image(const Glib::RefPtr<Gdk::PixbufAnimation>& animation)
-:
-  _CONSTRUCT("pixbuf-animation", Glib::unwrap(animation))
-{}
-
 Glib::ustring Image::get_icon_name() const
 {
   const gchar* pchIconName = nullptr;
diff --git a/gtk/src/image.hg b/gtk/src/image.hg
index a4db7f6..99609b3 100644
--- a/gtk/src/image.hg
+++ b/gtk/src/image.hg
@@ -17,7 +17,7 @@
  */
 
 #include <gtkmm/widget.h>
-#include <gdkmm/pixbufanimation.h>
+#include <gdkmm/value_cairo.h>
 #include <giomm/icon.h>
 
 _DEFS(gtkmm,gtk)
@@ -50,12 +50,11 @@ public:
   /** Creates an Image widget displaying the file @a filename.
    * If the file isn't found or can't be loaded, the resulting Gtk::Image will display a "broken image" icon.
    *
-   * If the file contains an animation, the image will contain an animation.
-   *
    * If you need to detect failures to load the file, use Gdk::Pixbuf::create_from_file() to load the file 
yourself,
-   * then create the GtkImage from the pixbuf. (Or for animations, use 
Gdk::PixbufAnimation::create_from_file()).
+   * then create the GtkImage from the pixbuf.
    *
-   * The storage type (get_storage_type()) of the returned image is not defined. It will be whatever is 
appropriate for displaying the file.
+   * The storage type (get_storage_type()) of the returned image is not defined.
+   * It will be whatever is appropriate for displaying the file.
    */
   _WRAP_CTOR(Image(const std::string& filename), gtk_image_new_from_file)
 
@@ -69,16 +68,12 @@ public:
   //But we do wrap gtk_image_set_from_icon_name()
   _IGNORE(gtk_image_new_from_icon_name)
 
-  explicit Image(const Glib::RefPtr<Gdk::PixbufAnimation>& animation);
-
   _WRAP_METHOD(void set(const std::string& filename), gtk_image_set_from_file)
   _WRAP_METHOD(void set_from_resource(const std::string& resource_path), gtk_image_set_from_resource)
   _WRAP_METHOD(void set(const Glib::RefPtr<Gdk::Pixbuf>& pixbuf), gtk_image_set_from_pixbuf)
-  _WRAP_METHOD(void set(const Glib::RefPtr<Gdk::PixbufAnimation>& animation), gtk_image_set_from_animation)
   _WRAP_METHOD(void set(const Glib::RefPtr<const Gio::Icon>& icon, IconSize size), gtk_image_set_from_gicon)
 
-#m4 _CONVERSION(`const ::Cairo::RefPtr< ::Cairo::Surface>&',`cairo_surface_t*',`($3) ? 
const_cast<cairo_surface_t*>(($3)->cobj()) : nullptr')
-  _WRAP_METHOD(void set(const ::Cairo::RefPtr< ::Cairo::Surface>& surface), gtk_image_set_from_surface)
+  _WRAP_METHOD(void set(const Cairo::RefPtr<Cairo::Surface>& surface), gtk_image_set_from_surface)
 
   _WRAP_METHOD(void set_from_icon_name(const Glib::ustring& icon_name, IconSize size), 
gtk_image_set_from_icon_name)
 
@@ -87,11 +82,8 @@ public:
 
   _WRAP_METHOD(Type get_storage_type() const, gtk_image_get_storage_type)
 
-  _WRAP_METHOD(Glib::RefPtr<Gdk::Pixbuf> get_pixbuf(), gtk_image_get_pixbuf, refreturn)
-  _WRAP_METHOD(Glib::RefPtr<const Gdk::Pixbuf> get_pixbuf() const, gtk_image_get_pixbuf, refreturn, 
constversion)
-
-  _WRAP_METHOD(Glib::RefPtr<Gdk::PixbufAnimation> get_animation(), gtk_image_get_animation, refreturn)
-  _WRAP_METHOD(Glib::RefPtr<const Gdk::PixbufAnimation> get_animation() const, gtk_image_get_animation, 
refreturn, constversion)
+  _WRAP_METHOD(Cairo::RefPtr<Cairo::Surface> get_surface(), gtk_image_get_surface, refreturn)
+  _WRAP_METHOD(Cairo::RefPtr<const Cairo::Surface> get_surface() const, gtk_image_get_surface, refreturn, 
constversion)
 
  /** Gets the Gio::Icon and size being displayed by the Gtk::Image.
   * The storage type of the image must be IMAGE_EMPTY or
@@ -121,17 +113,15 @@ public:
  _WRAP_METHOD(int get_pixel_size() const, gtk_image_get_pixel_size)
  _WRAP_METHOD(void set_pixel_size(int pixel_size), gtk_image_set_pixel_size)
 
-  _WRAP_PROPERTY("pixbuf", Glib::RefPtr<Gdk::Pixbuf>)
   _WRAP_PROPERTY("file", Glib::ustring)
   _WRAP_PROPERTY("icon-size", int)
   _WRAP_PROPERTY("pixel-size", int)
-  _WRAP_PROPERTY("pixbuf-animation", Glib::RefPtr<Gdk::PixbufAnimation>)
   _WRAP_PROPERTY("icon-name", Glib::ustring)
   _WRAP_PROPERTY("storage-type", Type)
   _WRAP_PROPERTY("gicon", Glib::RefPtr<Gio::Icon>)
   _WRAP_PROPERTY("use-fallback", bool)
   _WRAP_PROPERTY("resource", std::string)
-  _WRAP_PROPERTY("surface", ::Cairo::RefPtr< ::Cairo::Surface>)
+  _WRAP_PROPERTY("surface", Cairo::RefPtr<Cairo::Surface>)
 };
 
 } //namespace Gtk
diff --git a/gtk/src/printjob.ccg b/gtk/src/printjob.ccg
index 6d2aba3..a9bb3cf 100644
--- a/gtk/src/printjob.ccg
+++ b/gtk/src/printjob.ccg
@@ -16,6 +16,7 @@
  */
 
 #include <gtk/gtkunixprint.h>
+#include <gdkmm/cairoutils.h>
 
 // This Signal Proxy allows the C++ coder to specify a sigc::slot instead of a static function.
 
diff --git a/gtk/src/printjob.hg b/gtk/src/printjob.hg
index a76cce2..f9b59a5 100644
--- a/gtk/src/printjob.hg
+++ b/gtk/src/printjob.hg
@@ -60,11 +60,8 @@ public:
   _WRAP_METHOD(PrintStatus get_status() const, gtk_print_job_get_status)
   _WRAP_METHOD(void set_source_file(const std::string& filename), gtk_print_job_set_source_file, errthrow)
 
-  #m4 
_CONVERSION(`cairo_surface_t*',`Cairo::RefPtr<Cairo::Surface>',`Cairo::make_refptr_for_instance<Cairo::Surface>(new
 Cairo::Surface($3, false /* take reference */))')
-  #m4 _CONVERSION(`cairo_surface_t*',`Cairo::RefPtr<const 
Cairo::Surface>',`Cairo::make_refptr_for_instance<Cairo::Surface>(new Cairo::Surface($3, false /* take 
reference */))')
-
-  _WRAP_METHOD(Cairo::RefPtr<Cairo::Surface> get_surface(), gtk_print_job_get_surface, errthrow)
-  _WRAP_METHOD(Cairo::RefPtr<const Cairo::Surface> get_surface() const, gtk_print_job_get_surface, errthrow)
+  _WRAP_METHOD(Cairo::RefPtr<Cairo::Surface> get_surface(), gtk_print_job_get_surface, refreturn, errthrow)
+  _WRAP_METHOD(Cairo::RefPtr<const Cairo::Surface> get_surface() const, gtk_print_job_get_surface, 
refreturn, constversion, errthrow)
 
   _WRAP_METHOD(void set_track_print_status(bool track_status = true), gtk_print_job_set_track_print_status)
   _WRAP_METHOD(bool get_track_print_status() const, gtk_print_job_get_track_print_status)
diff --git a/gtk/src/recentinfo.hg b/gtk/src/recentinfo.hg
index 19cbfdf..bbf207c 100644
--- a/gtk/src/recentinfo.hg
+++ b/gtk/src/recentinfo.hg
@@ -17,7 +17,6 @@
 
 #include <vector>
 
-#include <gdkmm/pixbuf.h>
 #include <giomm/icon.h>
 #include <giomm/appinfo.h>
 #include <ctime>
@@ -78,11 +77,6 @@ public:
 
   _WRAP_METHOD(bool has_group(const Glib::ustring& group_name) const, gtk_recent_info_has_group)
 
-  _WRAP_METHOD(Glib::RefPtr<Gdk::Pixbuf> get_icon(int size),
-               gtk_recent_info_get_icon, refreturn)
-  _WRAP_METHOD(Glib::RefPtr<const Gdk::Pixbuf> get_icon(int size) const,
-               gtk_recent_info_get_icon, refreturn, constversion)
-
   _WRAP_METHOD(Glib::RefPtr<Gio::Icon> get_gicon(),
                gtk_recent_info_get_gicon, refreturn)
   _WRAP_METHOD(Glib::RefPtr<const Gio::Icon> get_gicon() const,
diff --git a/gtk/src/treeview.ccg b/gtk/src/treeview.ccg
index 02d7e19..70561c8 100644
--- a/gtk/src/treeview.ccg
+++ b/gtk/src/treeview.ccg
@@ -17,6 +17,7 @@
 
 #include <climits> // INT_MIN, etc.
 #include <glibmm/vectorutils.h>
+#include <gdkmm/cairoutils.h>
 #include <gtkmm/treeviewcolumn.h>
 #include <gtkmm/treeview_private.h>
 #include <gtkmm/treemodel.h>
diff --git a/gtk/src/treeview.hg b/gtk/src/treeview.hg
index 5c62bc5..da927be 100644
--- a/gtk/src/treeview.hg
+++ b/gtk/src/treeview.hg
@@ -638,7 +638,6 @@ public:
    */
   bool get_dest_row_at_pos(int drag_x, int drag_y, TreeModel::Path& path, DropPosition& pos) const;
 
-#m4 
_CONVERSION(`cairo_surface_t*',`Cairo::RefPtr<Cairo::Surface>',`Cairo::make_refptr_for_instance<Cairo::Surface>(new
 Cairo::Surface($3, true /* take reference */))')
   _WRAP_METHOD(Cairo::RefPtr<Cairo::Surface> create_row_drag_icon(const TreeModel::Path& path) const, 
gtk_tree_view_create_row_drag_icon)
 
 /* Interactive search */
diff --git a/gtk/src/window.ccg b/gtk/src/window.ccg
index 8e93244..993333b 100644
--- a/gtk/src/window.ccg
+++ b/gtk/src/window.ccg
@@ -20,6 +20,7 @@
 
 #include <gtkmm/accelgroup.h>
 #include <gdkmm/cursor.h>
+#include <gdkmm/cairoutils.h>
 #include <gtk/gtk.h>
 
 
diff --git a/gtk/src/window.hg b/gtk/src/window.hg
index 665b23d..cc12161 100644
--- a/gtk/src/window.hg
+++ b/gtk/src/window.hg
@@ -19,6 +19,7 @@
 #include <vector>
 
 #include <glibmm/object.h>
+#include <gdkmm/value_cairo.h>
 #include <gtkmm/bin.h>
 #include <gtkmm/application.h>
 #include <gtkmm/windowgroup.h>
@@ -61,7 +62,7 @@ public:
   _WRAP_PROPERTY("default_width", int)
   _WRAP_PROPERTY("default_height", int)
   _WRAP_PROPERTY("destroy_with_parent", bool)
-  _WRAP_PROPERTY("icon", Glib::RefPtr<Gdk::Pixbuf>)
+  _WRAP_PROPERTY("icon", Cairo::RefPtr<Cairo::Surface>)
   _WRAP_PROPERTY("mnemonics-visible", bool)
   _WRAP_PROPERTY("icon-name", Glib::ustring)
   _WRAP_PROPERTY("screen", Glib::RefPtr<Gdk::Screen>)
@@ -214,33 +215,33 @@ dnl
   _WRAP_METHOD(void set_deletable(bool setting = true), gtk_window_set_deletable)
   _WRAP_METHOD(bool get_deletable() const, gtk_window_get_deletable)
 
-#m4 _CONVERSION(`GList*',`std::vector< Glib::RefPtr<Gdk::Pixbuf> >',`Glib::ListHandler< 
Glib::RefPtr<Gdk::Pixbuf> >::list_to_vector($3, Glib::OWNERSHIP_SHALLOW)')
-  _WRAP_METHOD(std::vector< Glib::RefPtr<Gdk::Pixbuf> > get_icon_list(), gtk_window_get_icon_list)
-#m4 _CONVERSION(`GList*',`std::vector< Glib::RefPtr<const Gdk::Pixbuf> >',`Glib::ListHandler< 
Glib::RefPtr<const Gdk::Pixbuf> >::list_to_vector($3, Glib::OWNERSHIP_SHALLOW)')
-  _WRAP_METHOD(std::vector< Glib::RefPtr<const Gdk::Pixbuf> > get_icon_list() const, 
gtk_window_get_icon_list)
+#m4 
_CONVERSION(`GList*',`std::vector<Cairo::RefPtr<Cairo::Surface>>',`Glib::ListHandler<Cairo::RefPtr<Cairo::Surface>>::list_to_vector($3,
 Glib::OWNERSHIP_SHALLOW)')
+  _WRAP_METHOD(std::vector<Cairo::RefPtr<Cairo::Surface>> get_icon_list(), gtk_window_get_icon_list)
+#m4 _CONVERSION(`GList*',`std::vector<Cairo::RefPtr<const 
Cairo::Surface>>',`Glib::ListHandler<Cairo::RefPtr<const Cairo::Surface>>::list_to_vector($3, 
Glib::OWNERSHIP_SHALLOW)')
+  _WRAP_METHOD(std::vector<Cairo::RefPtr<const Cairo::Surface>> get_icon_list() const, 
gtk_window_get_icon_list)
 
-#m4 _CONVERSION(`const std::vector< Glib::RefPtr<Gdk::Pixbuf> >&',`GList*',`Glib::ListHandler< 
Glib::RefPtr<Gdk::Pixbuf> >::vector_to_list($3).data ()')
-  _WRAP_METHOD(void set_icon_list(const std::vector< Glib::RefPtr<Gdk::Pixbuf> >& list),
+#m4 _CONVERSION(`const 
std::vector<Cairo::RefPtr<Cairo::Surface>>&',`GList*',`Glib::ListHandler<Cairo::RefPtr<Cairo::Surface>>::vector_to_list($3).data()')
+  _WRAP_METHOD(void set_icon_list(const std::vector<Cairo::RefPtr<Cairo::Surface>>& list),
                gtk_window_set_icon_list)
 
-  _WRAP_METHOD(void set_icon(const Glib::RefPtr<Gdk::Pixbuf>& icon),
+  _WRAP_METHOD(void set_icon(const Cairo::RefPtr<Cairo::Surface>& icon),
                gtk_window_set_icon)
 
   _WRAP_METHOD(void set_icon_name(const Glib::ustring& name), gtk_window_set_icon_name, newin "2,18")
   _WRAP_METHOD(bool set_icon_from_file(const std::string& filename), gtk_window_set_icon_from_file, errthrow)
 
-  _WRAP_METHOD(Glib::RefPtr<Gdk::Pixbuf> get_icon(), gtk_window_get_icon, refreturn)
-  _WRAP_METHOD(Glib::RefPtr<const Gdk::Pixbuf> get_icon() const, gtk_window_get_icon, refreturn, 
constversion)
+  _WRAP_METHOD(Cairo::RefPtr<Cairo::Surface> get_icon(), gtk_window_get_icon, refreturn)
+  _WRAP_METHOD(Cairo::RefPtr<const Cairo::Surface> get_icon() const, gtk_window_get_icon, refreturn, 
constversion)
 
   _WRAP_METHOD(Glib::ustring get_icon_name() const, gtk_window_get_icon_name)
 
-  _WRAP_METHOD(static void set_default_icon_list(
-                   const std::vector< Glib::RefPtr<Gdk::Pixbuf> >& list),
-               gtk_window_set_default_icon_list)
+ _WRAP_METHOD(static void set_default_icon_list(
+              const std::vector<Cairo::RefPtr<Cairo::Surface>>& list),
+              gtk_window_set_default_icon_list)
 
-  _WRAP_METHOD(static std::vector< Glib::RefPtr<Gdk::Pixbuf> > get_default_icon_list(), 
gtk_window_get_default_icon_list)
+  _WRAP_METHOD(static std::vector<Cairo::RefPtr<Cairo::Surface>> get_default_icon_list(), 
gtk_window_get_default_icon_list)
 
-  _WRAP_METHOD(static void set_default_icon(const Glib::RefPtr<Gdk::Pixbuf>& icon), 
gtk_window_set_default_icon)
+  _WRAP_METHOD(static void set_default_icon(const Cairo::RefPtr<Cairo::Surface>& icon), 
gtk_window_set_default_icon)
   _WRAP_METHOD(static void set_default_icon_name(const Glib::ustring& name), 
gtk_window_set_default_icon_name)
   _WRAP_METHOD(static bool set_default_icon_from_file(const std::string& filename), 
gtk_window_set_default_icon_from_file, errthrow)
   _WRAP_METHOD(static void set_auto_startup_notification(bool setting = true), 
gtk_window_set_auto_startup_notification)
diff --git a/tools/m4/convert_gtk.m4 b/tools/m4/convert_gtk.m4
index d8557e7..84ce8a0 100644
--- a/tools/m4/convert_gtk.m4
+++ b/tools/m4/convert_gtk.m4
@@ -510,6 +510,9 @@ _CONVERSION(`const ::Cairo::RefPtr< ::Cairo::Context>&',`cairo_t*',`($3)->cobj()
 _CONVERSION(`const ::Cairo::RefPtr<const ::Cairo::Context>&',`cairo_t*',`const_cast<cairo_t*>(($3)->cobj())')
 _CONVERSION(`const ::Cairo::FontOptions&',`const cairo_font_options_t*',`($3).cobj()')
 
+_CONVERSION(`const Cairo::RefPtr<Cairo::Surface>&',`cairo_surface_t*',`(($3) ? ($3)->cobj() : nullptr)')
+_CONVERSION(`cairo_surface_t*',`Cairo::RefPtr<Cairo::Surface>',`Gdk::Cairo::wrap($3)')
+_CONVERSION(`cairo_surface_t*',`Cairo::RefPtr<const Cairo::Surface>',`Gdk::Cairo::wrap($3)')
 
 #Printer
 _CONVERSION(`GtkPrinter*',`Glib::RefPtr<Printer>',`Glib::wrap($3)')



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]