GTK4 New Data Transfer API

Shifting towards an advanced windowing system, GTK4 has remodeled the traditional way of data transfer between the applications.

Matthias Clasen, a core team maintainer, mentioned in his latest blog that GDK is being revised to support the Wayland API, replacing the older X11. Hence, GTK4 includes a new method to deal with the transfer of any data type between the process.

Improvements in APIs

GTK4 is an object-oriented toolkit that’s used to create GUI for applications, desktop environments, and other tools that can run on various platforms like Linux, Windows, and macOS.

And, GDK is a low-level library under GTK that acts as an interface between the display server and GTK library. It enables basic stuff like drag-n-drop functionality.

But as GDK APIs are based on the X11 display server protocol, it limits the data transfer if receiving end-application does not support the same data format.

Hence, the GTK4 team has introduced an API, GdkContentFormats object, that will contain a list of formats to match and identify the data type in both the case of a cross and single application data transfer.

In order to convert the mismatched data format, GTK4 also includes GdkContentSerializer and GdkContentDeserializer APIs that will change the GTypes into mime data types and vice-versa.

Moreover, GTK4 restructures the copy/paste and drag-n-drop operation to support its implementation on cross-platform using new APIs.

Similar Posts