4

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.

4

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.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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