Clutter C++ bindings in 2020

I’m new to development using C++ and GNOME tools and I’m just trying to get setup. I want to use Clutter from C++. On first glance it would seem cluttermm is the thing to use, but after inspecting the github repo it looks like it hasn’t been updated in years.

If cluttermm is not viable, what are my options for using clutter from C++?

PS. Apologies if this is not in the right place.

1 Like

Clutter is in deep maintenance mode, and I would not recommend writing new code with it. Clutter’s API itself hasn’t changed in years, and won’t ever change, at this point.

The question is: what are you trying to achieve?

So Clutter will be soon replaced by GTK 4.0 ?

Can you please tell me what was the reason behind development of Clutter? In what way does it differ from GTK itself? :smiley:

Yes, that’s the plan. “Soon” may be an overstatement, but we do plan to release GTK4 later this year.

Clutter was developed in 2006 with the goal to be a technological demonstrator for writing full screen media players on embedded and resource constrained devices, like the old ultra-mobile PC platforms. After 2007-2008, it got repurposed as a way to create new, mobile user interfaces, using hardware acceleration (GL and GLES) and providing an animation framework to create new UI toolkits. Additionally, it was used to write desktop shells, like Moblin and GNOME 3.

You can think of Clutter as a prototype for many of the design choices that are now being used by GTK4:

  • explicit scene graph API, like the Web’s DOM, instead of implicit API like GTK1, 2, and 3
  • deferred rendering through a retained tree of paint primitives
  • layout management decoupled from scene graph elements
  • delegation to ancillary objects instead of deep type hierarchies

In general, Clutter is meant to be a mid-level toolkit—a library to write toolkits based on its primitives. That design choice was not great, though, as it came with overgeneralisation and performance trade-offs. It was a good experiment, though, because that allowed GTK4 to concentrate on being a proper toolkit, not something that can be manipulated out of tree by poking at its internals.

1 Like

Ok, that makes sense. I was wanting to use clutter for custom HUD style UI with visualizations. Can’t deny I’m just a little bit disappointed. The API was very similar to WebGL frameworks I’ve worked with which made it extremely appealing.

The announcement you linked to says GTK 4 is the successor. What is the recommended replacement for my use case then? GSK scene graph kit?

You can still use Clutter, but:

  • the C++ bindings are basically unmaintained, and since they use their own API description format instead of the standard GObject introspection data, they need to be updated manually instead of relying on the API description that Clutter generates at build time
  • the C library is feature and API frozen; I only ever do releases in case of crasher bugs
  • the implementation is definitely not as good as it ought to be, mostly for backward compatibility reasons; feature/API freeze also means that things won’t change, ever

No, it’s literally GTK.

GSK is just the namespace of the low level rendering API; the scene graph, input handling, and everything else lives in GTK.

You’re supposed to use widgets to build your UI, just like you’d do for every other application; if you need specific UIs you can write your own custom widgets, and/or style widgets in your own special ways through CSS.

Got it.
Thanks for the clarification and warning. You probably saved me hours of frustration

1 Like