Skip to content

Goodbye GTK+ 2, Hello GTK+ 3

With the release of Xojo 2017 Release 2 we have updated our Linux Desktop framework to use GTK+ 3 instead of GTK+ 2. For those not familiar with Linux, GTK+ is a User Interface (i.e. UI) toolkit, much like Cocoa is for macOS and Win32 controls (or WinForms.NET or WPF) is for Windows. GTK+ 2 has been supplying the user interface for Xojo Desktop apps for Linux since we first targeted Linux over a decade ago. It has since been deprecated in favor of GTK+ 3 for quite some time now and GTK+ 2 is typically not installed by default on most Linux distros these days, which makes deploying Xojo Desktop apps on Linux more painful. Unfortunately GTK+ 3 is not ABI compatible with GTK+ 2 so we could not migrate to using GTK+ 3 without completely ditching GTK+ 2.

Let’s take a closer look at what this means for your Linux apps:

Target 2017r1.1 (and prior) requirements 2017r2 requirements
Linux console/web apps Ubuntu 10.04, CentOS 6.0, etc. No change
Linux (x86, x86-64) Desktop apps Ubuntu 10.04, CentOS 6.0, etc.

  • GTK+ 2.20
  • libwebkitgtk-1.0.0 (for HTMLViewer)
Ubuntu 12.04, CentOS 7.0, etc.

  • GTK+ 3.4.1
  • libwebkitgtk-3.0.0 (for HTMLViewer)
Linux Pi (ARM) Desktop apps Raspian Wheezy

  • GTK+ 2.20
Raspian Wheezy (no change)

  • GTK+ 3.4.1

Besides the benefit of not having to tell your end users to install GTK+ 2 on their particular Linux distro, here are some other notable items affected by the GTK+ 3 transition:

Feature GTK+ 2 GTK+ 3
HiDPI
  • No inherent scaling
  • Scales automatically on integral scale factors (i.e. 1x, 2x, 3x, etc.)
Controls
  • Child controls do not clip on a transparent parent control (like a Canvas)
  • Child controls properly clip on all parent controls
  • Default control sizes have generally increased, depending on theme/distro
  • Ability to style controls using CSS, for example:
    In ~/config/gtk-3.0/gtk.cssGtkButton {
    padding: 1px;
    }
TextField
  • Border can be removed
  • Depending on GTK+ 3 version the border cannot be removed (i.e. Ubuntu 12.04 yes, Ubuntu 15.10 no)

While there’s a short list of actual differences, there have been numerous changes underneath made during this transition. For example, features that we had to custom code because GTK+ 2 did not offer them but GTK+ 3 did. Updating to GTK+ 3 is the final piece to our cross-platform HiDPI support for Desktop apps. Until the day comes when we have to say goodbye to GTK+ 3 (GTK+ 4 is already in the works), we welcome its inclusion in Xojo with a long overdue “Hello”!