[gtkmm] Tidy up references to namespace Cairo



commit 11c1f9a8880c672750397cade37fccbf1760f9c3
Author: Kjell Ahlstedt <kjellahlstedt gmail com>
Date:   Sat Oct 28 11:56:05 2017 +0200

    Tidy up references to namespace Cairo
    
    Move many _CONVERSION() macros with Cairo::RefPtr from the .hg files to
    convert_gdk.m4 and convert_gtk.m4.
    Use the new Gdk:Cairo::wrap() instead of Cairo::make_refptr_for_instance<>()
    directly.
    Replace ::Cairo with Cairo in the Gtk namespace. The extra colons are necessary
    only in the Gdk namespace, where the compiler will search in the Gdk::Cairo
    namespace, unless it's explicit that Cairo in the global namespace is meant.

 gdk/gdkmm/general.cc       |    7 ++++---
 gdk/src/cursor.ccg         |    1 +
 gdk/src/cursor.hg          |    2 --
 gdk/src/dragcontext.hg     |    1 -
 gdk/src/drawingcontext.ccg |    1 +
 gdk/src/drawingcontext.hg  |    7 ++-----
 gdk/src/glcontext.ccg      |    1 +
 gdk/src/glcontext.hg       |    1 -
 gdk/src/window.hg          |    5 -----
 gtk/src/drawingarea.ccg    |    3 ++-
 gtk/src/drawingarea.hg     |    2 +-
 gtk/src/entry.ccg          |    2 +-
 gtk/src/printcontext.ccg   |    1 +
 gtk/src/printcontext.hg    |    8 +++-----
 gtk/src/snapshot.ccg       |    8 ++++----
 gtk/src/snapshot.hg        |    4 ++--
 gtk/src/stylecontext.hg    |   31 +++++++++++++++----------------
 gtk/src/widget.hg          |   18 ++++++++----------
 tools/m4/convert_gdk.m4    |    7 +++++++
 tools/m4/convert_gtk.m4    |   11 +++++++----
 20 files changed, 60 insertions(+), 61 deletions(-)
---
diff --git a/gdk/gdkmm/general.cc b/gdk/gdkmm/general.cc
index a2af944..ca4f061 100644
--- a/gdk/gdkmm/general.cc
+++ b/gdk/gdkmm/general.cc
@@ -15,6 +15,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
+#include <gdkmm/cairoutils.h>
 #include <gdkmm/general.h>
 #include <gdk/gdk.h>
 
@@ -63,14 +64,14 @@ bool get_clip_rectangle(const ::Cairo::RefPtr< ::Cairo::Context >& context)
 
 ::Cairo::RefPtr< ::Cairo::Region> create_region_from_surface(const ::Cairo::RefPtr< ::Cairo::Surface>& 
surface)
 {
-  return ::Cairo::make_refptr_for_instance(new 
::Cairo::Region(gdk_cairo_region_create_from_surface(surface->cobj()), true));
+  return Gdk::Cairo::wrap(gdk_cairo_region_create_from_surface(surface->cobj()), true);
 }
 
 ::Cairo::RefPtr< ::Cairo::Surface> create_surface_from_pixbuf(const Glib::RefPtr<const Gdk::Pixbuf>& pixbuf,
   int scale, const Glib::RefPtr<Gdk::Window>& for_window)
 {
-  return ::Cairo::make_refptr_for_instance(new ::Cairo::Surface(gdk_cairo_surface_create_from_pixbuf(
-    pixbuf->gobj(), scale, for_window ? for_window->gobj() : nullptr), true));
+  return Gdk::Cairo::wrap(gdk_cairo_surface_create_from_pixbuf(
+    pixbuf->gobj(), scale, for_window ? for_window->gobj() : nullptr), true);
 }
 
 void draw_from_gl(const ::Cairo::RefPtr< ::Cairo::Context >& context,
diff --git a/gdk/src/cursor.ccg b/gdk/src/cursor.ccg
index 07829cf..3395024 100644
--- a/gdk/src/cursor.ccg
+++ b/gdk/src/cursor.ccg
@@ -17,6 +17,7 @@
  */
 
 #include <gdk/gdk.h>
+#include <gdkmm/cairoutils.h>
 
 using Type = Gdk::Cursor::Type;
 
diff --git a/gdk/src/cursor.hg b/gdk/src/cursor.hg
index bf6f0fc..e16e22c 100644
--- a/gdk/src/cursor.hg
+++ b/gdk/src/cursor.hg
@@ -48,7 +48,6 @@ public:
   _WRAP_METHOD(static Glib::RefPtr<Cursor> create(const Glib::RefPtr<Display>& display, Type cursor_type), 
gdk_cursor_new_for_display)
   _WRAP_METHOD(static Glib::RefPtr<Cursor> create(const Glib::RefPtr<Display>& display, const 
Glib::RefPtr<Pixbuf>& pixbuf, int x, int y), gdk_cursor_new_from_pixbuf)
 
-#m4 _CONVERSION(`const ::Cairo::RefPtr< ::Cairo::Surface>&',`cairo_surface_t*',`($3) ? 
const_cast<cairo_surface_t*>(($3)->cobj()) : nullptr')
   _WRAP_METHOD(static Glib::RefPtr<Cursor> create(const Glib::RefPtr<Display>& display, const 
::Cairo::RefPtr< ::Cairo::Surface>& surface, double x, double y), gdk_cursor_new_from_surface)
 
   _WRAP_METHOD(static Glib::RefPtr<Cursor> create(const Glib::RefPtr<Display>& display, const Glib::ustring& 
name), gdk_cursor_new_from_name)
@@ -60,7 +59,6 @@ public:
   _WRAP_METHOD(Glib::RefPtr<Gdk::Pixbuf> get_image() const, gdk_cursor_get_image)
 
   // gdk_cursor_get_surface() returns a pointer to a newly created cairo_surface_t, or NULL.
-#m4 _CONVERSION(`cairo_surface_t*',`::Cairo::RefPtr< 
::Cairo::Surface>',`::Cairo::make_refptr_for_instance(new ::Cairo::Surface($3, true /* has_reference */))')
   _WRAP_METHOD(::Cairo::RefPtr< ::Cairo::Surface> get_surface(double& x_hot, double& y_hot) const, 
gdk_cursor_get_surface)
 
   _WRAP_METHOD(Type get_cursor_type() const, gdk_cursor_get_cursor_type)
