HOME

TheInfoList



OR:

GTK (formerly GIMP ToolKit and GTK+) is a
free and open-source Free and open-source software (FOSS) is a term used to refer to groups of software consisting of both free software and open-source software where anyone is freely licensed to use, copy, study, and change the software in any way, and the source ...
cross-platform widget toolkit for creating graphical user interfaces (GUIs). It is licensed under the terms of the GNU Lesser General Public License, allowing both
free Free may refer to: Concept * Freedom, having the ability to do something, without having to obey anyone/anything * Freethought, a position that beliefs should be formed only on the basis of logic, reason, and empiricism * Emancipate, to procur ...
and proprietary software to use it. It is one of the most popular toolkits for the Wayland and X11 windowing systems. The GTK team releases new versions on a regular basis. GTK 4 and GTK 3 are maintained, while GTK 2 is end-of-life.


Software architecture

The GTK library contains a set of graphical control elements ( widgets); version 3.22.16 contains 186 active and 36 deprecated widgets. GTK is an object-oriented widget toolkit written in the programming language C; it uses GObject, that is the GLib object system, for the object orientation. While GTK is mainly for windowing systems based on X11 and Wayland, it works on other platforms, including
Microsoft Windows Windows is a group of several proprietary graphical operating system families developed and marketed by Microsoft. Each family caters to a certain sector of the computing industry. For example, Windows NT for consumers, Windows Server for serv ...
(interfaced with the Windows API), and macOS (interfaced with Quartz). There is also an HTML5 back-end named ''Broadway''. GTK can be configured to change the look of the widgets drawn; this is done using different display engines. Several display engines exist which try to emulate the look of the native widgets on the platform in use. Starting with version 2.8, released in 2005, GTK began the transition to using Cairo to render most of its graphical control elements widgets. Since GTK version 3.0, all rendering is done using Cairo. On 26 January 2018 at
DevConf.cz DevConf.cz (Developer Conference) is an annual, free, Red Hat sponsored community conference for developers, admins, DevOps engineers, testers, documentation writers and other contributors to open source technologies. The conference includes topic ...
, Matthias Clasen gave an overview of the current state of GTK 4 development, including a high-level explanation of how rendering and input worked in GTK 3, what changes are being made in GTK 4 (>3.90), and why. On 6 February 2019 it was announced that GTK 4 will drop the “+” from the project's name.


GTK Drawing Kit (GDK)

GDK acts as a wrapper around the low-level functions provided by the underlying windowing and graphics systems. GDK is found in the /gdk
/code> directory.


GTK Scene Graph Kit (GSK)

GSK is the rendering and scene graph API for GTK. GSK lies between the graphical control elements (widgets) and the rendering. GSK was finally merged into GTK version 3.90 released March 2017. GSK is found in the /gsk
/code> directory.


GtkInspector

GtkInspector was introduced with version 3.14. GtkInspector can only be invoked after installing the development packag
libgtk-3-devgtk+-devel


GUI designers

