GTK 4.2.0 is now available for download in the usual places.
This release is the result of the initial round of feedback from the application developers porting their projects to GTK4, so it mostly consists of bug fixes and improvements to the API—but we also added new features, like a new GL renderer; various improvements in how the toolkit handles Compose and dead key sequences; build system improvements for compiling GTK on Windows and macOS; and a whole new API reference, generated from the same introspection data that language bindings also consume.
For more information, you can check the previous blog post about the 4.1 development cycle.
The NGL renderer
Thanks to the hard work of Christian Hergert, the NGL renderer is now the default renderer for Linux, Windows, and macOS. We’ve had really positive feedback from users on mobile platforms using drivers like Lima, with noticeable improvements in frames per second, as well as power and CPU usage; the latter two are also going to impact positively desktop and laptop users. The NGL renderer is just at the beginning: the new code base will allow us even more improvements down the line.
For the time being, we have kept the old GL renderer available; you can use
export GSK_RENDERER=gl in your environment to go back to the 4.0 GL renderer—but make sure to file an issue if you need to do so, to give us the chance to fix the NGL renderer.
Matthias wrote a whole blog post about the handling of Compose and dead keys input sequences, so you can just read it. The dead key handling has seen a few iterations, to deal with oddities and workarounds that have been introduced in the lower layers of the input stack.
There is one known issue with the handling of dead acute accents vs apostrophes in some keyboard layouts, which is still being investigated. If you notice other problems with keyboard input, specifically around Compose sequences or dead keys, please file an issue.
One of the goals of GTK is to have a “turn key” build system capable of going from a clone of the Git repository to a fully deployable installation of the toolkit, without having to go through all the dependencies manually, or using weird contraptions. You can see how this works on Windows, using native tools, in this article from our friends at Collabora.
Additionally, we now ensure that you can use GTK as a Meson sub-project; this means you can build GTK and all its dependencies as part of your own application’s build environment, and you can easily gather all the build artifacts for you to distribute alongside your application, using the toolchain of your choice.
One of the most notorious issues for newcomers to GTK has been the documentation. Application developers not acquainted with our API have often found it hard to find information in our documentation; additionally, the style and structure of the API reference hasn’t been refreshed in ages. To improve the first impression, and the use of our documentation, GTK has switched to a new documentation generator, called gi-docgen. This new tool adds new features to the API reference, like client-side search of terms in the documentation; as well as nice little usability improvements, like:
- a “Copy to clipboard” button for code fragments and examples
- a visual hierarchy of ancestors and interfaces for each class
- the list of inherited properties, signals, and methods in a class
- a responsive design, which makes it easier to use the API reference on small screens
An API is only as good as it allows developers to use it in the most idiomatic way. GTK not only has a C API, it also exposes a whole API for language bindings to consume, through GObject-Introspection. The new documentation uses the same data, which not only allows us to cut down the built time in half, but it also generates common bits of documentation from the annotations in the source, making the API reference more consistent and reliable; finally, the C API reference matches what language binding authors see when consuming the introspection data, which means we are going to tighten the feedback loop between toolkit and bindings developers when introducing new API.
Pango and GdkPixbuf have also switched to gi-docgen, which allows us to build the API reference for various dependencies through our CI pipeline, and publish it to a whole new website: docs.gtk.org. You’ll always find the latest version of the GTK documentation there.
Odds and ends
Of course, alongside these visible changes we have smaller ones:
- performance improvements all across the board, from GLSL shaders used to render our content, to the accessibility objects created on demand instead of upfront
- sub-pixel positioning of text, when using a newer version of Cairo with the appropriate API
- a responsive layout for the emoji chooser
- improved rendering of shadows in popover widgets
- localized digits in spin buttons
- improved support for the Wayland input method protocol
- improved scrolling performance of the text view widget
GTK 4.2 is the result of four months of development, with 1268 individual changes from 54 developers; a total of 73950 lines were added, and 60717 removed.
|Developers with the most changesets|
|Ignacio Casal Quinteiro||6||0.5%|
|Emmanuel Gil Peyrot||5||0.4%|
|Jan Alexander Steffens (heftig)||4||0.3%|
|Developers with the most changed lines|
|Ignacio Casal Quinteiro||717||0.8%|
|Emmanuel Gil Peyrot||232||0.3%|
|Jan Alexander Steffens (heftig)||65||0.1%|
|Developers with the most lines removed|
|Emmanuel Gil Peyrot||146||0.2%|
|Jan Alexander Steffens (heftig)||1||0.0%|