I'm pleased to announce a working GtkD port to Gtk-4 with the TestWindow demo. This is very much work in progress, but already in fairly good shape. The primary purpose of this post is to get feedback on the future direction of this work, especially since there apparently hasn't been much activity with this effort in a while and I'm not yet acquainted with the authors of this project.
Here is a link to the forked repo I created with some sparse details at the top of the README.md of how to get things built:
My intention is to help create a full featured gtk-4 binding for D, not simply get the demos to work. A lot of this work has already been done in the gtk4 branch of GtkD. However this effort is incomplete with significant issues with the API and non-working demos. These changes address many of the issues with the API and also result in an almost fully working TestWindow demo application.
- Make the D binding similar to the Python binding, which seems fairly clean and straightforward with respect to the C API and underlying Gir interface descriptions.
- Automatically generate as much of the binding as possible (prefer changes to gir-to-d utility over manual changes to API text files)
- Non-default object constructors (ones not simply called "new") should just be static object methods with no attempt to have multiple constructors differentiated only by the arguments. This was resulting in a lot of conflicts and hiding the purpose of the constructor. For example: What is now Button.newWithIconName("document-open") would have been attempted to wrap as new Button("document-open") but this would also conflict with the constructor for Button.newWithLabel("My label"), if only differentiating by argument types. This was worked around by creating custom non-standard constructors with arguments differentiating the purpose, increasing complexity and requiring a lot of additional manual binding customization.
- glib memory slices were being used for simple structure out parameters, which can be very problematic if the slices are not freed through the slice subsystem. Just using malloc/free instead for now.
- The generated D source files have been removed from the repo. This will be replaced with a consistent way to fetch specific versions of the relevant gir API interface files and a specific version of the gir-to-d utility sub-module in wrap/.
I'm working on a port of a GTK3 C application to GTK4 and D, so that will likely drive additional improvements as I come across issues.
I welcome any comments, questions, or other input on this GtkD GTK4 binding development effort.