There are several GUI designers for GTK. The following projects are active as of July 2011: * Glade, supports
GtkBuilder GTK (formerly GIMP ToolKit and GTK+) is a free and open-source cross-platform widget toolkit for creating graphical user interfaces (GUIs). It is licensed under the terms of the GNU Lesser General Public License, allowing both free and propriet ...
, which is a GTK built-in GUI description format. * Gazpacho, GUI builder for the GTK toolkit written in Python * Crow Designer, relies on its own GuiXml format and GuiLoader library. *
Stetic MonoDevelop (also known as Xamarin Studio) is an open-source integrated development environment for Linux, macOS, and Windows. Its primary focus is development of projects that use Mono and .NET Framework. MonoDevelop integrates features similar t ...
, part of MonoDevelop, oriented toward Gtk#. * Gambas since version 2.0 atop
BASIC BASIC (Beginners' All-purpose Symbolic Instruction Code) is a family of general-purpose, high-level programming languages designed for ease of use. The original version was created by John G. Kemeny and Thomas E. Kurtz at Dartmouth College ...
* Xojo on Linux * Lazarus on Linux defaults to interfacing with GTK 2


GtkBuilder

GtkBuilder allows user interfaces to be designed without writing code. The interface is described in an Extensible Markup Language (XML) file, which is then loaded at runtime and the objects created automatically. The Glade Interface Designer allows creation of the user interface in a ''what you see is what you get'' ( WYSIWYG) manner. The description of the user interface is independent from the programming language being used.


Language bindings

Language bindings are available for using GTK from languages other than C, including C++, Genie, JavaScript, Perl, Python, Vala, and
others Others or The Others may refer to: Fictional characters * Others (A Song of Ice and Fire), Others (''A Song of Ice and Fire''), supernatural creatures in the fictional world of George R. R. Martin's fantasy series ''A Song of Ice and Fire'' * Ot ...
. GtkSharp, not to be confused with Gtk#, supports GTK 3.


Gtk#

Gtk# is a set of
.NET Framework The .NET Framework (pronounced as "''dot net"'') is a proprietary software framework developed by Microsoft that runs primarily on Microsoft Windows. It was the predominant implementation of the Common Language Infrastructure (CLI) until bein ...
bindings for the GTK graphical user interface (GUI) toolkit and assorted
GNOME A gnome is a mythological creature and diminutive spirit in Renaissance magic and alchemy, first introduced by Paracelsus in the 16th century and later adopted by more recent authors including those of modern fantasy literature. Its characte ...
libraries. The library facilitates building graphical GNOME applications using Mono or any other compliant
Common Language Runtime The Common Language Runtime (CLR), the virtual machine component of Microsoft .NET Framework, manages the execution of .NET programs. Just-in-time compilation converts the managed code (compiled intermediate language code) into machine instructio ...
(CLR). Gtk# is an event-driven system like any other modern windowing library where every widget allows associating handler methods, which get called when certain events occur. Applications built using Gtk# will run on many platforms including Linux, Windows and macOS. The Mono packages for Windows include GTK, Gtk# and a native theme to make applications look like native Windows applications. Starting with Mono 1.9, running Gtk# applications on macOS no longer requires running an X11 server. Glade Interface Designer can be used with the Glade# bindings to easily design GUI applications. A GUI designer named
Stetic MonoDevelop (also known as Xamarin Studio) is an open-source integrated development environment for Linux, macOS, and Windows. Its primary focus is development of projects that use Mono and .NET Framework. MonoDevelop integrates features similar t ...
is integrated with the MonoDevelop integrated development environment (IDE). In addition to support the standard GTK/GNOME stack of development tools, the assembly provides a bridge to consume functionality available on the .NET stack. At this point this includes the functionality to use System.Drawing to draw on a widget. , Gtk# support for Gtk3 remains in the preview phase and forked projects, such a
GtkSharp
have been founded to provide full Gtk3 support for C# and other CLI languages. The lack of a released version of Gtk# with support for Gtk3 was cited as a reason to remove the Banshee media player in Ubuntu 12.04.


Development

GTK is mainly developed by The GNOME Project, which also develops the GNOME Development Platform and the GNOME Desktop Environment. GTK development is loosely managed. Discussion chiefly occurs on several public mailing lists. GNOME developers and users gather at an annual ''GNOME Users And Developers European Conference''
GUADEC GUADEC, the GNOME Users And Developers European Conference, is an annual developer conference, whose prime topic is the development of the GNOME, GNOME desktop environment and its underlying base software, such as GTK, GStreamer, etc. The first ...
meeting to discuss GNOME's current state and future direction. GNOME incorporates standards and programs from freedesktop.org to better interoperate with other desktops. GTK is mainly written in C. Many language bindings are available. On 1 September 2016 a post on the GTK development blog denoted, among other things, the future numbering scheme of GTK. GTK version 3.22, released in Autumn 2016, was planned to be the last 3.x release, although version 3.24 followed in Fall 2018 with the delay of GTK 4. The development of GTK 4 used version names 3.90, 3.92, etc. until the first GTK 4.0 stable release was launched in December 2020. Despite the first stable GTK 4 release, some applications using GTK still rely on GTK 2. For example, as of January 2022,
GIMP GIMP ( ; GNU Image Manipulation Program) is a free and open-source raster graphics editor used for image manipulation (retouching) and image editing, free-form drawing, transcoding between different image file formats, and more specialized task ...
is still being ported to GTK 3.


Build automation

GTK (and GNOME, GLib, etc.) formerly utilized the GNU Build System (named Autotools) as the build automation system of choice. Since 14 Aug 2017, the master branch of GTK has been built with Meson, and the Autotools build system files have been dropped.


Criticism

The most common criticism of GTK is the lack of backward-compatibility in major updates, most notably in the
application programming interface An application programming interface (API) is a way for two or more computer programs to communicate with each other. It is a type of software interface, offering a service to other pieces of software. A document or standard that describes how t ...
(API) and theming. The compatibility breaks between minor releases during the GTK 3.x development cycle was explained by Benjamin Otte as due to strong pressures to innovate, such as providing the features modern users expect and supporting the increasingly influential Wayland display server protocol. With the release of GTK 4, the pressure from the need to innovate will have been released and the balance between stability and innovation will tip toward stability. Similarly, recent changes to theming are specifically intended to improve and stabilise that part of the API, meaning some investment now should be rewarded later. * Dirk Hohndel, codeveloper of
Subsurface In geology, bedrock is solid rock that lies under loose material (regolith) within the crust of Earth or another terrestrial planet. Definition Bedrock is the solid rock that underlies looser surface material. An exposed portion of bedro ...
and member of Intel's Open-Source Technology Center, criticized the GTK developers for being abrasive and ignoring most community requests. * Hong Jen Yee, developer of LXDE (the GTK version of which was dropped and all efforts focused on the Qt port), expressed disdain for version 3 of the GTK toolkit's radical API changes and increased memory usage, and ported PCMan File Manager (PCManFM) to Qt. PCManFM is being developed with a GTK and with a Qt backend at the same time. * The Audacious music player moved to Qt in version 3.6. The reasons stated by the developers for this include a transition to client-side window decorations, which they claim cause the application to look "
GNOME A gnome is a mythological creature and diminutive spirit in Renaissance magic and alchemy, first introduced by Paracelsus in the 16th century and later adopted by more recent authors including those of modern fantasy literature. Its characte ...
-y and out of place." * Wireshark has switched to Qt due to not having a good experience with GTK's cross-platform support.


Use


Applications

Some notable applications that use GTK as a widget toolkit include: * Ardour, a digital audio workstation (DAW) * Deluge, a Bit Torrent client *
Foliate This glossary of botanical terms is a list of definitions of terms and concepts relevant to botany and plants in general. Terms of plant morphology are included here as well as at the more specific Glossary of plant morphology and Glossary o ...
, an
ebook An ebook (short for electronic book), also known as an e-book or eBook, is a book publication made available in digital form, consisting of text, images, or both, readable on the flat-panel display of computers or other electronic devices. Alt ...
reader *
GIMP GIMP ( ; GNU Image Manipulation Program) is a free and open-source raster graphics editor used for image manipulation (retouching) and image editing, free-form drawing, transcoding between different image file formats, and more specialized task ...
, a
raster graphics editor A raster graphics editor is a computer program that allows users to create and edit images interactively on the computer screen and save them in one of many raster graphics file formats (also known as bitmap images) such as JPEG, PNG, and GI ...
* GNOME Builder, an integrated development environment (IDE) * GNOME Core Applications, a collection of applications as a standard bundle of the
GNOME A gnome is a mythological creature and diminutive spirit in Renaissance magic and alchemy, first introduced by Paracelsus in the 16th century and later adopted by more recent authors including those of modern fantasy literature. Its characte ...
desktop environment * GNOME Evolution, a personal information manager * HandBrake, digital video transcoder * Inkscape, a vector graphics editor * LibreOffice, an office suite * Lutris, a game manager *
Mozilla Firefox Mozilla Firefox, or simply Firefox, is a free and open-source web browser developed by the Mozilla Foundation and its subsidiary, the Mozilla Corporation. It uses the Gecko rendering engine to display web pages, which implements current and a ...
, a web browser * Mozilla Thunderbird, a personal information manager * Pitivi, a video editor *
PCSX-Reloaded PCSX is a free and open-source, video game console emulator that allows software designed to be used with the Sony PlayStation to run on personal computers. Over the years, development changed hands several times with PCSX-Reloaded (PCSXR) now be ...
, a video game console emulator * Remmina, a remote desktop client *
Transmission Transmission may refer to: Medicine, science and technology * Power transmission ** Electric power transmission ** Propulsion transmission, technology allowing controlled application of power *** Automatic transmission *** Manual transmission *** ...
, a Bit Torrent client


Desktop environments

Several desktop environments utilize GTK as the widget toolkit.


Current

*
GNOME A gnome is a mythological creature and diminutive spirit in Renaissance magic and alchemy, first introduced by Paracelsus in the 16th century and later adopted by more recent authors including those of modern fantasy literature. Its characte ...
, based on GTK, meaning that programs native to GNOME use GTK *
Budgie Budgie may refer to: Arts * Budgie (album), ''Budgie'' (album), the debut album by the Welsh heavy metal band Budgie * Budgie (band), a Welsh heavy metal band from Cardiff * Budgie (musician) (born 1957), English drummer * Budgie (TV series), ''Bu ...
, built from scratch for the SolusOS successor, Solus Operating System *
Cinnamon Cinnamon is a spice obtained from the inner bark of several tree species from the genus ''Cinnamomum''. Cinnamon is used mainly as an aromatic condiment and flavouring additive in a wide variety of cuisines, sweet and savoury dishes, breakfa ...
, a fork of GNOME 3 which uses GTK version 3 *
MATE Mate may refer to: Science * Mate, one of a pair of animals involved in: ** Mate choice, intersexual selection ** Mating * Multi-antimicrobial extrusion protein, or MATE, an efflux transporter family of proteins Person or title * Friendship ...
, a fork of GNOME 2 which uses GTK 3 since version 1.18 * Xfce, based on GTK 3 since version 4.14 * Pantheon uses GTK 3 exclusively, being developed by elementary OS *
Sugar Sugar is the generic name for sweet-tasting, soluble carbohydrates, many of which are used in food. Simple sugars, also called monosaccharides, include glucose, fructose, and galactose. Compound sugars, also called disaccharides or double ...
, a desktop environment for youth
primary education Primary education or elementary education is typically the first stage of formal education, coming after preschool/kindergarten and before secondary school. Primary education takes place in ''primary schools'', ''elementary schools'', or first ...
, which uses GTK, especially PyGTK * Phosh, a mobile UI designed for PureOS * LXDE (Lightweight X11 Desktop Environment) is based on GTK 2 * Unity, the former default desktop environment of Ubuntu


Inactive

* Access Linux Platform (successor of the Palm OS
PDA PDA may refer to: Science and technology * Patron-driven acquisition, a mechanism for libraries to purchase books *Personal digital assistant, a mobile device * Photodiode array, a type of detector * Polydiacetylenes, a family of conducting poly ...
platform) * Consort, the GNOME 3.4 Fallback Mode – fork from SolusOS *
GPE The external globus pallidus (GPe or lateral globus pallidus) combines with the internal globus pallidus (GPi) to form the globus pallidus, an anatomical subset of the basal ganglia. Globus pallidus means "pale globe" in Latin, indicating its appe ...
, the GPE Palmtop Environment * ROX Desktop, a lightweight desktop, with features from the GUI of RISC OS


Miscellaneous

GTK programs can be run on desktop environments based on X11 and Wayland, or window managers even those ''not'' made with GTK, provided the needed libraries are installed; this includes macOS if X11.app is installed. GTK can be also run on
Microsoft Windows Windows is a group of several proprietary graphical operating system families developed and marketed by Microsoft. Each family caters to a certain sector of the computing industry. For example, Windows NT for consumers, Windows Server for serv ...
, where it is used by some popular cross-platform applications like
Pidgin A pidgin , or pidgin language, is a grammatically simplified means of communication that develops between two or more groups of people that do not have a language in common: typically, its vocabulary and grammar are limited and often drawn from s ...
and GIMP. wxWidgets, a cross-platform GUI tool-kit, uses GTK on Linux by default. Other ports include DirectFB (used by the Debian installer, for example) and ncurses.


Window managers

The following window managers use GTK: * Aewm * AfterStep * Amaterus * Consortium * IceWM *
Marco Marco may refer to: People * Marco (given name), people with the given name Marco * Marco (actor) (born 1977), South Korean model and actor * Georg Marco (1863–1923), Romanian chess player of German origin * Tomás Marco (born 1942), Spanish c ...
* Metacity * Muffin * Mutter * Sawfish * Wmg * Xfwm


GtkSourceView

For syntax highlighting there is GtkSourceView, "source code editing widget". GtkSourceView is maintained by GNOME separately from GTK as a library
gtksourceview
There are plans to rename to gsv.


GtkSpell

GtkSpell is a library separate from GTK. GtkSpell depends on GTK and Enchant. Enchant is a wrapper for ispell, hunspell, etc., the actual
spell checker In software, a spell checker (or spelling checker or spell check) is a software feature that checks for misspellings in a text. Spell-checking features are often embedded in software or services, such as a word processor, email client, electronic di ...
engine/software. GtkSpell uses GTK's GtkTextView widget, to highlight misspelled words and offer replacement. *


Example

Documentation is available here: * The following code presents a graphical GTK hello-world program in the
C programming language ''The C Programming Language'' (sometimes termed ''K&R'', after its authors' initials) is a computer programming book written by Brian Kernighan and Dennis Ritchie, the latter of whom originally designed and implemented the language, as well as ...
. This program has a window with the title "Hello, world!" and a label with similar text. // helloworld.c #include /* Callback that will be called when the application is activated */ static void activate_callback(GApplication *app, gpointer user_data) int main (int argc, char *argv[]) Needs installing the libraries first in Debian or derivatives: $ sudo apt-get install libgtk-4-dev Using pkg-config in a Unix shell, this code can be compiled with the following command: $ cc -Wall $(pkg-config --cflags --libs gtk4) helloworld.c -o helloworld Invoke the program: $ ./helloworld


History


Linux

GTK was originally designed and used in the GNU Image Manipulation Program (GIMP) as a replacement of the
Motif Motif may refer to: General concepts * Motif (chess composition), an element of a move in the consideration of its purpose * Motif (folkloristics), a recurring element that creates recognizable patterns in folklore and folk-art traditions * Moti ...
toolkit; at some point Peter Mattis became disenchanted with Motif and began to write his own GUI toolkit named the GIMP toolkit and had successfully replaced Motif by the 0.60 release of GIMP. Finally GTK was re-written to be object-oriented and was renamed GTK+. This was first used in the 0.99 release of GIMP. GTK was subsequently adopted for maintenance by the GNOME Foundation, which uses it in the GNOME desktop environment. The GTK 2.0.0 release series introduced new features which include improved text rendering using Pango, a new theme engine, improved accessibility using the
Accessibility Toolkit Accessibility Toolkit (ATK) is an open source software library, part of the GNOME project, which provides application programming interfaces (APIs) for implementing accessibility support in software. One common nomenclature to explain an acce ...
, transition to Unicode using UTF-8 strings, and a more flexible API. Starting with version 2.8, GTK 2 depends on the Cairo graphics library for rendering vector graphics. GTK version 3.0.0 included revised input device handling, support for themes written with
CSS Cascading Style Sheets (CSS) is a style sheet language used for describing the presentation of a document written in a markup language such as HTML or XML (including XML dialects such as SVG, MathML or XHTML). CSS is a cornerstone techno ...
-like syntax, and the ability to receive information about other opened GTK applications. The '+' was dropped returning to simply 'GTK' in February 2019 during a
Hackathon A hackathon (also known as a hack day, hackfest, datathon or codefest; a portmanteau of hacking and marathon) is an event where people engage in rapid and collaborative engineering over a relatively short period of time such as 24 or 48 hours. Th ...
.


macOS

With Quartz-backend GTK is available in macOS.


Windows

* After GTK 2.24.10 and 3.6.4 Development of Windows with Installer was closed by Gnome. Installation of MSYS2 on Windows is a good way to use actual GTK. * GTK 2.24.10 and 3.6.4 is available in Internet, but very buggy and limited against actual versions. * A version for Windows 64-bit is prepared by Tom Schoonjans with 2.24.33 (actual like Linux) and 3.24.24 (actual like Linux) from January 2021 available. * Windows 10's Fall Creators Update includes Windows Subsystem for Linux (WSL). With Linux distributions like Ubuntu or Debian available from the Microsoft Store and an X server like Xming or VcXsvr, thousands of programs like GTK 2 or 3 can run with X or terminal support.


OpenVMS

HP stated that their goal was to merge the needed
OpenVMS OpenVMS, often referred to as just VMS, is a multi-user, multiprocessing and virtual memory-based operating system. It is designed to support time-sharing, batch processing, transaction processing and workstation applications. Customers using Ope ...
changes into the GTK Version 1.3 development stream, however this never materialised. The latest version of GTK for OpenVMS is version 1.2.10.


GTK 4

One of the cardinal novelties implemented during the GTK 4 development cycle (i.e. GTK 3.92, etc.) has been the delegation of functionality to ancillary objects instead of encoding it into the base classes provided by GTK. * the event handling from signal handlers described by GtkWidget is delegated to event controllers * the rendering is delegated to GtkSnapshot objects * the layout mechanism from GtkWidget is delegated to GtkLayoutManager In 2018-Jan-26 at
DevConf.cz DevConf.cz (Developer Conference) is an annual, free, Red Hat sponsored community conference for developers, admins, DevOps engineers, testers, documentation writers and other contributors to open source technologies. The conference includes topic ...
Matthias Clasen gave an overview of the then current state of GTK 4 development, including a high-level explanation of how rendering and input worked in GTK 3, what changes were being made to GTK 4, and the reasons for those changes. Examples of things that have become possible with GTK 4 were given as well.https://mclasen.fedorapeople.org/gtk4-devconf2018.pdf


Releases


See also

* Client-Side Decoration * List of widget toolkits * GDK – the GIMP Drawing Kit lies between the xlib and the GTK library, handling basic rendering such as drawing primitives, raster graphics (bitmaps), cursors, fonts, as well as window events and drag-and-drop functionality * gtkmm – C++ bindings for GTK * Qt – cross platform framework and toolkit * Xojo – cross-platform development tool and framework * Enlightenment Foundation Libraries (EFL) – widget toolkit written for the Enlightenment window manager * FLTK – a light, cross-platform, non-native widget toolkit * FOX toolkit – a fast, open source, cross-platform widget toolkit * IUP – a multi-platform toolkit for building native graphical user interfaces * Ultimate++ * Visual Component Library (VCL) * Vala – an object-oriented programming language with a self-hosting compiler that generates C code and uses the GObject system. * wxWidgets - a cross-platform GUI toolkit whose goal is to directly use each platform's native graphic API whenever possible.


References


Bibliography

* * *


External links

* {{DEFAULTSORT:Gtk+ Application programming interfaces Articles with example C code C (programming language) libraries Cross-platform software Free computer libraries Free software programmed in C GNOME Software that uses Cairo (graphics) Software that uses Meson Software using the LGPL license Widget toolkits X-based libraries