diff --git a/gdk/src/dragcontext.hg b/gdk/src/dragcontext.hg
index e48d8e0..35d2057 100644
--- a/gdk/src/dragcontext.hg
+++ b/gdk/src/dragcontext.hg
@@ -68,7 +68,6 @@ public:
 
   // void set_icon(Gtk::Widget* widget, int hot_x, int hot_y) - see Gtk::Widget::set_as_icon().
 
-  #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_name(const Glib::ustring& name, int hot_x, int hot_y), gtk_drag_set_icon_name)
diff --git a/gdk/src/drawingcontext.ccg b/gdk/src/drawingcontext.ccg
index a7e6c4c..8cb0dc6 100644
--- a/gdk/src/drawingcontext.ccg
+++ b/gdk/src/drawingcontext.ccg
@@ -14,5 +14,6 @@
  * License along with this library. If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include <gdkmm/cairoutils.h>
 #include <gdkmm/drawcontext.h>
 #include <gdkmm/window.h>
diff --git a/gdk/src/drawingcontext.hg b/gdk/src/drawingcontext.hg
index 3fc1b5f..9b5b868 100644
--- a/gdk/src/drawingcontext.hg
+++ b/gdk/src/drawingcontext.hg
@@ -54,17 +54,14 @@ public:
   _WRAP_METHOD(Glib::RefPtr<DrawContext> get_paint_context(), gdk_drawing_context_get_paint_context, 
refreturn,)
   _WRAP_METHOD(Glib::RefPtr<const DrawContext> get_paint_context() const, 
gdk_drawing_context_get_paint_context, refreturn, constversion)
 
-#m4 _CONVERSION(`cairo_region_t*',`::Cairo::RefPtr< ::Cairo::Region>',`::Cairo::make_refptr_for_instance< 
::Cairo::Region>(new ::Cairo::Region($3, true /* do not take ref */))')
   // This is const because it returns a copy.
   _WRAP_METHOD(::Cairo::RefPtr< ::Cairo::Region> get_clip() const, gdk_drawing_context_get_clip)
 
   _WRAP_METHOD(bool is_valid() const, gdk_drawing_context_is_valid)
 
-#m4 _CONVERSION(`cairo_t*',`::Cairo::RefPtr< ::Cairo::Context>',`::Cairo::make_refptr_for_instance< 
::Cairo::Context>(new ::Cairo::Context($3, false /* take reference */))')
-  _WRAP_METHOD(::Cairo::RefPtr< ::Cairo::Context> get_cairo_context(), gdk_drawing_context_get_cairo_context)
-  _WRAP_METHOD(::Cairo::RefPtr<const ::Cairo::Context> get_cairo_context() const, 
gdk_drawing_context_get_cairo_context, constversion)
+  _WRAP_METHOD(::Cairo::RefPtr< ::Cairo::Context> get_cairo_context(), 
gdk_drawing_context_get_cairo_context, refreturn)
+  _WRAP_METHOD(::Cairo::RefPtr<const ::Cairo::Context> get_cairo_context() const, 
gdk_drawing_context_get_cairo_context, refreturn, constversion)
 
