# GDK

> Mediated Wiki article. Canonical URL: https://mediated.wiki/source/GDK
> Markdown URL: https://mediated.wiki/source/GDK.md
> Source: https://en.wikipedia.org/wiki/GDK
> Source revision: 1308082370
> License: Creative Commons Attribution-ShareAlike 4.0 International (https://creativecommons.org/licenses/by-sa/4.0/)

Software library

For other uses, see [GDK (disambiguation)](/source/GDK_(disambiguation)).

GDK Simplified software architecture of GTK Original author GIMP authors Developer The GNOME Project Stable release 4.11.5[1] Written in C Operating system Linux, macOS, Microsoft Windows Platform X11, Wayland, Quartz and GDI Type Software library License GNU Lesser General Public License (LGPL) Website developer.gnome.org/gdk3/stable/ Repository gitlab.gnome.org/GNOME/gtk/tree/master/gdk

**GDK** ([GIMP](/source/GIMP) Drawing Kit) is a [library](/source/Library_(computing)) that acts as a [wrapper](/source/Wrapper_pattern) around the low-level functions provided by the underlying windowing and graphics systems. GDK lies between the [display server](/source/Display_server) and the [GTK](/source/GTK) library, handling basic [rendering](/source/Rendering_(computer_graphics)) such as drawing primitives, [raster graphics](/source/Raster_graphics) (bitmaps), [cursors](/source/Cursor_(computers)), [fonts](/source/Font), as well as [window events](/source/Event_(computing)) and [drag-and-drop](/source/Drag-and-drop) functionality.

Like [GTK Scene Graph Kit](/source/GTK_Scene_Graph_Kit) (GSK), GDK is part of GTK and licensed under the [GNU Lesser General Public License](/source/GNU_Lesser_General_Public_License) (LGPL).

## Software architecture

GDK contains back-ends to [X11](/source/X11), [Wayland](/source/Wayland_(display_server_protocol)), Broadway ([HTTP](/source/Hypertext_Transfer_Protocol)), [Quartz](/source/Quartz_Compositor) and [GDI](/source/Graphics_Device_Interface) and relies on [Cairo](/source/Cairo_(graphics)) for the rendering. Its new [scene graph (canvas)](/source/Canvas_(GUI)) is work-in-progress, its arrival should herald GTK 4.0.

GTK is implemented on top of an abstraction layer called GDK, freeing GTK from low-level concerns like input gathering, [drag and drop](/source/Drag_and_drop), and pixel format conversion. GDK is an intermediate layer which separates GTK from the details of the windowing system.

GDK is an important part of GTK's portability. Since low-level cross-platform functionality is already provided by [GLib](/source/GLib), all that is needed to make GTK run on other platforms is to port GDK to the underlying [operating system](/source/Operating_system)'s graphics layer. Hence, the GDK ports to the [Windows API](/source/Windows_API) and [Quartz](/source/Quartz_(graphics_layer)) are what enable GTK applications to run on [Windows](/source/Microsoft_Windows) and [macOS](/source/MacOS), respectively.

Starting with GTK+ 2.8, GDK supports [Cairo](/source/Cairo_(graphics)), which is recommended for use with GTK+ 3 instead of GDK's drawing functions.[2]

GDK is an intermediate layer which isolates [GTK](/source/GTK) from the details of the [windowing system](/source/Windowing_system). GDK is a thin wrapper around [Xlib](/source/Xlib). The X Window System comes with a low-level library called [Xlib](/source/Xlib). Almost every function in GDK is a very thin wrapper around a corresponding Xlib function; but some of the complexity (and functionality) of Xlib is hidden, to simplify programming and to make GDK easier to port to other windowing systems, such as [Wayland](/source/Wayland_(display_server_protocol)) or Microsoft Windows. The Xlib functionality provided is mostly that targeted toward applications; for example, many features used solely by [window managers](/source/Window_manager) are not exposed in GDK.

GDK supports [OpenGL](/source/OpenGL) (or [OpenGL ES](/source/OpenGL_ES)) for better control of the [graphics pipeline](/source/Graphics_pipeline).

### GdkFrameClock

GdkFrameClock was added in GTK 3.8[3]

While GTK applications remain mainloop driven (cf. [Glib event loop](/source/Event_loop#Glib_event_loop)), meaning the application is idle inside this main loop most of the time waiting for an event and then calls the appropriate subroutine when one occurs, GdkFrameClock adds an additional mechanism, which tells the application when to update and repaint a window.[4] The update rate can be synchronized with the monitor refresh rate.

### GTK Scene Graph Kit

Main article: [GTK Scene Graph Kit](/source/GTK_Scene_Graph_Kit)

In its history GDK contained and linked with a couple of different [Canvases](/source/Canvas_(GUI)).

- [https://wiki.gnome.org/Attic/ProjectRidley/CanvasOverview](https://wiki.gnome.org/Attic/ProjectRidley/CanvasOverview) - [https://wiki.gnome.org/Attic/ProjectRidley/CanvasOverview/Canvases](https://wiki.gnome.org/Attic/ProjectRidley/CanvasOverview/Canvases)

- [https://wiki.gnome.org/Projects/GooCanvas](https://wiki.gnome.org/Projects/GooCanvas)

Developers were also considering new directions for the library, including removing deprecated [API](/source/Application_programming_interface) components and adding an integrated [scene graph (canvas)](/source/Canvas_(GUI)) system, similar to the Clutter graphics library, effectively integrating GTK with [OpenGL](/source/OpenGL) and [Vulkan](/source/Vulkan_(API)).[5][6]

- [GTK Scene Graph Kit](/source/GTK_Scene_Graph_Kit) (GSK)[7][8]

GTK+ Scene Graph Kit (GSK) was released as part of GTK+ 3.90 in March 2017. It is the scene graph and rendering API for GTK. GSK has not been further integrated with GDK (which is also part of GTK) but is kept in its own directory.

### Windowing systems

GDK contains back-ends to a couple of [windowing systems](/source/Windowing_system), namely to the [X11](/source/X11) and [Wayland](/source/Wayland_(display_server_protocol)) protocols, to [Quartz](/source/Quartz_Compositor) and [GDI](/source/Graphics_Device_Interface), and even to the [Hypertext Transfer Protocol](/source/Hypertext_Transfer_Protocol) (HTTP) engine Broadway.[*[citation needed](https://en.wikipedia.org/wiki/Wikipedia:Citation_needed)*]

With the release of GNOME 3.16 in March 2015, GDK obtained an experimental back-end for the [Mir](/source/Mir_(software)) display server protocol.[9] The Mir display server protocol is a product by [Canonical](/source/Canonical_(company)) for their [Ubuntu](/source/Ubuntu_(operating_system)) distribution of Linux, which they intend to compete with the Wayland display server protocol; so far, it is implemented only in Ubuntu.

At present, no back-end exists for [KMS](/source/Direct_Rendering_Manager#Kernel_Mode_Setting).[*[citation needed](https://en.wikipedia.org/wiki/Wikipedia:Citation_needed)*]

The environment variable *GDK_BACKEND* can be used to start an application and force this instance of it to use a certain windowing system: GDK_BACKEND=wayland gnome-calculator GDK_BACKEND=wayland CLUTTER_BACKEND=wayland cheese

## gdk-pixbuf

gdk-pixbuf is a toolkit for image loading and pixel buffer manipulation. The library provides image loading and saving facilities, fast scaling and compositing of pixbufs, simple animation loading (i.e. animated GIFs), and rendering the libart image buffer to a GdkDrawable instance.

gdk-pixbuf has a fairly large API.

The fundamental structure in the gdk-pixbuf library is GdkPixbuf, a private, opaque data structure that mirrors many of the same concepts that ArtPixBuf supports. In fact, most of GdkPixbuf's private data fields have the same names and data types as the corresponding ones in ArtPixBuf. This similarity dates back to the earlier days when gdk-pixbuf was a wrapper around [libart](/source/Libart). Since that time, the libart dependency has been stripped out, and gdk-pixbuf was merged into the GTK+ 2.0 code base. As such, gdk-pixbuf's days as a standalone library are limited to the [GNOME 1](/source/GNOME_1) release.

With the release of GTK+ 2.22 on 2010-09-23, gdk-pixbuf has been turned back into a standalone library, after being shipped as part of GTK+ since gtk+ 2.0. This was done in preparation for the transition to GTK+ 3.

- [https://git.gnome.org/browse/gdk-pixbuf/](https://git.gnome.org/browse/gdk-pixbuf/)

The first stand-alone release was [2.22](https://mail.gnome.org/archives/ftp-release-list/2010-September/msg00119.html) on 2010-Sep-21, its development started with [2.21.3](https://mail.gnome.org/archives/ftp-release-list/2010-June/msg00171.html) on 2010-06-23.

## History

GDK was originally developed on the [X Window System](/source/Display_server#X) for the GIMP [raster graphics editor](/source/Raster_graphics_editor).[10]

## See also

- [Free and open-source software portal](https://en.wikipedia.org/wiki/Portal:Free_and_open-source_software)

- Clutter

## References

1. **[^](#cite_ref-wikidata-ee5695101aeee9b8b82cfd9798888ddead0648b9-v20_1-0)** ["n Namespace Gdk – 4.0; The GTK toolkit Version 4.11.5"](https://docs.gtk.org/gdk4/). February 2023. Retrieved 28 July 2023.

1. **[^](#cite_ref-2)** [Migrating from GTK+ 2.x to GTK+ 3 - Use cairo for drawing](https://docs.gtk.org/gtk3/migrating-2to3.html#use-cairo-for-drawing)

1. **[^](#cite_ref-3)** ["GdkFrameClock"](https://developer.gnome.org/gdk3/stable/GdkFrameClock.html).

1. **[^](#cite_ref-4)** Larsson, Alexander (2013-11-04). ["The modern Gtk drawing model"](https://blogs.gnome.org/alexl/2013/11/04/the-modern-gtk-drawing-model/).

1. **[^](#cite_ref-5)** [Alberto Ruiz's Blog](https://aruiz.typepad.com/siliconisland/2008/03/gtk-hackfest-20.html)

1. **[^](#cite_ref-6)** [Havoc Pennington's scene graph proposal](https://mail.gnome.org/archives/gtk-devel-list/2008-March/msg00017.html)

1. **[^](#cite_ref-7)** ["The GTK+ Scene Graph Kit"](https://www.bassi.io/articles/2014/07/29/guadec-2014-gsk/). 2014-07-29.

1. **[^](#cite_ref-8)** ["Graphene"](https://blogs.gnome.org/ebassi/2014/05/02/graphene/). 2014-05-02.

1. **[^](#cite_ref-9)** ["add an experimental backend for mir"](https://git.gnome.org/browse/gtk+/commit/?id=0f26b26f1d93f002ccd5fe6b6fd636172bfbb24b).

1. **[^](#cite_ref-10)** [GIMP - A Brief (and Ancient) History of GIMP](https://www.gimp.org/about/ancient_history.html)

## External links

- [GDK code from release GTK+ 3.19.0](https://git.gnome.org/browse/gtk+/tree/gdk?h=gtk-3-18)

- [The modern Gtk drawing model](https://blogs.gnome.org/alexl/2013/11/04/the-modern-gtk-drawing-model/) – Alexander Larsson, 2013/11/04

- [Overview of GTK and its Libraries](https://www.gtk.org/overview.php) [Archived](https://web.archive.org/web/20190312022548/https://www.gtk.org/overview.php) 2019-03-12 at the [Wayback Machine](/source/Wayback_Machine) - The GTK Project

- [https://git.gnome.org/browse/gtk-web/plain/images/architecture.svg](https://git.gnome.org/browse/gtk-web/plain/images/architecture.svg)

v t e GTK and its applications Platform GTK GTK GDK ATK ClutterActor GTK Scene Graph Kit Pango Language bindings PyGTK PyGObject GLib GObject GIO IBus Orca dconf Vala Keyring GNOME-DB GVfs Hildon Librsvg MetaTracker libxslt libxml2 freedesktop.org (shared) AppStream D-Bus GStreamer NetworkManager Poppler libcanberra Wayland X.Org Server PulseAudio PackageKit HarfBuzz Cairo Development GUI designer, RAD Glade Interface Designer GNOME Builder IDEs Anjuta Builder Meld Devhelp Poedit Geany Gtranslator gPHPedit SciTE UberWriter PIDA GNOME GNOME Shell GNOME Games Core Applications Boxes Calculator Character Map Disks Files Software Terminal Videos Web other dconf editor Cinnamon Nemo Xfce Thunar LXDE PCMan File Manager LXMusic Graphical shells GNOME Shell GNOME Panel Docky GNOME Do Avant Window Navigator Phosh 3rd-party applications Office AbiWord Dia Gnumeric Evince (PDF) Evolution OCRFeeder Education Gramps GCompris DrGeo GeoGebra Ghemical Celestia Graphics GIMP GNU Paint Inkscape gThumb gPhoto Eye of GNOME Sushi Shotwell F-Spot Internet Balsa Sylpheed Claws Mail Empathy Ekiga gtk-gnutella GNU Ring Vinagre Uzbl transmission-gtk Audio Audacious PulseEffects Buzztrax Exaile Rhythmbox Sound Juicer SoundConverter Quod Libet Ex Falso EasyTag Asunder Video Avidemux Cinelerra Cheese Gnome MPlayer Guvcview Kino LiVES OpenShot Video Editor Pitivi Utilities Archive Manager Brasero dconf-editor Diodon gedit gnote Screenshot GParted Guake Leafpad Tilda Tomboy Wine-Doors Workrave Category:GTK Category:Software that uses GTK Commons

---
Adapted from the Wikipedia article [GDK](https://en.wikipedia.org/wiki/GDK) by Wikipedia contributors ([contributor history](https://en.wikipedia.org/wiki/GDK?action=history)). Available under [Creative Commons Attribution-ShareAlike 4.0 International](https://creativecommons.org/licenses/by-sa/4.0/). Changes may have been made.
