GTK+
GTK+
GTK+ logo.svg
gtk3-widget-factory, is a collection of examples demonstrating many of the GUI widgets in GTK+ version 3
gtk3-widget-factory, is a collection of examples demonstrating many of the GUI widgets in GTK+ version 3
Original author(s) Spencer Kimball, Peter Mattis, eXperimental Computing Facility (XCF)
Developer(s) The GNOME Project
Initial release April 14, 1998; 20 years ago (1998-04-14)
Stable release 3.22.30 (April 16, 2018; 3 months ago (2018-04-16)[1])
Preview release 3.94 / 3.23.0
(June 28, 2018; 20 days ago (2018-06-28)
June 21, 2018; 27 days ago (2018-06-21))
Repository Edit this at Wikidata
Written in C[2]
Operating system Linux, Unix-like, macOS, Windows
Type Widget toolkit
License LGPL version 2.1
Website gtk.org

GTK+ (formerly GIMP Toolkit) is a cross-platform widget toolkit for creating graphical user interfaces.[3] 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.[4]

Software architecture

Simplified software architecture of GTK+. Pango, GDK, ATK, GIO, Cairo and GLib
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.

The GTK+ library contains a set of graphical control elements (widgets), version 3.22.16 contains 186 active and 36 deprecated widgets.[5] 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[6][7].

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.[8] 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.[9]

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.

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.

GtkInspector

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

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[12]
  • Crow Designer, relies on its own GuiXml format and GuiLoader library.[13]
  • 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.

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.[14]

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.[17]

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.

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.

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.

Development

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

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

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

On September 1, 2016 a post on the GTK development blog denoted, among other things, the future numbering scheme of GTK+.[22] GTK+ version 3.22 from autumn 2016 shall be the last 3.x release. After that all resources will flow into the GTK+ 4 development series with the version names 3.90, 3.92, etc. Even as the 4.x series enters development, notable applications still use GTK+ 2.x and have not been ported to 3.22. Regarding the future of legacy software using GTK+, there is no collective project to port GTK+ 2.x software to 3.22.

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.[23]

Criticisms

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

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.[26] 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.[27]
  • 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.[28]
  • 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.[29] 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."[30]
  • Wireshark has switched to Qt due to not having a good experience with GTK+'s cross-platform support.[31]

Usage

The GTK+ support for Wayland, co-requisites applications to be adapted to Wayland as well
Screenshot of GIMP 2.8 - GTK+ is responsible for managing the interface components of the program, including the menus, buttons, and input fields.

Applications

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

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

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.[32] Other ports include DirectFB (used by the Debian installer, for example) and ncurses.[33]

Window managers

The following window managers use GTK+:

Example

Documentation is available here:

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

History

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.[34] Finally GTK was re-written to be object-oriented and was renamed GTK+.[35] 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.

macOS

With Quartz-Backend[36] GTK+ is available in macOS.[37]


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+.[38]
  • GTK+ 2.24.10 and 3.6.4 is available in Internet.[39][40]
  • A Version for Windows 64-bit is prepared by Tom Schoonjans with 2.24.32 (actual like Linux) and 3.22.28 available.[41]
  • 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.

OpenVMS

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

Releases

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

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)

