Open zoujiaqing opened 3 years ago
Yes, please provide the gtk4 bindings.
I sincerely hope that D catches up! If I was an expert at GObject introspection, I would work on this for sure.
With commit 86174147fce10bd9caf92285709b6a27afc0e2c2 the gtk4 branch of GtkD compiles.
I don't know if the compiled library works and the demos need to be updated.
Still a work in progress.
That's awesome. With a bit of tweaking, I was able to run a simple gtk4 application.
@MikeWey Is there anything anyone can do to help?
I'm currently "slowly" updating the demos to Gtk4 mostly to see if any issues with the generated binding show up.
It would help if someone could work on updating some of the demos and reporting/fixing the issues that surface.
I'm currently working on the two remaining in demos/gtk/.
@MikeWey Funny you mention that because I started working through the TestWindow demo, it's compiling now, but I'm not sure if I have time to work through the runtime errors. There's a lot of breakage there, but luckily it seems to be relegated to
Here are my full notes, might be missing some stuff:
MenuModel()
Many things that seemed to previously take things convertible to a gtk.Value, now require you to wrap them in a gtk.Value. gtk.TreeStore .setValue for example now requires a gtk.Value, and won't accept a string.
Created a PR so you can see what I changed... Lots of broken stuff at the moment https://github.com/gtkd-developers/GtkD/pull/320
The gtk3 binding still had a lot of thing manually tweaked to be compatible with an older generator that used the HTML documentation as a basis. So when switching to gtk4 i started with a blank slate, and because of that some/a lot of convenience functions may need to re added.
Things that I think might have broken in gir-to-d code gen.
Dialogs
1. FileChooserDialog(string title, Window win, FileChooserAction action) ctor missing. 2. FileChooserDialog() ctor missing. 3. MessageDialog() ctor missing.
Missing because gir-to-d currently doesn't handle variadics, need to be added manually.
TreeModel
1. getIter*() methods no longer return iters, instead have "out" parameters.
The old one also doesn't return the iter, marking it as out is correct.
TreeView
1. TreeViewCollumn(string title, CellRendererIF cellRenderer, string something, int column) ctor is missing. setTitle + addAttribute now used.
Same issue as the dialogs.
Menus
1. MenuModel missing primary ctor `MenuModel()`
On the GIO side MenuModel is an abstract class, so it is correct that it doesn't have a constructor. We could investigate attributing them as 'abstract' on the D side, that would require a solution similar to the one for interfaces to be able to return the abstract class from a wrapper function.
Frame
1. Missing ctor(Widget framed, string title)
Was a manually added convenance function, may need to be re added.
Button
1. Button.fromIconName(string iconName) static function missing 2. Button.withLabel(string label) static function missing 3. Button(string label, delegate onClicked) convenience ctor missing
These also will probably need to be re added, a more general solution for duplicate constructors in gir-to-d would be best.
GStreamer
1. DateTime has conflicting ctors
One of them will need to be replaced with a static function.
Peas
1. Gtk.Menu -> GMenu 2. GtkMenu -> GMenu*
Peas may depend on gtk3 GtkMenu / gtk.Menu was replaced by the gio menu model/classes with gtk4.
Things I'm not really sure what's going on
Many things that seemed to previously take things convertible to a gtk.Value, now require you to wrap them in a gtk.Value. gtk.TreeStore .setValue for example now requires a gtk.Value, and won't accept a string.
Probably a lot of convenience functions that are now missing.
It has been more than a year since this thread began, is there any improvements?
Where's the progress on this up to? Is any help needed?
Posted this issue on BountySource. If you want to see this issue resolved, please help and contribute to the bounty: https://app.bountysource.com/issues/95837122-gtk-4-0-released-it-s-time-to-upgrade
At least for Tilix, I would love to see this, but I'm afraid that interest in D is pretty low to make this happen :disappointed:.
https://blog.gtk.org/2020/12/17/who-wrote-gtk4/