What’s new in Clutter 1.22

Hello, everyone!

It’s been a while since I’ve used this blog to do something more than repeat the announcements for new releases, or for changes in the Git repository. Let’s break the streak, and outline some of the changes that have happened in the last few months in the Clutter repository in preparation for the 1.22 release.

As you may have noticed, the development pace has slowed down considerably from the heyday of the 1.10 and 1.12 development cycles — no more apocalypses are scheduled for you. Most of the resources I have are currently being spent on the Clutter-inside-GTK project, which is called GSK and has been outlined on my blog. This does not mean that the development of Clutter has ceased; since Clutter is still in use, bug fixes and new features are planned and landing in the Git repository.

Let’s start with the biggest change, if not in terms of size of the commit at least in terms of impact for users and application developers: the GDK backend is now the default backend on Linux, instead of the X11 one. What does this mean for users? It likely means that Clutter-based applications will behave much better when it comes to system integration. GDK is the GTK+ windowing system abstraction API, and it has a lot more features than Clutter’s own. You’ll start noticing that things like making the ClutterStage full screen works a lot better with Clutter 1.22, for instance, as it will respect details like the current primary monitor, as well as the monitor geometry. For application developers this change means that you now have access to the GDK API from Clutter, and you can modify things like window decorations, or input shape, without having to resort to writing X11-specific code using Xlib. If your application requires the X11 backend, though, you can (and should) enforce this dependency using the clutter_set_windowing_backend() function, which was added in Clutter 1.16, about two years ago. The change to using the GDK backend by default has been the result of a lot of work from Lionel Landwerlin.

Still from the backend news department, we have a new windowing system backend for the Mir display server, courtesy of Marco Treviño Trevisan. This means that Clutter-based applications will be able to run natively under Mir. We also have improvements in the input backends based on X11 and libinput; changes in the latter have been driven by GNOME Shell running as a Wayland compositor, and are the result of many hours of work from Rui Matos, Jonas Ådahl, and Carlos Garnacho. One final addition, written by Owen Taylor, for the X11 backend is the ability to tell Clutter to set up visuals using the GLX stereo buffers bit; this means that you can set up rendering of Clutter actors differently for the right and left “eye” buffers.

In terms of new API, we have two changes related to how actors compute their preferred size. The first one is a new ClutterRequestMode enumeration value, CLUTTER_REQUEST_CONTENT_SIZE. This new mode tells a ClutterActor to use the preferred size of its ClutterContent (if one is assigned) to determine its own natural size. Since it’s the natural size, if the actor gets allocated a smaller size by its parent, the content’s gravity will do the rest, and control how the content is sized with regards to the actor’s allocation. The other new API is inside ClutterConstraint, and allows a constraint to control the preferred size of the actor using it, just like it controls the allocation. ClutterActor will query all constraints associated to an instance and compute the preferred size depending on them. This allows you to query an actor’s preferred size and get sensible values, even in the case it’s using constraints.

After getting helpful feedback on the Clutter mailing list, the documentation with regards to the deprecation notices has been improved; the deprecated classes and functions now should all point to their replacements (where applicable).

The Clutter 1.22 release is planned alongside the GNOME 3.16 release, so you can expect it by the end of March.

Have fun!

2 thoughts on “What’s new in Clutter 1.22”

  1. How do I install Clutter for python on my mac osx 10.8.5? Cannot find any documentation on this. Bought this book called “Code Academy 2015”, and it has lots of cool examples that begin with “import clutter”, and yet nothing about how to actually install it. Please help me out. thanks a lot for your time.

    1. Hi; you can install Clutter and PyClutter using JHBuild on MacOS — you can follow the instructions for building GTK+ on MacOS, and then clone the Cogl, Clutter, and PyClutter repositories.

      Sadly, I’m not sure Clutter still works on MacOS: I haven’t tested in a long while; your best bet at support is Linux, as far as I’m concerned.

      PyClutter has also been changed to provide only overrides based on introspection of the C library, so the old syntax of “import clutter” won’t really work.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.