GTK+: History
Please note this is an old version of this entry, which may differ significantly from the current revision.
Contributor:

GTK+ (formerly GIMP Toolkit) is a cross-platform widget toolkit for creating graphical user interfaces. It is licensed under the terms of the GNU Lesser General Public License, allowing both free and proprietary software to use it. It is, along with Qt, one of the most popular tool-kits for the Wayland and X11 windowing systems.

  • cross-platform
  • toolkit
  • gimp

1. Software Architecture

 
Simplified software architecture of GTK+. Pango, GDK, ATK, GIO, Cairo and GLib. https://handwiki.org/wiki/index.php?curid=2062280
GDK contains back-ends to X11, Wayland, Broadway (HTTP), Quartz and GDI and relies on Cairo for the rendering. Its new SceneGraph is work-in-progress. https://handwiki.org/wiki/index.php?curid=2017364

The GTK+ library contains a set of graphical control elements (widgets), version 3.22.16 contains 186 active and 36 deprecated widgets.[1] GTK+ is an object-oriented widget toolkit written in the C programming language; it uses GObject, that is the GLib object system, for the object orientation. While GTK+ is primarily targeted at windowing systems based upon X11 and Wayland, it works on other platforms, including Microsoft Windows (interfaced with the Windows API), and macOS (interfaced with Quartz). There is also an HTML5 back-end called Broadway[2][3].

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 the majority of its graphical control elements.[4] Since GTK+ version 3.0, all the rendering is done using Cairo.

On 2018-Jan-26 at DevConf.cz 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.[5]

1.1. GIMP 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 directory.

1.2. 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 directory.

1.3. GtkInspector

GtkInspector has been introduced with version 3.14.[6][7] GtkInspector can only be invoked after installing the development package libgtk-3-dev/gtk+-devel.

1.4. GUI Designers

There are several GUI designers for GTK+. The following projects are active as of July 2011:

  • Glade, supports GtkBuilder, which is a GTK+ built-in GUI description format.
  • Gazpacho, GUI builder for the GTK+ toolkit written in Python[8]
  • Crow Designer, relies on its own GuiXml format and GuiLoader library.[9]
  • Stetic, part of MonoDevelop, oriented towards Gtk#.

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 WYSIWYG manner. The description of the user interface is independent from the programming language being used.

1.5. Language Bindings

A library written in one programming language may be used in another language if bindings are written; GTK+ has a range of bindings for various languages.[10]

Gtk#

Gtk# is a set of .NET bindings for the GTK+ GUI toolkit and assorted GNOME libraries. The library facilitates building graphical GNOME applications using Mono or any other compliant CLR. Gtk# is an event-driven system like any other modern windowing library where every widget allows you to associate handler methods, which get called when particular events happen.

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 the user to run the X11 server.[11]

Glade can be used with the Glade# bindings to easily design GUI applications. A GUI designer called Stetic is integrated with the MonoDevelop IDE.

In addition to support the standard GTK/GNOME stack of development tools, the gtk-dotnet.dll 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.

1.6. GtkSourceView

For syntax highlighting there is GtkSourceView, "source code editing widget".

GtkSourceView is maintained separately from GTK+ as a library: gtksourceview. There are plans to rename to gsv.

1.7. GtkSpell

GtkSpell is a distinct library separate to GTK+. GtkSpell depends on GTK+ and Enchant. Enchant is a wrapper for ispell, hunspell, etc, the actual spell checker engine/software. GtkSpell uses GTK's GtkTextView widget, to highlight misspelled words and offer replacement.

  • gtkspell.sourceforge.net

2. Development

GTK+ is mainly developed by The GNOME Project, which also develops the GNOME Development Platform and the GNOME Desktop Environment.[12]

GTK+ development is loosely managed. Discussion chiefly occurs on a number of public mailing lists.[13] GNOME developers and users gather at an annual GUADEC meeting to discuss the current state and the future direction of GNOME.[14] GNOME incorporates standards and programs from freedesktop.org to better interoperate with other desktops.

GTK+ is mainly written in C.[15] A number of language bindings are available.

2.1. Build Automation

In former times GTK+ (and GNOME, GLib, etc.) utilized the GNU Build System (called Autotools) as the build automation system of choice.

