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)
reg = Gdk.cairo_region_create_from_surface(surface)

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.


1 Answer 1


Unfortunately, some Cairo objects are not introspected yet:


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 agree to our terms of service, privacy policy and cookie policy

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