[gtkmm/wip/dboles/Gdk_ImageSurface: 2/2] Cursor: Add replacements with correct ImageSurface



commit 354712f442ceaed817e91793f4dc1944134bf286
Author: Daniel Boles <dboles src gmail com>
Date:   Sat Jun 15 22:30:38 2019 +0100

    Cursor: Add replacements with correct ImageSurface
    
    create() and get_surface() should've taken and returned
    RefPtr<ImageSurface>, but they used RefPtr<Surface> instead.
    
    Deprecate the old versions, and add new ones that replace them, by
    overloading create() and renaming get_surface() to get_image_surface().
    
    https://gitlab.gnome.org/GNOME/gtkmm/issues/30

 gdk/src/cursor.hg | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)
---
diff --git a/gdk/src/cursor.hg b/gdk/src/cursor.hg
index ab6ab4cd..282c8d15 100644
--- a/gdk/src/cursor.hg
+++ b/gdk/src/cursor.hg
@@ -53,7 +53,12 @@ public:
   _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 
::Cairo::RefPtr< ::Cairo::Surface>& surface, double x, double y), gdk_cursor_new_from_surface,
+               deprecated "Use the version that takes the correct derived type, Cairo::ImageSurface.")
+
+#m4 _CONVERSION(`const ::Cairo::RefPtr< ::Cairo::ImageSurface>&',`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::ImageSurface>& image_surface, double x, double y), gdk_cursor_new_from_surface,
+               newin "3.26")
 
   _WRAP_METHOD(static Glib::RefPtr<Cursor> create(const Glib::RefPtr<Display>& display, const Glib::ustring& 
name), gdk_cursor_new_from_name)
 
@@ -66,8 +71,17 @@ public:
   //TODO: Should this always be const?
 #m4 _CONVERSION(`cairo_surface_t*',`::Cairo::RefPtr< ::Cairo::Surface>',`::Cairo::RefPtr< 
::Cairo::Surface>(new ::Cairo::Surface($3, true /* take reference */))')
 #m4 _CONVERSION(`cairo_surface_t*',`::Cairo::RefPtr<const ::Cairo::Surface>',`::Cairo::RefPtr< 
::Cairo::Surface>(new ::Cairo::Surface($3, true /* take reference */))')
-  _WRAP_METHOD(::Cairo::RefPtr< ::Cairo::Surface> get_surface(double& x_hot, double& y_hot), 
gdk_cursor_get_surface)
-  _WRAP_METHOD(::Cairo::RefPtr<const ::Cairo::Surface> get_surface(double& x_hot, double& y_hot) const, 
gdk_cursor_get_surface, constversion)
+  _WRAP_METHOD(::Cairo::RefPtr< ::Cairo::Surface> get_surface(double& x_hot, double& y_hot), 
gdk_cursor_get_surface,
+               deprecated "Use get_image_surface(), which returns the correct derived type.")
+  _WRAP_METHOD(::Cairo::RefPtr<const ::Cairo::Surface> get_surface(double& x_hot, double& y_hot) const, 
gdk_cursor_get_surface, constversion,
+               deprecated "Use get_image_surface(), which returns the correct derived type.")
+
+#m4 _CONVERSION(`cairo_surface_t*',`::Cairo::RefPtr< ::Cairo::ImageSurface>',`::Cairo::RefPtr< 
::Cairo::ImageSurface>(new ::Cairo::ImageSurface($3, true /* take reference */))')
+#m4 _CONVERSION(`cairo_surface_t*',`::Cairo::RefPtr<const ::Cairo::ImageSurface>',`::Cairo::RefPtr< 
::Cairo::ImageSurface>(new ::Cairo::ImageSurface($3, true /* take reference */))')
+  _WRAP_METHOD(::Cairo::RefPtr< ::Cairo::ImageSurface> get_image_surface(double& x_hot, double& y_hot), 
gdk_cursor_get_surface,
+               newin "3.26")
+  _WRAP_METHOD(::Cairo::RefPtr<const ::Cairo::ImageSurface> get_image_surface(double& x_hot, double& y_hot) 
const, gdk_cursor_get_surface, constversion,
+               newin "3.26")
 
   _WRAP_METHOD(CursorType get_cursor_type() const, gdk_cursor_get_cursor_type)
 };


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