The Meson build system is being prepared to be used with GTK.[16]

2.2. Criticisms

The most common criticism towards GTK+ is a lack of backwards-compatibility in major updates, most notably in the API[17] and theming.[18]

The compatibility breaks between minor releases during the GTK+ 3.x development cycle has been 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 towards stability.[19] 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, co-developer of Subsurface and member of Intel's Open-Source Technology Center, criticized the GTK+ developers for being abrasive and ignoring most community requests.[20]
  • Hong Jen Yee, developer of LXDE, expressed disdain for version 3 of the GTK+ toolkit's radical API changes and increased memory usage, and ported PCManFM to Qt additionally. PCManFM is being developed with a GTK+ and with a Qt backend at the same time.[21]
  • The Audacious music player plans to move back to GTK+ version 2 starting with version 3.6, with the long-term goal of migrating to Qt.[22] 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-y and out of place."[23]
  • Wireshark has switched to Qt due to not having a good experience with GTK+'s cross-platform support.[24]

3. Usage

 
The GTK+ support for Wayland, co-requisites applications to be adapted to Wayland as well. https://handwiki.org/wiki/index.php?curid=2080655
 
Screenshot of GIMP 2.8 - GTK+ is responsible for managing the interface components of the program, including the menus, buttons, and input fields. https://handwiki.org/wiki/index.php?curid=1200975

3.1. Applications

Some notable applications that use or once used GTK+ as a widget toolkit include:

  • GNOME Core Applications – as part of GNOME desktop environment, developed in concert with GTK+ itself.
  • AbiWord – Word processor
  • Anjuta – Integrated development environment (IDE)
  • Ardour – Digital audio workstation
  • Chromium – Web browser (Until version 34, replaced by Aura in version 35+)
  • Ekiga (formerly GnomeMeeting) – VoIP and video conferencing application
  • GNU Emacs can use GTK when running under X.
  • Evolution – Personal information manager
  • gconfig – Linux kernel source configuration utility.
  • Geany – a lightweight cross-platform IDE and GTK+ text editor based on Scintilla.
  • GIMP – Raster graphics editor
  • Gnumeric – Spreadsheet application
  • Gramps – Genealogy software
  • Inkscape – Vector graphics editor for SVG
  • LiVES – Video editor
  • Midori – Minimalistic web browser using GTKWebKit as rendering engine and GTK+ as widget toolkit
  • Pidgin – Instant messenger application

3.2. Desktop Environments

Several desktop environments utilize GTK+ as the widget toolkit.

Current

  • GNOME, based on GTK+, meaning that programs native to GNOME use GTK+
  • Budgie, built from scratch for the SolusOS successor, Solus Operating System
    • Planning to port to and focus on Qt
  • Cinnamon, a fork of GNOME 3 and uses GTK+ version 3
  • MATE, a fork of GNOME 2, which has been updated to support GTK+ 3
  • Xfce, currently based on GTK+ 2 with support for and eventual plans for a migration to GTK+ 3
  • Pantheon uses GTK+ 3 exclusively, being developed by elementary OS
  • Sugar, a desktop environment oriented towards kids’ educations, which uses GTK+, especially PyGTK
  • KDE, though based on Qt, has integration with GTK+ written programs and themes since version 4.2

Inactive

  • Unity, the former default desktop environment of Ubuntu
  • LXDE (Lightweight X11 Desktop Environment) is based on GTK+ 2
  • Access Linux Platform (successor of the Palm OS PDA platform)
  • Consort, the GNOME 3.4 Fallback Mode – fork from SolusOS
  • GPE, the GPE Palmtop Environment
  • ROX Desktop, a lightweight desktop, with features from the GUI of RISC OS

Miscellaneous

GTK+ programs can be run on top of X11-based desktop environments or window managers even those not made with GTK+, provided the required libraries are installed; this includes macOS if X11.app is installed. GTK+ can be also run under Microsoft Windows, where it is used by some popular cross-platform applications like Pidgin and GIMP. wxWidgets, a cross-platform GUI tool-kit, uses GTK+ on Linux.[25] Other ports include DirectFB (used by the Debian installer, for example) and ncurses.[26]

3.3. Window Managers

