GDK
More info
- Creator
- Peter Mattis, Spencer Kimball and Josh MacDonald
- Type
- Windowing-system layer in GTK
- License
- LGPL
- Source
- gitlab.gnome.org/GNOME/gtk
The layer of GTK that talks to the window system, so the widgets above it need not know whether they sit on X11, Wayland, Windows, macOS or inside a web browser.
The GIMP Drawing Kit was there from the start, when Peter Mattis, Spencer Kimball and Josh MacDonald wrote GTK for GIMP in the mid-1990s. The idea was to keep Xlib in one place: GDK opens the display, creates and moves windows, reads events, handles cursors, selections and drag-and-drop, and in GTK 1 and 2 drew with a graphics context of its own that mirrored X's. The widgets see only GdkWindow and GdkEvent. So when Tor Lillqvist wanted GIMP on Windows in 1998, it was GDK he reimplemented, not GTK, and the same pattern repeated for Quartz on macOS, DirectFB, Broadway, which renders to HTML5 in a browser, and from 2011 Wayland.
Drawing moved to Cairo in 2005 and in GTK 4 left GDK entirely: GdkWindow was renamed GdkSurface and the pixels are produced by GSK on the GPU. Image loading had already departed as gdk-pixbuf, after a spell with Imlib. What remains is a layer almost no programmer calls directly but everyone depends on. When a GTK program behaves differently on X11 and Wayland, GDK is usually where the difference lives.