After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 667959 - Gdk.cairo_region_create_from_surface() raises TypeError: Couldn't find conversion for foreign struct 'cairo.Region'
Gdk.cairo_region_create_from_surface() raises TypeError: Couldn't find conver...
Status: RESOLVED FIXED
Product: pygobject
Classification: Bindings
Component: introspection
3.2.x
Other Linux
: Low normal
: ---
Assigned To: Nobody's working on this now (help wanted and appreciated)
Python bindings maintainers
blocked by https://bugs.freedesktop.o...
: 666862 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2012-01-15 14:18 UTC by shy
Modified: 2017-03-20 16:06 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
add a foreign type for cairo_region_t (2.24 KB, patch)
2012-06-13 14:52 UTC, shy
reviewed Details | Review
add a foreign type for cairo_region_t (2.46 KB, patch)
2013-02-11 08:27 UTC, Martin Pitt
none Details | Review
Add a foreign type for cairo_region_t (4.30 KB, patch)
2016-06-06 10:32 UTC, Christoph Reiter (lazka)
none Details | Review
Add a foreign type for cairo_region_t. (4.54 KB, patch)
2016-07-20 15:32 UTC, Christoph Reiter (lazka)
committed Details | Review

Description shy 2012-01-15 14:18:12 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):
  • File "<stdin>", line 1 in <module>
  • File "/usr/lib/python2.7/dist-packages/gi/types.py", line 43 in function
    return info.invoke(*args, **kwargs)
TypeError: Couldn't find conversion for foreign struct 'cairo.Region'

Comment 1 Martin Pitt 2012-04-22 14:25:39 UTC
Confirmed with 3.2.0.
Comment 2 shy 2012-06-13 14:52:54 UTC
Created attachment 216290 [details] [review]
add a foreign type for cairo_region_t
Comment 3 Martin Pitt 2012-06-25 13:11:49 UTC
Thanks! This is blocked by https://bugs.freedesktop.org/show_bug.cgi?id=44336 .
Comment 4 Jose Rostagno 2012-08-19 19:54:11 UTC
the pycairo patch was committed upstream.
http://cgit.freedesktop.org/pycairo/commit/?id=75e82a1b3f495a3abbc78e50a5c66356d320fb15
Comment 5 Martin Pitt 2012-08-20 13:08:33 UTC
Thanks Jose! Now we need a pycairo release, so that we can build this.
Comment 6 tuxor 2012-12-25 07:46:34 UTC
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 :)
Comment 7 Martin Pitt 2013-02-11 08:27:19 UTC
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!
Comment 8 Martin Pitt 2013-02-27 15:01:02 UTC
*** Bug 666862 has been marked as a duplicate of this bug. ***
Comment 9 shy 2013-06-17 14:19:31 UTC
(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.)
Comment 10 Christoph Reiter (lazka) 2016-06-06 10:32:01 UTC
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
Comment 11 Christoph Reiter (lazka) 2016-06-06 10:38:11 UTC
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.
Comment 12 Simon Feltman 2016-07-20 14:04:46 UTC
Review of attachment 329180 [details] [review]:

LGTM. Although consider using Martin as the author and yourself as Co-Authored-By, or vise versa.
Comment 13 Simon Feltman 2016-07-20 14:07:18 UTC
(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> ?
Comment 14 Christoph Reiter (lazka) 2016-07-20 15:07:31 UTC
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?
Comment 15 Christoph Reiter (lazka) 2016-07-20 15:32:29 UTC
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.