GTK 4 Released
Written by Kay Ewbank   
Thursday, 07 January 2021

A major new version of GTK has been released with improvements to the internal design and an improved application programming interface (API). Support has been added for OpenGL and Vulkan hardware drawing for the widgets with the aim of maximizing performance while minimizing CPU load.

GTK is a toolkit for creating graphical user interfaces. Offering a complete set of widgets, GTK 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. Its compact nature and modular design make it suitable for use on devices with restricted resources like the Raspberry Pi family.

The new release sees improvements to areas including event controllers, layout managers, render nodes, media playback, scalable lists, shaders and accessibility.

Some of the most obvious changes to GTK version 4 affect custom widgets. The developers say that a general trend in the API is that “everything is a widget.”  Event handling has been added to widgets, taking over from the signals previously used to handle events such as button and keypresses.  All of these signals are gone in GTK 4, and instead you are expected to add event controllers to your widget, and listen to their signals.

The way widgets handle drawing has been updated, partially due to the new targeting of GL / Vulkan instead of cairo. As part of this switch, GTK has moved from an immediate mode rendering model to a retained mode one.  GTK 4 has also made it easier for GTK apps to show animations; be that a programmatic animation, a webm file or a live stream.

Support has also been added for layout managers. These wrap your child widgets in their own “layout child” objects, which can have properties that affect the layout. Previously, if you wanted to set up a complex object such as a grid, you'd need to set up a custom widget to arrange the child widgets as required. GTK 4 makes this more convenient with a layout manager. GTK comes with a number of predefined layout managers, such as GtkBoxLayout, GtkCenterLayout, and GtkGridLayout among others.

One major improvement is the addition of new list and grid widgets for handling scalable lists of data.

In GTK 3, listbox and floxbox containers were added for displaying the data in lists, but these generated a widget for each data item, making them difficult to use for large scale lists.This has been addressed and the replacement widgets should be able to handle unlimited numbers of items well. The developers say GTK 4 comes with a rich assortment of GListModel implementations, from various ways to combine or modify existing models to filtering and sorting.

GTK 4 is available now.


More Information

GTK 4 

Related Articles

Applying C - Framebuffer Graphics

GNOME's Wonderful Year

Smalltalk-Inspired Pharo 8.0 Released  

To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on Twitter, Facebook or Linkedin.


Amazon Updates Q Family And Previews App Studio

Amazon made multiple announcements at its AWS Summit in New York, including a preview of AWS App Studio, the addition of Q Developer to SageMaker Studio, and an Amazon Q Apps API.

Pgai Brings Your ML Workload To The Database

Extensions like pgai are targeted at the "AI Engineers", a new breed of developers who unlike researchers are concerned with practically applying AI (models, tools, and APIs) to build software.

More News

kotlin book



or email your comment to:

Last Updated ( Friday, 08 January 2021 )