GTK is a multi-platform toolkit for creating graphical user interfaces.
Go to file
Christian Hergert ccac404f28 widget: fix class private data usage to be _init() safe
Before this commit, adding GtkWidgetAction to class private data would
require copying the actions to each subclass as they were built or
modified. This was convenient in that it is a sort of "copy on write"
semantic.

However, due to the way that GTypeInstance works with base _init()
functions, the "g_class" pointer in GTypeInstance is updated as each
_init() function is called. That means you cannot access the subclasses
class private data, but only the parent class private data.

If instead we use a singly linked list of GtkWidgetAction, each subclass
has their own "head" yet all subclasses share the tail of the
GtkWidgetAction chain.

This creates one bit of complexity though. You need a stable way to know
which "bit" is the "enabled" bit of the action so we can track enabled
GAction state. That is easily solved by calculating the distance to the
end of the chain for a given action so that base classes sort ahead of
subclasses. Since the parent class always knows its parent's actions, the
position is stable.

A new dynamic bitarray helper also helps us avoid allocations in all the
current cases (up to 64 actions per widget) and dynamically switches to
malloc if that is to ever be exceeded.
2020-03-20 11:17:56 -07:00
.gitlab/issue_templates
.gitlab-ci ci: Add dbus-launch to the Docker build 2020-03-20 15:36:39 +00:00
build-aux flatpak: Build against the master runtime 2020-02-07 09:17:51 -05:00
demos Revert "Merge branch 'disable-window-test' into 'master'" 2020-03-19 18:03:16 -04:00
docs Revert "Merge branch 'disable-window-test' into 'master'" 2020-03-19 18:03:16 -04:00
examples examples: Add common_cflags to build 2020-03-06 16:36:42 +01:00
gdk Revert "Merge branch 'disable-window-test' into 'master'" 2020-03-19 18:03:16 -04:00
gsk gsk: Don't unconditionally spew to stdout 2020-03-20 10:43:25 -04:00
gtk widget: fix class private data usage to be _init() safe 2020-03-20 11:17:56 -07:00
modules
po Revert "Merge branch 'disable-window-test' into 'master'" 2020-03-19 18:03:16 -04:00
po-properties Revert "Merge branch 'disable-window-test' into 'master'" 2020-03-19 18:03:16 -04:00
subprojects build: require sassc and drop generated .css files 2020-01-30 20:45:38 +01:00
tests Revert "Merge branch 'disable-window-test' into 'master'" 2020-03-19 18:03:16 -04:00
testsuite widget: fix class private data usage to be _init() safe 2020-03-20 11:17:56 -07:00
.clang-format ci: Add a style check pass 2020-02-11 14:47:22 +00:00
.gitignore
.gitlab-ci.yml ci: Add dbus-launch to the Docker build 2020-03-20 15:36:39 +00:00
AUTHORS
config.h.meson
CONTRIBUTING.md
COPYING
gtk4-unix-print.pc.in
gtk4.pc.in
gtk64.supp Add a lib64 variant of gtk.supp 2020-02-05 06:28:39 -05:00
gtk.doap
gtk.supp
make-pot
meson_options.txt
meson.build build: Add -Wno-typedef-redefinition to build 2020-03-12 08:32:34 +01:00
NEWS NEWS: Updates 2020-03-14 00:59:16 -04:00
NEWS.pre-1.0
NEWS.pre-2.0
NEWS.pre-3.0
README.md

GTK — The GTK toolkit

Build Status

General information

GTK is a multi-platform toolkit for creating graphical user interfaces. Offering a complete set of widgets, GTK is suitable for projects ranging from small one-off projects to complete application suites.

GTK is free software and part of the GNU Project. However, the licensing terms for GTK, the GNU LGPL, allow it to be used by all developers, including those developing proprietary software, without any license fees or royalties.

The official download location

The official web site

The official developers blog

Information about mailing lists can be found at

Nightly documentation can be found at

Building and installing

In order to build GTK you will need:

You will also need various dependencies, based on the platform you are building for:

If you are building the X11 backend, you will also need:

  • Xlib, and the following X extensions:
    • xrandr
    • xrender
    • xi
    • xext
    • xfixes
    • xcursor
    • xdamage
    • xcomposite
  • atk-bridge-2.0

If you are building the Wayland backend, you will also need:

  • Wayland-client
  • Wayland-protocols
  • Wayland-cursor
  • Wayland-EGL

Once you have all the necessary dependencies, you can build GTK by using Meson:

$ meson _build .
$ cd _build
$ ninja

You can run the test suite using:

$ meson test

And, finally, you can install GTK using:

$ sudo ninja install

Complete information about installing GTK+ and related libraries can be found in the file:

docs/reference/gtk/html/gtk-building.html

Or online

How to report bugs

Bugs should be reported on the issues page.

In the bug report please include:

  • Information about your system. For instance:

    • which version of GTK you are using
    • what operating system and version
    • for Linux, which distribution
    • if you built GTK, the list of options used to configure the build

    And anything else you think is relevant.

  • How to reproduce the bug.

    If you can reproduce it with one of the demo applications that are built in the demos/ subdirectory, on one of the test programs that are built in the tests/ subdirectory, that will be most convenient. Otherwise, please include a short test program that exhibits the behavior. As a last resort, you can also provide a pointer to a larger piece of software that can be downloaded.

  • If the bug was a crash, the exact text that was printed out when the crash occurred.

  • Further information such as stack traces may be useful, but is not necessary.

Release notes

The release notes for GTK are part of the migration guide in the API reference. See:

Licensing terms

GTK is released under the terms of the GNU Lesser General Public License, version 2.1 or, at your option, any later version, as published by the Free Software Foundation.

Please, see the COPYING file for further information.