[gtkmm/wip/dboles/Gdk_ImageSurface: 1/2] GdkWindow: Fix create_similar_image_surface return



commit cabdd19ebfcf996b87f642d3d0a62d778bd27403
Author: Daniel Boles <dboles src gmail com>
Date:   Sat Jun 22 12:56:56 2019 +0100

    GdkWindow: Fix create_similar_image_surface return
    
    This should return a Cairo::ImageSurface, but it returned just a Surface
    
    We can't change the return type of the existing function in 3 because
    that would break ABI, but we can add a new function suffixed _derived
    that returns the correct RefPtr type and deprecate the older symbol.
    
    https://gitlab.gnome.org/GNOME/gtkmm/issues/30
    https://gitlab.gnome.org/GNOME/gtkmm/merge_requests/19

 gdk/src/window.hg | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
---
diff --git a/gdk/src/window.hg b/gdk/src/window.hg
index 2162d805..60ea799a 100644
--- a/gdk/src/window.hg
+++ b/gdk/src/window.hg
@@ -258,7 +258,13 @@ public:
   _WRAP_METHOD(::Cairo::RefPtr< ::Cairo::Surface> create_similar_surface(::Cairo::Content content, int 
width,  int height), gdk_window_create_similar_surface )
 
   #m4 _CONVERSION(`::Cairo::Format',`cairo_format_t',`(cairo_format_t)($3)')
-    _WRAP_METHOD(::Cairo::RefPtr< ::Cairo::Surface> create_similar_image_surface(::Cairo::Format format, int 
width, int height, int scale), gdk_window_create_similar_image_surface )
+
+  _WRAP_METHOD(::Cairo::RefPtr< ::Cairo::Surface> create_similar_image_surface(::Cairo::Format format, int 
width, int height, int scale), gdk_window_create_similar_image_surface,
+               deprecated "Use create_similar_image_surface_derived(), which returns the correct derived 
type.")
+
+  #m4 _CONVERSION(`cairo_surface_t*',`::Cairo::RefPtr< ::Cairo::ImageSurface>',`::Cairo::RefPtr< 
::Cairo::ImageSurface>(new ::Cairo::ImageSurface($3, true /* do not take ref */))')
+  _WRAP_METHOD(::Cairo::RefPtr< ::Cairo::ImageSurface> create_similar_image_surface_derived(::Cairo::Format 
format, int width, int height, int scale), gdk_window_create_similar_image_surface,
+               newin "3,26")
 
   _WRAP_METHOD(void beep(), gdk_window_beep)
 


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