The following window managers use GTK+:

  • Aewm
  • AfterStep
  • Amaterus
  • Consortium
  • IceWM
  • Marco
  • Metacity
  • Muffin
  • Mutter
  • Sawfish
  • Wmg
  • Xfwm

4. Example

Documentation is available here:

  • developer.gnome.org/gtk3/stable/

The following code presents a graphical GTK+ hello-world program in the C programming language. This program has a window with the title "Hello, world!" and a label with similar text.

// helloworld.c #include <gtk/gtk.h> int main (int argc, char *argv[]) { GtkWidget *window; GtkWidget *label; gtk_init(&argc, &argv); /* Create the main, top level window */ window = gtk_window_new(GTK_WINDOW_TOPLEVEL); /* Give it the title */ gtk_window_set_title(GTK_WINDOW(window), "Hello, world!"); /* Center the window */ gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER); /* Set the window's default size */ gtk_window_set_default_size(GTK_WINDOW(window), 200, 100); /* ** Map the destroy signal of the window to gtk_main_quit; ** When the window is about to be destroyed, we get a notification and ** stop the main GTK+ loop by returning 0 */ g_signal_connect(window, "destroy", G_CALLBACK(gtk_main_quit), NULL); /* ** Assign the variable "label" to a new GTK label, ** with the text "Hello, world!" */ label = gtk_label_new("Hello, world!"); /* Plot the label onto the main window */ gtk_container_add(GTK_CONTAINER(window), label); /* Make sure that everything, window and label, are visible */ gtk_widget_show_all(window); /* ** Start the main loop, and do nothing (block) until ** the application is closed */ gtk_main(); return 0; }

Needs installing the libraries first in debian or derivatives:

$ sudo apt-get install libgtk-3-dev

Using pkg-config in a Unix shell, this code can be compiled with the following command:

$ cc -Wall `pkg-config --cflags gtk+-3.0` -o helloworld helloworld.c `pkg-config --libs gtk+-3.0`

Invoke the program

$ ./helloworld

5. History

5.1. Linux Unix

GTK+ was originally designed and used in the GNU Image Manipulation Program (GIMP) as a replacement of the Motif toolkit; at some point Peter Mattis became disenchanted with Motif and began to write his own GUI toolkit called the GIMP toolkit and had successfully replaced Motif by the 0.60 release of GIMP.[27] Finally GTK was re-written to be object-oriented and was renamed GTK+.[28] 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, 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-like syntax, and the ability to receive information about other opened GTK+ applications.

5.2. macOS

With Quartz-Backend[29] GTK+ is available in macOS.[30]

5.3. 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+.[31]
  • GTK+ 2.24.10 and 3.6.4 is available in Internet, but very buggy and limited against actual versions.[32][33]
  • A Version for Windows 64-bit is prepared by Tom Schoonjans with 2.24.32 (actual like Linux) and 3.22.30 (actual like Linux) available.[34]
  • Windows 10 Fall Creators Edition have WSL (Windows Subsystem for Linux) on board. With Linux like Ubuntu or Debian from the App-Sore and a X-Server like Xming or VcXsvr thousands of Programs like GTK+ 2 or 3 are running with X-Server or Terminal support.

5.4. OpenVMS

HP stated that their goal was to merge the required OpenVMS changes into the GTK+ Version 1.3 development stream[35], however this never materialised. The latest version of GTK+ for OpenVMS is version 1.2.10.[36]

5.5. Releases

The GNOME team releases new versions on a regular basis.[56]

The content is sourced from: https://handwiki.org/wiki/Software:GTK%2B