-#m4 _CONVERSION(`const ::Cairo::RefPtr< ::Cairo::Context>&',`cairo_t*',`($3)->cobj()')
   _WRAP_METHOD(static Glib::RefPtr<DrawingContext> get_drawing_context_from_cairo_context(const 
::Cairo::RefPtr< ::Cairo::Context>& cr), gdk_cairo_get_drawing_context, refreturn)
 
   _WRAP_PROPERTY("window", Glib::RefPtr<Window>)
diff --git a/gdk/src/glcontext.ccg b/gdk/src/glcontext.ccg
index c3666b1..d420279 100644
--- a/gdk/src/glcontext.ccg
+++ b/gdk/src/glcontext.ccg
@@ -16,6 +16,7 @@
  */
 
 #include <gdk/gdk.h>
+#include <gdkmm/cairoutils.h>
 
 namespace Gdk
 {
diff --git a/gdk/src/glcontext.hg b/gdk/src/glcontext.hg
index 044030e..620213f 100644
--- a/gdk/src/glcontext.hg
+++ b/gdk/src/glcontext.hg
@@ -88,7 +88,6 @@ public:
   _WRAP_METHOD(bool get_use_es() const, gdk_gl_context_get_use_es)
   _WRAP_METHOD(bool realize(), gdk_gl_context_realize, errthrow, newin "3,18")
 
-#m4 _CONVERSION(`cairo_region_t*',`::Cairo::RefPtr< ::Cairo::Region>',`::Cairo::make_refptr_for_instance< 
::Cairo::Region>(new ::Cairo::Region($3, true /* do not take ref */))')
   // This is const because it returns a newly created Cairo::Region (though that is not very clear from the 
C documentation)
   _WRAP_METHOD(::Cairo::RefPtr< ::Cairo::Region> get_damage() const, gdk_gl_context_get_damage)
   _WRAP_METHOD(void make_current(), gdk_gl_context_make_current, newin "3,18")
diff --git a/gdk/src/window.hg b/gdk/src/window.hg
index bba7176..f8f8f1a 100644
--- a/gdk/src/window.hg
+++ b/gdk/src/window.hg
@@ -223,7 +223,6 @@ public:
   _WRAP_METHOD(bool get_decorations(WMDecoration& decorations) const, gdk_window_get_decorations)
   _WRAP_METHOD(void set_functions(WMFunction functions), gdk_window_set_functions)
 
-  #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::Content',`cairo_content_t',`(cairo_content_t)($3)')
   _WRAP_METHOD(::Cairo::RefPtr< ::Cairo::Surface> create_similar_surface(::Cairo::Content content, int 
width,  int height), gdk_window_create_similar_surface )
 
@@ -290,8 +289,6 @@ public:
                                                 gpointer   user_data);
        */
 
-#m4 _CONVERSION(`cairo_region_t*',`::Cairo::RefPtr< ::Cairo::Region>',`::Cairo::make_refptr_for_instance< 
::Cairo::Region>(new ::Cairo::Region(($3), true /* do not take ref */))')
-
   //This method should not have a const version - see the docs
   _WRAP_METHOD(::Cairo::RefPtr< ::Cairo::Region> get_update_area(), gdk_window_get_update_area)
 
@@ -325,8 +322,6 @@ public:
   _WRAP_METHOD(void set_support_multidevice(bool support_multidevice = true), 
gdk_window_set_support_multidevice)
   _WRAP_METHOD(bool get_support_multidevice(), gdk_window_get_support_multidevice)
 
-#m4 _CONVERSION(`cairo_region_t*',`::Cairo::RefPtr< ::Cairo::Region>',`::Cairo::make_refptr_for_instance< 
::Cairo::Region>(new ::Cairo::Region($3, true /* do not take ref */))')
-
   //This is const because it returns a copy (though that is not very clear from the C documentation)
   _WRAP_METHOD(::Cairo::RefPtr< ::Cairo::Region> get_clip_region() const, gdk_window_get_clip_region)
 
diff --git a/gtk/src/drawingarea.ccg b/gtk/src/drawingarea.ccg
index 2d7c011..88dc276 100644
--- a/gtk/src/drawingarea.ccg
+++ b/gtk/src/drawingarea.ccg
@@ -17,6 +17,7 @@
  */
 
 #include <gtk/gtk.h>
