alr init --bin gtkada4_test
cd gtkada4_test
alr with gtkada4 --use=https://github.com/AdaCore/gtkada
Requested changes:
✓ gtkada4 ^27.0.0 (add)
Changes to dependency solution:
New solution is incomplete.
+📌 gtkada4 27.0.0 (new,path=alire/cache/pins/gtkada4,url=https://github.com/AdaCore/gtkada)
+📦 make 4.4.1 (new,indirect,system package)
+📦 pkg_config 2.5.1 (new,indirect,system package)
Missing:
+❗ libgtk4 >=4.22.2 (new,missing:unknown,indirect)
Do you want to proceed?
[Y] Yes [N] No (default is No)
At this point Alire will complain that libgtk4>=4.22 is not found. You should type Yes to proceed! Now you can build the crate:
I was able to build the crate and run the demo successfully on Fedora 44, with the minor deviation that the libepoxy development packages were also needed:
sudo dnf install gtk4-devel libepoxy-devel
alr init --bin gtk4ada_test
cd gtk4ada_test/
alr with gtkada4 --use=https://github.com/AdaCore/gtkada
alr build
...
✓ Build finished successfully in 89.59 seconds.
Thanks for the preview — first-day feedback (Debian forky/sid, GNAT FSF 16.1 via Alire, GTK 4.24.1). Good news first: the binding works really well. Built the crate fine, and a minimal GTK4 window (title + one Continue button) runs on Wayland exactly as expected.
Four remarks, all first-hand:
gtkada_demo still ships GTK3-era sources that cannot compile
About 30 demo files (create_main_loop.adb, …) still use Gtk.Main.Main, Main_Quit, Show_All, Widget_Handler.Connect — none of which exist in gtkada4. The build stays green because the rewritten gtkada_demo.adb (GApplication-based) no longer withes them, and gprbuild only compiles the main’s closure (100 .adb sources, 68 compiled). Confusing for anyone grepping the demo for API usage: it hands out GTK3 answers. Suggestion: delete those files or mark them clearly as “GTK3 archive, will not build”.
An application window must be created from activate — reproduced in pure C
Creating a Gtk_Application_Window in the main body, before Application.Run, segfaults in GTK 4.24.1 instance init (signal emission during init). I reproduced it identically from pure C (SIGSEGV, same g_object_new → type-instance-init chain), so it is GTK-side behaviour, not a GtkAda bug. Meanwhile gtk_main.ads still says Gtk.Main.Init is “usually not necessary” with GtkApplication, without mentioning the lifecycle rule; creating the window from the activate handler (or Gtk.Main.Init + a plain window) works. A word in the demo or docs would spare newcomers the GTK3-era pattern that segfaults.
No canonical “hello window” example Gtk.Main.Main is gone and GMainLoop is not bound, so the only documented event loop is Glib.Application.Run; the alternative pump (Glib.Main.Main_Context_Iteration) appears only in testsuite code. A minimal-window example would spare everyone the archaeology.
Accessibility notes
(testing a GUI-automation angle): GTK 4.24 defaults to AccessKit, so GTK_A11Y=atspi is needed to expose the tree on org.a11y.Bus; with it, roles/accessible names are correctly exposed and DoAction on a button works end to end. One wrinkle: the app registers on the bus as “Unnamed” despite a proper application id (org.guiverb.probe) — the frame carries the right name, the app node doesn’t. Screen readers care about that app-level name.
Happy to file the repro cases where you prefer (issues or here).
On my side, I’m interested in the accessibility architecture inside the kit for the needs of my current experimentation.
On Gtk3, you need the (now deprecated) ATK + an atk-bridge addon.
On Gtk4, accessibility is part of the widget itself, from the ground up, and AT-SPI is a native backend.
Cairo is not used by new rendering model. It can be used by application to create images, and these images can be passed to rendering model, however it is not recommended now.
MVC model was reimplemented too. I don’t have any experimental information related to performance of it.
PS. In Gtk+ 3, list store and tree store are not expected to manage significant amount of data. If application wants to manage hundreds of items, it can provide own implementation of tree model interface.