References

  1. "GTK+ 3 Reference Manual". https://developer.gnome.org/gtk3/stable/. Retrieved 2017-07-15. 
  2. "Using GTK+ with Broadway". GNOME. https://developer.gnome.org/gtk3/stable/gtk-broadway.html. Retrieved 6 March 2018. 
  3. "Broadway - GitHub symbiose/symbiose Wiki". https://github.com/symbiose/symbiose/wiki/Broadway. Retrieved 6 March 2018. 
  4. "GTK+ to Use Cairo Vector Engine". http://developers.slashdot.org/article.pl?sid=05/02/04/2021236. Retrieved 2009-12-27. 
  5. "Matthias Clasen DevConf.cz 2018 talk about GTK+ 4". 2018-01-26. https://mclasen.fedorapeople.org/gtk4-devconf2018.pdf. 
  6. "Introducing GtkInspector". 2014-05-15. http://blogs.gnome.org/mclasen/2014/05/15/introducing-gtkinspector/. 
  7. "Another GtkInspector update". 2014-07-11. http://blogs.gnome.org/mclasen/2014/07/11/another-gtkinspector-update/. 
  8. "Gazpacho in Debian". https://packages.debian.org/gazpacho. 
  9. "nothing-personal - A development site for Crow Designer, GuiLoader and Rally - Google Project Hosting". http://nothing-personal.googlecode.com/. Retrieved 2014-02-17. 
  10. Team, The GTK+. "GTK+ Language Bindings". https://www.gtk.org/language-bindings.php. Retrieved 3 June 2017. 
  11. "Download [Gtk#"]. The GTK+ Project. http://download.xamarin.com/GTKforWindows/Windows/gtk-sharp-2.12.22.msi. 
  12. "GNOME Quick SWOT Analysis". The GNOME Project. https://wiki.gnome.org/Engagement/SWOT. Retrieved March 18, 2014. 
  13. "GTK+ and GNOME Mailing Lists". The GNOME Project. http://mail.gnome.org. Retrieved December 4, 2011. 
  14. "About". GUADEC. Archived from the original on October 4, 2011. https://web.archive.org/web/20111004061840/http://guadec.expectnation.com/public/content/about. Retrieved December 3, 2011. 
  15. "GNOME Languages". Black Duck Software. http://www.ohloh.net/p/gnome/analyses/latest/languages_summary. Retrieved May 22, 2014. 
  16. "Adaptation of Meson". https://git.gnome.org/browse/gtk+/log/?h=wip/baedert/meson. 
  17. "How Does One Create A Gtk+ Application? – Morten Welinder". http://blogs.gnome.org/mortenw/2014/06/23/how-does-one-create-a-gtk-application/. Retrieved 3 June 2017. 
  18. A GTK+ update, by mclasen, November 20, 2015, Goings on: https://blogs.gnome.org/mclasen/2015/11/20/a-gtk-update/
  19. "GUADEC2013: Benjamin Otte talks about GTK+". GUADEC. http://videos.guadec.org/2013/GTK%20to%20infinity%20and%20beyond/. 
  20. Larabel, Michael (2014-01-12). "The Biggest Problem With GTK & What Qt Does Good". Phoronix. https://www.phoronix.com/scan.php?page=news_item&px=MTU2ODM. Retrieved 2014-09-10. 
  21. Hong Jen Yee (2013-03-26). "PCManFM Qt 0.1.0 released". http://blog.lxde.org/?p=990. Retrieved 2014-09-10. 
  22. Web Upd8 (2014-06-23). "Audacious Going Back To GTK2 Starting With Version 3.6". http://www.webupd8.org/2014/06/audacious-going-back-to-gtk2-starting.html. Retrieved 2014-10-21. 
  23. Lindgren, John (2014-05-06). "Ugly window decorations and how to fix them (GTK+ 3.12)". http://redmine.audacious-media-player.org/boards/1/topics/1135. Retrieved 2014-10-21. 
  24. Gerald Combs (2013-10-15). "We’re switching to Qt.". https://blog.wireshark.org/2013/10/switching-to-qt/. Retrieved 2015-08-19. 
  25. "GTK+". WxWidgets Compared To Other Toolkits. http://www.wxwidgets.org/wiki/index.php/WxWidgets_Compared_To_Other_Toolkits#GTK.2B. 
  26. "GTK+ TTY Port". Slashdot. http://slashdot.org/article.pl?sid=03/08/26/2042206. Retrieved 2010-08-31. 
  27. "LinuxWorld - Where did Spencer Kimball and Peter Mattis go?". Archived from the original on April 17, 1999. https://web.archive.org/web/19990417052141/http://www.linuxworld.com/linuxworld/lw-1999-01/lw-01-gimp.html. Retrieved 2013-08-19. 
  28. "What is the + in GTK+?". 2011. Archived from the original on 2012-03-26. https://web.archive.org/web/20120326131857/http://developer.gnome.org/gtk-faq/stable/x90.html. Retrieved 2014-03-18. 
  29. https://wiki.gnome.org/Projects/GTK+/OSX
  30. https://www.gtk.org/download/macos.php
  31. https://www.gtk.org/download/windows.php
  32. https://sourceforge.net/projects/gtk-win/
  33. http://www.tarnyko.net/dl/gtk.htm
  34. https://github.com/tschoonj/GTK-for-Windows-Runtime-Environment-Installer
  35. http://h41379.www4.hpe.com/openvms/products/ips/gtk.html
  36. http://h41379.www4.hpe.com/openvms/products/ips/gtk_down.html
  37. "Gtk+ 3.0 Theming API Hackfest". http://aruiz.typepad.com/siliconisland/2009/02/gtk-30-theming.html. Retrieved 3 June 2017. 
  38. "Gtk+ 3 roadmap draft". http://testbit.eu/~timj/blogstuff/GtkRoadmap3Draft2.html. Retrieved 3 June 2017. 
  39. "Project Ridley". https://wiki.gnome.org/Attic/ProjectRidley. 
  40. "GdkFrameClock". https://developer.gnome.org/gdk3/stable/GdkFrameClock.html. 
  41. "GTK 3.12 introduced client-side decorations". https://blogs.gnome.org/mclasen/2013/12/05/client-side-decorations-in-themes/. 
  42. Matthias Clasen (2014-05-15). "GtkInspector Author's blog entry". http://blogs.gnome.org/mclasen/2014/05/15/introducing-gtkinspector/. Retrieved 2014-05-17. 
  43. "GtkInspector in GNOME wiki". 2014-05-15. https://wiki.gnome.org/Projects/GTK%2B/Inspector. Retrieved 2014-05-17. 
  44. "Merging gestures into 3.14". 2014-05-23. https://www.phoronix.com/scan.php?page=news_item&px=MTY5ODc. Retrieved 2014-05-23. 
  45. "RFC: gestures". 2014-03-04. https://mail.gnome.org/archives/gtk-devel-list/2014-March/msg00018.html. Retrieved 2014-05-23. 
  46. "gtk+ 3.13.2". 2014-05-27. https://mail.gnome.org/archives/ftp-release-list/2014-May/msg00119.html. 
  47. "gtk+ 3.13.3". 2014-06-24. https://mail.gnome.org/archives/ftp-release-list/2014-June/msg00075.html. 
  48. online, heise. "Linux-Desktop: Neues Gnome zeigt Nachrichten oben". http://www.heise.de/open/meldung/Linux-Desktop-Neues-Gnome-zeigt-Nachrichten-oben-2584020.html. Retrieved 3 June 2017. 
  49. "GTK+ 3.16.0 released". https://mail.gnome.org/archives/gnome-announce-list/2015-March/msg00029.html. Retrieved 3 June 2017. 
  50. "GTK+ 3.20 – Style Classes and Element Names". 2015-11-20. https://wiki.gnome.org/Projects/GTK%2B/StyleClasses. 
  51. error
  52. "GTK+ Wayland tablet support merged". https://blogs.gnome.org/carlosg/2016/04/06/gtk-wayland-tablet-support-is-merged/. 
  53. "libinput as of September 2016". https://www.x.org/wiki/Events/XDC2016/Program/hutterer_input/. 
  54. "Gtk 4.0 will not be stable until Gtk 4.6". 2016-06-13. https://blogs.gnome.org/desrt/2016/06/13/gtk-4-0-is-not-gtk-4/. 
  55. "Gtk 5.0 will not be stable until Gtk 5.6". 2016-06-14. https://blogs.gnome.org/desrt/2016/06/14/gtk-5-0-is-not-gtk-5/. 
  56. "GNOME Wiki: roadmap for GTK+". https://wiki.gnome.org/Projects/GTK+/Roadmap. 
  57. "gskvulkanrenderer.c". https://git.gnome.org/browse/gtk+/log/gsk/gskvulkanrenderer.c. 
  58. "GNOME 3.26 Released". 2017-09-13. https://www.gnome.org/news/2017/09/gnome-3-26-released/. 
  59. "gtk+ 3.94.0 released". 2018-06-26. https://mail.gnome.org/archives/ftp-release-list/2018-June/msg00073.html. 
More
This entry is offline, you can click here to edit this entry!
Video Production Service