References

  1. ^ https://github.com/GNOME/gtk/releases/tag/3.22.30
  2. ^ "The GTK+ Open Source Project on Ohloh". Ohloh.net. Retrieved . 
  3. ^ The GTK+ Team. "GTK+ Features". Retrieved 2014. 
  4. ^ "Developing X applications". 
  5. ^ "GTK+ 3 Reference Manual". Retrieved . 
  6. ^ "Using GTK+ with Broadway". GNOME Developer. GNOME. Retrieved 2018. 
  7. ^ "Broadway - GitHub symbiose/symbiose Wiki". GitHub. Retrieved 2018. 
  8. ^ "GTK+ to Use Cairo Vector Engine". Retrieved . 
  9. ^ "Matthias Clasen DevConf.cz 2018 talk about GTK+ 4" (PDF). 2018-01-26. 
  10. ^ "Introducing GtkInspector". 2014-05-15. 
  11. ^ "Another GtkInspector update". 2014-07-11. 
  12. ^ "Gazpacho in Debian". 
  13. ^ "nothing-personal - A development site for Crow Designer, GuiLoader and Rally - Google Project Hosting". Retrieved . 
  14. ^ Team, The GTK+. "GTK+ Language Bindings". www.gtk.org. Retrieved 2017. 
  15. ^ "Release 2.12.41". 
  16. ^ "Release 2.99.3". 
  17. ^ "Download [Gtk#]". The GTK+ Project. 
  18. ^ "GNOME Quick SWOT Analysis". The GNOME Project. Retrieved 2014. 
  19. ^ "GTK+ and GNOME Mailing Lists". The GNOME Project. Retrieved 2011. 
  20. ^ "About". GUADEC. Archived from the original on October 4, 2011. Retrieved 2011. 
  21. ^ "GNOME Languages". Ohloh. Black Duck Software. Retrieved 2014. 
  22. ^ a b "Versioning and long term stability promise in GTK+". GTK development blog. 2016-09-01. 
  23. ^ "Adaptation of Meson". 
  24. ^ "How Does One Create A Gtk+ Application? - Morten Welinder". blogs.gnome.org. Retrieved 2017. 
  25. ^ A GTK+ update, by mclasen, November 20, 2015, Goings on:
  26. ^ a b "GUADEC2013: Benjamin Otte talks about GTK+". GUADEC. 
  27. ^ Larabel, Michael (2014-01-12). "The Biggest Problem With GTK & What Qt Does Good". Phoronix. Retrieved . 
  28. ^ Hong Jen Yee (2013-03-26). "PCManFM Qt 0.1.0 released". Retrieved . 
  29. ^ Web Upd8 (2014-06-23). "Audacious Going Back To GTK2 Starting With Version 3.6". Retrieved . 
  30. ^ Lindgren, John (2014-05-06). "Ugly window decorations and how to fix them (GTK+ 3.12)". Retrieved . 
  31. ^ Gerald Combs (2013-10-15). "We're switching to Qt". Retrieved . 
  32. ^ "GTK+". WxWidgets Compared To Other Toolkits. 
  33. ^ "GTK+ TTY Port". Slashdot. Retrieved . 
  34. ^ "LinuxWorld - Where did Spencer Kimball and Peter Mattis go?". Archived from the original on April 17, 1999. Retrieved . 
  35. ^ "What is the + in GTK+?". 2011. Archived from the original on 2012-03-26. Retrieved . 
  36. ^ https://wiki.gnome.org/Projects/GTK+/OSX
  37. ^ https://www.gtk.org/download/macos.php
  38. ^ https://www.gtk.org/download/windows.php
  39. ^ https://sourceforge.net/projects/gtk-win/
  40. ^ http://www.tarnyko.net/dl/gtk.htm
  41. ^ https://github.com/tschoonj/GTK-for-Windows-Runtime-Environment-Installer
  42. ^ http://h41379.www4.hpe.com/openvms/products/ips/gtk.html
  43. ^ http://h41379.www4.hpe.com/openvms/products/ips/gtk_down.html
  44. ^ "Gtk+ 3.0 Theming API Hackfest". Silicon Island. Retrieved 2017. 
  45. ^ "Gtk+ 3 roadmap draft". Retrieved 2017. 
  46. ^ "Project Ridley". 
  47. ^ "GdkFrameClock". 
  48. ^ "GTK 3.12 introduced client-side decorations". 
  49. ^ Matthias Clasen (2014-05-15). "GtkInspector Author's blog entry". Retrieved . 
  50. ^ "GtkInspector in GNOME wiki". 2014-05-15. Retrieved . 
  51. ^ "Merging gestures into 3.14". 2014-05-23. Retrieved . 
  52. ^ "RFC: gestures". 2014-03-04. Retrieved . 
  53. ^ "gtk+ 3.13.2". 2014-05-27. 
  54. ^ "gtk+ 3.13.3". 2014-06-24. 
  55. ^ online, heise. "Linux-Desktop: Neues Gnome zeigt Nachrichten oben". heise online. Retrieved 2017. 
  56. ^ "GTK+ 3.16.0 released". mail.gnome.org. Retrieved 2017. 
  57. ^ "GTK+ 3.20 - Style Classes and Element Names". 2015-11-20. 
  58. ^ "GTK+ Wayland tablet support merged". 
  59. ^ "libinput as of September 2016". 
  60. ^ a b "Gtk 4.0 will not be stable until Gtk 4.6". 2016-06-13. 
  61. ^ a b "Gtk 5.0 will not be stable until Gtk 5.6". 2016-06-14. 
  62. ^ a b "GNOME Wiki: roadmap for GTK+". 
  63. ^ "gskvulkanrenderer.c". 
  64. ^ "GNOME 3.26 Released". 2017-09-13. 
  65. ^ "gtk+ 3.94.0 released". 2018-06-26. 

Bibliography

External links


  This article uses material from the Wikipedia page available here. It is released under the Creative Commons Attribution-Share-Alike License 3.0.

GTK%2B
 



 

Connect with defaultLogic
What We've Done
Led Digital Marketing Efforts of Top 500 e-Retailers.
Worked with Top Brands at Leading Agencies.
Successfully Managed Over $50 million in Digital Ad Spend.
Developed Strategies and Processes that Enabled Brands to Grow During an Economic Downturn.
Taught Advanced Internet Marketing Strategies at the graduate level.


Manage research, learning and skills at defaultLogic. Create an account using LinkedIn or facebook to manage and organize your Digital Marketing and Technology knowledge. defaultLogic works like a shopping cart for information -- helping you to save, discuss and share.

Visit defaultLogic's partner sites below:
PopFlock.com : Music Genres | Musicians | Musical Instruments | Music Industry
NCR Works : Retail Banking | Restaurant Industry | Retail Industry | Hospitality Industry

  Contact Us