Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I am trying to create a Gtk3 Window with a custom input mask, so that the window wouldn't receive any mouse clicks. This is a piece of code that I've came up with:

surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, w , h)
surface_ctx = cairo.Context(surface)
surface_ctx.set_source_rgba(1.0, 1.0, 1.0, 0.0)
surface_ctx.set_operator(cairo.OPERATOR_SOURCE)
surface_ctx.paint()
reg = Gdk.cairo_region_create_from_surface(surface)
widget.input_shape_combine_region(reg)

Unfortunately call to Gdk.cairo_region_create_from_surface() fails with this error:

Traceback (most recent call last):
  File "../kazam/frontend/window_region.py", line 144, in cb_draw reg = Gdk.cairo_region_create_from_surface(surface)
  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'

After inspecting Gdk-3.0.gir file I am somewhat baffled. Clearly I am doing something wrong (or there's something wrong with introspection?). Any advice will be appreciated.

share|improve this question
    
could you paste a complete example? –  xubuntix Jan 23 '12 at 12:10
    
bugs.launchpad.net/ubuntu/+source/pygobject/+bug/1028115 seems to be "fix released, but we're waiting for upstream" –  hbdgaf Oct 23 '12 at 20:59

1 Answer 1

Unfortunately, some Cairo objects are not introspected yet:

https://mail.gnome.org/archives/python-hackers-list/2011-December/msg00004.html

If you feel adventurous you can try to add support by yourself. Otherwise you need to find a workaround.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.