The GTK team has announced a major new version of their toolkit, GTK 4.0. This is a result of their 4 years of continuous hard work. Since the 3.89.1 release in November 2016, they had added 18k commits and made 20 development releases.
In case you don’t know, GTK is a toolkit for creating graphical user interfaces. Which offers a complete set of widgets, it is suitable for projects ranging from small one-off tools to complete application suites.
GTK is the core of the GNOME development platform, but it can also be used to write applications for other Linux environments, as well as applications targeting Microsoft Windows and Apple macOS.
Top Features of GTK 4.0
Let’s see the top features of the GTK 4.0 release.
Integrated Media Playback Support
GTK+ 4.0 added their GtkMediaStream, GtkMediaFile, GtkVideo, GtkMediaControls widgets for native multimedia stream playback by GStreamer and FFmpeg. So, playing media inside your GTK application is now only far from a widget.
GPU Acceleration Improvement
GTK 4.0 has it’s new Vulkan Renderer. This renderer is handling almost all rendering jobs without fallback into software renderer by Cairo. As a result, this will be a major improvement for Gnome with GTK 4.
Modern Data Transfer APIs
Data transfer interfaces are used for drag-and-drop and copy-paste. So, the data transfer interfaces had re-engineered with prominence on moving closer to the Wayland API whereas on GTK3 the GDK API was modeled on the X11 interfaces.
GLSL Shader Support
Now GTK4 demo includes a Shadertoy demo. The demo using a GtkGLArea widget to run GLSL snipplets that are compatible with the ones found on shadertoy.com. Many of the examples found there will work if you paste them into the editor of this demo.
This is fun but somewhat limited. The GLSL is confined to its sandbox, the GtkGLArea widget, which is using GL API to compile and use the shaders. Shaders are now a first-class object. It means you can use shaders on your widgets, like this demo.
Modern Layout Managers and Transforms
GTK4 brought many modern layout managers and transformations for menu views. Also, GPU rendering is working behind this.
Scalable Lists and Grids
With the new GtkListView, the number of list objects is now unlimited. They used an approach similar to the Android recycler view, which is highly scalable and intelligent design.
Also many more improvements including Event controllers, Render nodes, Accessibility, easy to make custom entry widgets, GPU accelerated scrolling, OpenGL rendering improvements and better Windows support.
GTK 4.0 is a stable release, so we can hope for more porting to GTK 4.0 on Gnome 40 release. GTK team will maintain GTK 3 for the foreseeable future. For the rendering improvements, I am hoping the gnome-terminal will get a translucent background like the OS X terminal.