GNOME Bugzilla – Bug 667959
Gdk.cairo_region_create_from_surface() raises TypeError: Couldn't find conversion for foreign struct 'cairo.Region'
Last modified: 2017-03-20 16:06:53 UTC
Calling the cairo_region_create_from_surface of Gdk raises the TypeError. I cannot set a shape of Gdk.Window with Gdk.Window.shape_combine_region() because of this error. >>> from gi.repository import Gdk >>> import cairo >>> surface = cairo.ImageSurface(0, 100, 100) >>> Gdk.cairo_region_create_from_surface(surface) Traceback (most recent call last):
+ Trace 229452
return info.invoke(*args, **kwargs)
Confirmed with 3.2.0.
Created attachment 216290 [details] [review] add a foreign type for cairo_region_t
Thanks! This is blocked by https://bugs.freedesktop.org/show_bug.cgi?id=44336 .
the pycairo patch was committed upstream. http://cgit.freedesktop.org/pycairo/commit/?id=75e82a1b3f495a3abbc78e50a5c66356d320fb15
Thanks Jose! Now we need a pycairo release, so that we can build this.
Just wanted to asked, what's still needed before we can have a new release. I'd love to contribute, if there's something left to do :)
Created attachment 235683 [details] [review] add a foreign type for cairo_region_t That's the patch as I applied it to the Ubuntu package. It needs to conditionalize the new support for builds with py3cairo (fails with Python 2), and was missing some "static"s. Thanks!
*** Bug 666862 has been marked as a duplicate of this bug. ***
(In reply to comment #5) The problem here seems to be more on the 3rd party project on which pygobject depends. There was no pycairo release in last two years.(Looks like pycairo is dead.)
Created attachment 329180 [details] [review] Add a foreign type for cairo_region_t Based on the patch at https://bugzilla.gnome.org/show_bug.cgi?id=667959#c7 * Rebased on master * Fixes the cairo_region_from_arg signature * Add some tests
Note that the patch currently applied in Ubuntu makes cairo_region_create_from_surface segfault as it wasn't updated to the new interface... so this really should be applied upstream.
Review of attachment 329180 [details] [review]: LGTM. Although consider using Martin as the author and yourself as Co-Authored-By, or vise versa.
(In reply to Simon Feltman from comment #12) > Review of attachment 329180 [details] [review] [review]: > > LGTM. Although consider using Martin as the author and yourself as > Co-Authored-By, or vise versa. Actually it looks like the original author is: Shyouzou Sugitani <shy@users.sourceforge.jp> ?
Thanks. I just noticed that pycairo region support was never released, only committed upstream :( https://cgit.freedesktop.org/pycairo/log/ I guess we should check for the symbol?
Created attachment 331831 [details] [review] Add a foreign type for cairo_region_t. Adjust git authors as suggested. Add check for PycairoRegion_Type which was defined in the region commit upstream (https://cgit.freedesktop.org/pycairo/commit/?id=75e82a1b3f495a3abbc78e50a5c66356d320fb15) Sorry for not noticing this first; debian includes the above patch by default which made me assume that it was released.