![]() |
We are upgrading our engine usage on Linux and FreeBSD from GTK 2 to GTK 3.
- Our installation instructions and scripts include now information to add GTK 3 packages. This is as simple as installing
libgtk-3-devpackage on Debian-based systems (including Ubuntu and Raspberry Pi). See the compiling from source for instructions for other distros. -
Our
TCastleWindowunder the hood uses now GTK 3 instead of GTK 2 (on Linux and FreeBSD). We have tested various features, likeAdvantages of GTK 3:
- We use new GTK library version, not under risk of deprecation/removal by distros.
-
It looks a bit more modern, e.g. message dialogs, since most of your other applications on GNOME probably already use GTK 3 (or 4) by now.
-
We use smooth scrolling, thanks to GTK 3 capabilities. This is nice when your device (like a touchpad) supports reporting very small (fractional) scrolling deltas, we can then use them for float operations (like zooming/moving). As a result you get really fine-grained ability to control the zoom/movement in e.g. our model viewer.
More information about GTK3 backend of TCastleWindow here.
-
You can switch back to GTK 2 by defining symbol
CASTLE_WINDOW_GTK_2when compiling your application. If you build from our build tool or editor, just add a section like this to the CastleEngineManifest.xml:CASTLE_WINDOW_GTK_2/define> /defines>
/compiler_options>
We don’t recommend this, as in our tests, GTK 3 backend is universally better:) But if you experience any regression, you can use this to quickly go back to GTK 2. And be sure to report a bug about GTK 3. The ability to switch back to GTK 2 will be removed at some point in the future.
-
Future goal: We want to ship our editor, an LCL application, using GTK 3 by switching the
LCLWidgetSettogtk3.But for now, this is not yet supported.
We’ve made some progress on our side, adjusting to some LCL GTK3 oddities, like this or this. On the Lazarus side, there’s also a lot of progress, even in last month (January 2026) — results of our testing change quickly for the better 🙂
Still some issues remain:
- OpenGL context initialized by
TOpenGLControlof GTK3 is weird, on my Linux resulting with older OpenGL version (than one we get withTCastleWindow, or withTOpenGLControlof GTK2). I need to investigate why. -
There are occasional crashes at exit, which we yet have to investigate.
-
Dialog
Executeseems to returntrueeven on cancelling.
Note that above applies to testing
mainGitLab branch (where GTK3 is no longer marked “alpha”). With latest Lazarus from the fixes_4 branch (wheregtk3widgetset is marked “alpha”) we have a few older issues visible, evidently fixed since then.So, we need more testing + fixing of the Lazarus LCL GTK 3 widgetset. Help is of course welcome.
In the meantime, if you have to move away from GTK 2, you can build our editor using the Qt5 widgetset. It works great now. We don’t want to do this for our downloads mainly because users then need to have
libqt5pasin a compatible version — incompatiblelibqt5paswill crash. We don’t want to introduce this risk for our binaries. - OpenGL context initialized by
