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.

BigWhale
  • 734

1 Answers1

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.