+#include <gdkmm/cairoutils.h>
 
 namespace
 {
@@ -25,7 +26,7 @@ void SignalProxy_Draw_gtk_callback(GtkDrawingArea* /* drawing_area */, cairo_t*
   int width, int height, void* user_data)
 {
   auto the_slot = static_cast<Gtk::DrawingArea::SlotDraw*>(user_data);
-  auto cr2 = ::Cairo::make_refptr_for_instance< ::Cairo::Context>(new ::Cairo::Context(cr, false /* 
has_reference */));
+  auto cr2 = Gdk::Cairo::wrap(cr, false /* has_reference */);
 
   try
   {
diff --git a/gtk/src/drawingarea.hg b/gtk/src/drawingarea.hg
index 4d89620..753e013 100644
--- a/gtk/src/drawingarea.hg
+++ b/gtk/src/drawingarea.hg
@@ -125,7 +125,7 @@ public:
  *
  * @newin{3,90}
  */
-  using SlotDraw = sigc::slot<void(const ::Cairo::RefPtr< ::Cairo::Context>&, int, int)>;
+  using SlotDraw = sigc::slot<void(const Cairo::RefPtr<Cairo::Context>&, int, int)>;
 
   _WRAP_METHOD(void set_content_width(int width), gtk_drawing_area_set_content_width)
   _WRAP_METHOD(int get_content_width() const, gtk_drawing_area_get_content_width)
diff --git a/gtk/src/entry.ccg b/gtk/src/entry.ccg
index 62dd47c..fb6f642 100644
--- a/gtk/src/entry.ccg
+++ b/gtk/src/entry.ccg
@@ -24,7 +24,7 @@ using IconPosition = Gtk::Entry::IconPosition;
 namespace Gtk
 {
 
-void Entry::set_icon_from_surface(const ::Cairo::RefPtr< ::Cairo::Surface>& surface, IconPosition icon_pos)
+void Entry::set_icon_from_surface(const Cairo::RefPtr<Cairo::Surface>& surface, IconPosition icon_pos)
 {
   gtk_entry_set_icon_from_surface(gobj(), static_cast<GtkEntryIconPosition>(icon_pos), surface ? 
surface->cobj() : nullptr);
 }
diff --git a/gtk/src/printcontext.ccg b/gtk/src/printcontext.ccg
index 223665e..fd5b5c0 100644
--- a/gtk/src/printcontext.ccg
+++ b/gtk/src/printcontext.ccg
@@ -16,6 +16,7 @@
  */
 
 #include <gtk/gtk.h>
+#include <gdkmm/cairoutils.h>
 
 namespace Gtk
 {
diff --git a/gtk/src/printcontext.hg b/gtk/src/printcontext.hg
index d97c8c3..a3bebe2 100644
--- a/gtk/src/printcontext.hg
+++ b/gtk/src/printcontext.hg
@@ -50,10 +50,8 @@ class PrintContext : public Glib::Object
 
 public:
 
-  #m4 _CONVERSION(`cairo_t*',`::Cairo::RefPtr< ::Cairo::Context>',`::Cairo::make_refptr_for_instance< 
::Cairo::Context>(new ::Cairo::Context($3, false /* take ref */))')
-  #m4 _CONVERSION(`cairo_t*',`::Cairo::RefPtr<const ::Cairo::Context>',`::Cairo::make_refptr_for_instance< 
::Cairo::Context>(new ::Cairo::Context($3, false /* take ref */))')
-  _WRAP_METHOD(::Cairo::RefPtr< ::Cairo::Context> get_cairo_context(), gtk_print_context_get_cairo_context)
-  _WRAP_METHOD(::Cairo::RefPtr<const ::Cairo::Context> get_cairo_context() const, 
gtk_print_context_get_cairo_context, constversion)
+  _WRAP_METHOD(Cairo::RefPtr<Cairo::Context> get_cairo_context(), gtk_print_context_get_cairo_context, 
refreturn)
+  _WRAP_METHOD(Cairo::RefPtr<const Cairo::Context> get_cairo_context() const, 
gtk_print_context_get_cairo_context, refreturn, constversion)
 
   _WRAP_METHOD(Glib::RefPtr<PageSetup> get_page_setup(), gtk_print_context_get_page_setup, refreturn)
   _WRAP_METHOD(Glib::RefPtr<const PageSetup> get_page_setup() const, gtk_print_context_get_page_setup, 
refreturn, constversion)
@@ -72,7 +70,7 @@ public:
   _WRAP_METHOD(Glib::RefPtr<Pango::Context> create_pango_context(), gtk_print_context_create_pango_context, 
refreturn)
   _WRAP_METHOD(Glib::RefPtr<Pango::Layout> create_pango_layout(), gtk_print_context_create_pango_layout, 
refreturn)
 
-  _WRAP_METHOD(void set_cairo_context(const ::Cairo::RefPtr< ::Cairo::Context>& cr, double dpi_x, double 
dpi_y), gtk_print_context_set_cairo_context)
+  _WRAP_METHOD(void set_cairo_context(const Cairo::RefPtr<Cairo::Context>& cr, double dpi_x, double dpi_y), 
gtk_print_context_set_cairo_context)
 
 };
 
diff --git a/gtk/src/snapshot.ccg b/gtk/src/snapshot.ccg
index 5287886..5f9552b 100644
--- a/gtk/src/snapshot.ccg
+++ b/gtk/src/snapshot.ccg
@@ -15,6 +15,7 @@
  */
 
 #include <gtk/gtk.h>
+#include <gdkmm/cairoutils.h>
 
 /* Why reinterpret_cast<Snapshot*>(gobject) is needed:
  *
@@ -49,7 +50,7 @@ void Snapshot::push_cross_fade(double progress, const Glib::ustring& name)
     gtk_snapshot_push_cross_fade(gobj(), progress, "%s", name.c_str());
 }
 
-::Cairo::RefPtr< ::Cairo::Context> Snapshot::append_cairo(
+Cairo::RefPtr<Cairo::Context> Snapshot::append_cairo(
   const graphene_rect_t* bounds, const Glib::ustring& name)
 {
   cairo_t* cr = nullptr;
@@ -58,11 +59,10 @@ void Snapshot::push_cross_fade(double progress, const Glib::ustring& name)
   else
     cr = gtk_snapshot_append_cairo(gobj(), bounds, "%s", name.c_str());
 
-  return ::Cairo::make_refptr_for_instance< ::Cairo::Context>(
-    new ::Cairo::Context(cr, true /* has_reference */));
+  return Gdk::Cairo::wrap(cr, true /* has_reference */);
 }
 
-::Cairo::RefPtr< ::Cairo::Context> Snapshot::append_cairo(
+Cairo::RefPtr<Cairo::Context> Snapshot::append_cairo(
   const Gdk::Rectangle& bounds, const Glib::ustring& name)
 {
   graphene_rect_t rect;
diff --git a/gtk/src/snapshot.hg b/gtk/src/snapshot.hg
index 7b20d0e..0ea6ef1 100644
--- a/gtk/src/snapshot.hg
+++ b/gtk/src/snapshot.hg
@@ -106,7 +106,7 @@ public:
    * @return A Cairo::Context suitable for drawing the contents of the newly
    * created render node.
    */
-  ::Cairo::RefPtr< ::Cairo::Context> append_cairo(const graphene_rect_t* bounds,
+  Cairo::RefPtr<Cairo::Context> append_cairo(const graphene_rect_t* bounds,
     const Glib::ustring& name);
 
   /** Creates a new render node and appends it to the current render
@@ -119,7 +119,7 @@ public:
    * @return A Cairo::Context suitable for drawing the contents of the newly
    * created render node.
    */
-  ::Cairo::RefPtr< ::Cairo::Context> append_cairo(const Gdk::Rectangle& bounds,
+  Cairo::RefPtr<Cairo::Context> append_cairo(const Gdk::Rectangle& bounds,
     const Glib::ustring& name);
   _IGNORE(gtk_snapshot_append_cairo)
   //TODO: Wrap gtk_snapshot_append_texture()?
diff --git a/gtk/src/stylecontext.hg b/gtk/src/stylecontext.hg
index 328e533..8cf3b56 100644
--- a/gtk/src/stylecontext.hg
+++ b/gtk/src/stylecontext.hg
@@ -187,22 +187,21 @@ public:
 
   //TODO: _WRAP_METHOD(void reset_widgets(const Glib::RefPtr<Gdk::Screen>& screen), 
gtk_style_context_reset_widgets)
 
-  _WRAP_METHOD(void render_check(const ::Cairo::RefPtr< ::Cairo::Context>& cr, double x, double y, double 
width, double height), gtk_render_check)
-  _WRAP_METHOD(void render_option(const ::Cairo::RefPtr< ::Cairo::Context>& cr, double x, double y, double 
width, double height), gtk_render_option)
-  _WRAP_METHOD(void render_arrow(const ::Cairo::RefPtr< ::Cairo::Context>& cr, double angle, double x, 
double y, double size), gtk_render_arrow)
-  _WRAP_METHOD(void render_background(const ::Cairo::RefPtr< ::Cairo::Context>& cr, double x,  double y, 
double width, double height), gtk_render_background)
-  _WRAP_METHOD(void render_frame(const ::Cairo::RefPtr< ::Cairo::Context>& cr, double x,  double y, double 
width, double height), gtk_render_frame)
-  _WRAP_METHOD(void render_expander(const ::Cairo::RefPtr< ::Cairo::Context>& cr, double x, double y, double 
width, double height), gtk_render_expander)
-  _WRAP_METHOD(void render_focus(const ::Cairo::RefPtr< ::Cairo::Context>& cr, double x, double y, double 
width, double height), gtk_render_focus)
-  _WRAP_METHOD(void render_layout(const ::Cairo::RefPtr< ::Cairo::Context>& cr, double x, double y, const 
Glib::RefPtr<Pango::Layout>& layout), gtk_render_layout)
-  _WRAP_METHOD(void render_line(const ::Cairo::RefPtr< ::Cairo::Context>& cr, double x0, double y0,  double 
x1, double y1), gtk_render_line)
-  _WRAP_METHOD(void render_slider(const ::Cairo::RefPtr< ::Cairo::Context>& cr, double x, double y, double 
width, double height,  Orientation orientation), gtk_render_slider)
-  _WRAP_METHOD(void render_frame_gap(const ::Cairo::RefPtr< ::Cairo::Context>& cr, double x, double y, 
double width, double height,  PositionType  gap_side, double xy0_gap, double xy1_gap), gtk_render_frame_gap)
-  _WRAP_METHOD(void render_handle(const ::Cairo::RefPtr< ::Cairo::Context>& cr, double x, double y, double 
width, double height), gtk_render_handle)
-  _WRAP_METHOD(void render_activity(const ::Cairo::RefPtr< ::Cairo::Context>& cr,  double x,  double y, 
double width, double height), gtk_render_activity)
-  _WRAP_METHOD(void render_icon(const ::Cairo::RefPtr< ::Cairo::Context>& cr, const 
Glib::RefPtr<Gdk::Pixbuf>& pixbuf, double x, double y), gtk_render_icon)
-  _WRAP_METHOD(void render_insertion_cursor(const ::Cairo::RefPtr< ::Cairo::Context>& cr, double x, double 
y, const Glib::RefPtr<Pango::Layout>& layout, int index, Pango::Direction direction), 
gtk_render_insertion_cursor)
-
+  _WRAP_METHOD(void render_check(const Cairo::RefPtr<Cairo::Context>& cr, double x, double y, double width, 
double height), gtk_render_check)
+  _WRAP_METHOD(void render_option(const Cairo::RefPtr<Cairo::Context>& cr, double x, double y, double width, 
double height), gtk_render_option)
+  _WRAP_METHOD(void render_arrow(const Cairo::RefPtr<Cairo::Context>& cr, double angle, double x, double y, 
double size), gtk_render_arrow)
+  _WRAP_METHOD(void render_background(const Cairo::RefPtr<Cairo::Context>& cr, double x,  double y, double 
width, double height), gtk_render_background)
+  _WRAP_METHOD(void render_frame(const Cairo::RefPtr<Cairo::Context>& cr, double x,  double y, double width, 
double height), gtk_render_frame)
+  _WRAP_METHOD(void render_expander(const Cairo::RefPtr<Cairo::Context>& cr, double x, double y, double 
width, double height), gtk_render_expander)
+  _WRAP_METHOD(void render_focus(const Cairo::RefPtr<Cairo::Context>& cr, double x, double y, double width, 
double height), gtk_render_focus)
+  _WRAP_METHOD(void render_layout(const Cairo::RefPtr<Cairo::Context>& cr, double x, double y, const 
Glib::RefPtr<Pango::Layout>& layout), gtk_render_layout)
+  _WRAP_METHOD(void render_line(const Cairo::RefPtr<Cairo::Context>& cr, double x0, double y0,  double x1, 
double y1), gtk_render_line)
+  _WRAP_METHOD(void render_slider(const Cairo::RefPtr<Cairo::Context>& cr, double x, double y, double width, 
double height,  Orientation orientation), gtk_render_slider)
+  _WRAP_METHOD(void render_frame_gap(const Cairo::RefPtr<Cairo::Context>& cr, double x, double y, double 
width, double height,  PositionType  gap_side, double xy0_gap, double xy1_gap), gtk_render_frame_gap)
+  _WRAP_METHOD(void render_handle(const Cairo::RefPtr<Cairo::Context>& cr, double x, double y, double width, 
double height), gtk_render_handle)
+  _WRAP_METHOD(void render_activity(const Cairo::RefPtr<Cairo::Context>& cr,  double x,  double y, double 
width, double height), gtk_render_activity)
+  _WRAP_METHOD(void render_icon(const Cairo::RefPtr<Cairo::Context>& cr, const Glib::RefPtr<Gdk::Pixbuf>& 
pixbuf, double x, double y), gtk_render_icon)
+  _WRAP_METHOD(void render_insertion_cursor(const Cairo::RefPtr<Cairo::Context>& cr, double x, double y, 
const Glib::RefPtr<Pango::Layout>& layout, int index, Pango::Direction direction), 
gtk_render_insertion_cursor)
 
   _WRAP_SIGNAL(void changed(), "changed")
 
diff --git a/gtk/src/widget.hg b/gtk/src/widget.hg
index 20b92bb..26b4486 100644
--- a/gtk/src/widget.hg
+++ b/gtk/src/widget.hg
@@ -119,7 +119,7 @@ public:
 
   _WRAP_METHOD(void queue_draw(), gtk_widget_queue_draw)
   _WRAP_METHOD(void queue_draw_area(int x, int y, int width, int height), gtk_widget_queue_draw_area)
-  _WRAP_METHOD(void queue_draw_region(const ::Cairo::RefPtr<const ::Cairo::Region>& region), 
gtk_widget_queue_draw_region)
+  _WRAP_METHOD(void queue_draw_region(const Cairo::RefPtr<const Cairo::Region>& region), 
gtk_widget_queue_draw_region)
   _WRAP_METHOD(void queue_resize(), gtk_widget_queue_resize)
   _WRAP_METHOD(void queue_allocate(), gtk_widget_queue_allocate)
 
@@ -355,15 +355,15 @@ public:
   _WRAP_METHOD(Glib::RefPtr<Pango::Context> create_pango_context(), gtk_widget_create_pango_context)
   _WRAP_METHOD(Glib::RefPtr<Pango::Context> get_pango_context(), gtk_widget_get_pango_context, refreturn)
 
-  _WRAP_METHOD(void set_font_options(const ::Cairo::FontOptions& options), gtk_widget_set_font_options)
+  _WRAP_METHOD(void set_font_options(const Cairo::FontOptions& options), gtk_widget_set_font_options)
   /** Undoes the effect of previous calls to set_font_options().
    *
    * @newin{3,20}
    */
   void unset_font_options();
   // This returns a const, so we assume that we must copy it:
-  #m4 _CONVERSION(`const cairo_font_options_t*', `::Cairo::FontOptions', 
`::Cairo::FontOptions(const_cast<cairo_font_options_t*>($3), false /* take_ownership */)')
-  _WRAP_METHOD(::Cairo::FontOptions get_font_options() const, gtk_widget_get_font_options)
+  #m4 _CONVERSION(`const cairo_font_options_t*', `Cairo::FontOptions', 
`Cairo::FontOptions(const_cast<cairo_font_options_t*>($3), false /* take_ownership */)')
+  _WRAP_METHOD(Cairo::FontOptions get_font_options() const, gtk_widget_get_font_options)
 
   _WRAP_METHOD(Glib::RefPtr<Pango::Layout> create_pango_layout(const Glib::ustring& text), 
gtk_widget_create_pango_layout)
 
@@ -375,8 +375,8 @@ public:
   _WRAP_METHOD(static void set_default_direction(TextDirection dir), gtk_widget_set_default_direction)
   _WRAP_METHOD(static TextDirection get_default_direction(), gtk_widget_get_default_direction)
 
-  _WRAP_METHOD(void shape_combine_region(const ::Cairo::RefPtr<const ::Cairo::Region>& region), 
gtk_widget_shape_combine_region)
-  _WRAP_METHOD(void input_shape_combine_region(const ::Cairo::RefPtr<const ::Cairo::Region>& region), 
gtk_widget_input_shape_combine_region)
+  _WRAP_METHOD(void shape_combine_region(const Cairo::RefPtr<const Cairo::Region>& region), 
gtk_widget_shape_combine_region)
+  _WRAP_METHOD(void input_shape_combine_region(const Cairo::RefPtr<const Cairo::Region>& region), 
gtk_widget_input_shape_combine_region)
 
   _WRAP_METHOD(WidgetPath get_path() const, gtk_widget_get_path)
 
@@ -602,8 +602,7 @@ dnl
   // Custom widgets that need the draw signal must use a custom rendering widget
   // that wraps the draw signal.
   // https://bugzilla.gnome.org/show_bug.cgi?id=774778
-//#m4 _CONVERSION(`cairo_t*',`const ::Cairo::RefPtr< ::Cairo::Context>&',`::Cairo::make_refptr_for_instance< 
::Cairo::Context>(new ::Cairo::Context($3, false /* has_reference */))')
-  //_WRAP_SIGNAL(bool draw(const ::Cairo::RefPtr< ::Cairo::Context>& cr), "draw")
+  //_WRAP_SIGNAL(bool draw(const Cairo::RefPtr<Cairo::Context>& cr), "draw")
   _IGNORE_SIGNAL(draw)
 
 #m4 _CONVERSION(`GdkEventKey*',`Gdk::EventKey&',`Gdk::wrap_event($3)')
@@ -751,8 +750,7 @@ protected:
   _WRAP_METHOD(void realize(), gtk_widget_realize)
   _WRAP_METHOD(void unrealize(), gtk_widget_unrealize)
 
-#m4 _CONVERSION(`const ::Cairo::RefPtr< ::Cairo::Context>&',`cairo_t*',`($3)->cobj()')
-  _WRAP_METHOD(void draw(const ::Cairo::RefPtr< ::Cairo::Context>& cr), gtk_widget_draw)
+  _WRAP_METHOD(void draw(const Cairo::RefPtr<Cairo::Context>& cr), gtk_widget_draw)
 
   _WRAP_METHOD(void set_realized(bool realized = true), gtk_widget_set_realized)
 
diff --git a/tools/m4/convert_gdk.m4 b/tools/m4/convert_gdk.m4
index 8fd6264..a354bc2 100644
--- a/tools/m4/convert_gdk.m4
+++ b/tools/m4/convert_gdk.m4
@@ -102,9 +102,16 @@ _CONVERSION(`Rectangle&',`GdkRectangle*',($3).gobj())
 _CONVERSION(`Gdk::Rectangle&',`GdkRectangle*',($3).gobj())
 _CONVERSION(`const Rectangle&',`const GdkRectangle*',($3).gobj())
 _CONVERSION(`const Gdk::Rectangle&',`const GdkRectangle*',($3).gobj())
+
+_CONVERSION(`const ::Cairo::RefPtr< ::Cairo::Context>&',`cairo_t*',`(($3) ? ($3)->cobj() : nullptr)')
+_CONVERSION(`cairo_t*',`::Cairo::RefPtr< ::Cairo::Context>',`Gdk::Cairo::wrap($3)')
+_CONVERSION(`cairo_t*',`::Cairo::RefPtr<const ::Cairo::Context>',`Gdk::Cairo::wrap($3)')
 _CONVERSION(`const ::Cairo::RefPtr< ::Cairo::Region>&',`const cairo_region_t*',`(($3) ? ($3)->cobj() : 
nullptr)')
 _CONVERSION(`const ::Cairo::RefPtr<const 
::Cairo::Region>&',`cairo_region_t*',`const_cast<cairo_region_t*>(($3) ? ($3)->cobj() : nullptr)')
 _CONVERSION(`const ::Cairo::RefPtr<const ::Cairo::Region>&',`const cairo_region_t*',`(($3) ? ($3)->cobj() : 
nullptr)')
+_CONVERSION(`cairo_region_t*',`::Cairo::RefPtr< ::Cairo::Region>',`Gdk::Cairo::wrap($3)')
+_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(`const Glib::RefPtr<Cursor>&',`GdkCursor*',__CONVERT_REFPTR_TO_P)
 _CONVERSION(`const Glib::RefPtr<const Cursor>&',`GdkCursor*',__CONVERT_CONST_REFPTR_TO_P)
diff --git a/tools/m4/convert_gtk.m4 b/tools/m4/convert_gtk.m4
index 84ce8a0..ebb7e68 100644
--- a/tools/m4/convert_gtk.m4
+++ b/tools/m4/convert_gtk.m4
@@ -506,10 +506,13 @@ _CONVERSION(`const Glib::RefPtr<PrintContext>&',`GtkPrintContext*',__CONVERT_REF
 _CONVERSION(`GtkPrintOperationResult',`PrintOperationResult',`static_cast<$2>($3)')
 _CONVERSION(`GtkPrintStatus',`PrintStatus',`static_cast<$2>($3)')
 
-_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::Context>&',`cairo_t*',`(($3) ? ($3)->cobj() : nullptr)')
+_CONVERSION(`const Cairo::RefPtr<const Cairo::Context>&',`cairo_t*',`const_cast<cairo_t*>(($3) ? 
($3)->cobj() : nullptr)')
+_CONVERSION(`cairo_t*',`Cairo::RefPtr<Cairo::Context>',`Gdk::Cairo::wrap($3)')
+_CONVERSION(`cairo_t*',`Cairo::RefPtr<const Cairo::Context>',`Gdk::Cairo::wrap($3)')
+_CONVERSION(`const Cairo::FontOptions&',`const cairo_font_options_t*',`($3).cobj()')
+_CONVERSION(`const Cairo::RefPtr<const Cairo::Region>&',`cairo_region_t*',`const_cast<cairo_region_t*>(($3) 
? ($3)->cobj() : nullptr)')
+_CONVERSION(`const Cairo::RefPtr<const Cairo::Region>&',`const cairo_region_t*',`(($3) ? ($3)->cobj() : 
nullptr)')
 _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)')


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