Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gtk 4.0 released! It's time to upgrade. #315

Open
zoujiaqing opened this issue Dec 17, 2020 · 13 comments
Open

Gtk 4.0 released! It's time to upgrade. #315

zoujiaqing opened this issue Dec 17, 2020 · 13 comments

Comments

@zoujiaqing
Copy link

https://blog.gtk.org/2020/12/17/who-wrote-gtk4/

@TheWeirdDev
Copy link

Yes, please provide the gtk4 bindings.

@adnan449
Copy link

I sincerely hope that D catches up! If I was an expert at GObject introspection, I would work on this for sure.

@MikeWey
Copy link
Member

MikeWey commented Jan 10, 2021

With commit 8617414 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.

@TheWeirdDev
Copy link

That's awesome. With a bit of tweaking, I was able to run a simple gtk4 application.

@Blquinn
Copy link

Blquinn commented Jan 20, 2021

@MikeWey Is there anything anyone can do to help?

@MikeWey
Copy link
Member

MikeWey commented Jan 21, 2021

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/.

@Blquinn
Copy link

Blquinn commented Jan 21, 2021

@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

  1. Some missing (perhaps intentionally removed) constructors in certain widgets.
  2. Breaking changes in the gtk api.

Here are my full notes, might be missing some stuff:

GtkD 3 -> 4 Discovered breaking changes.

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.

TreeModel

  1. getIter*() methods no longer return iters, instead have "out" parameters.

TreeView

  1. TreeViewCollumn(string title, CellRendererIF cellRenderer, string something, int column) ctor is missing. setTitle + addAttribute now used.

Menus

  1. MenuModel missing primary ctor MenuModel()

Frame

  1. Missing ctor(Widget framed, string title)

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

GStreamer

  1. DateTime has conflicting ctors

Peas

  1. Gtk.Menu -> GMenu
  2. GtkMenu -> GMenu*

Things that broke in the demo because of Gtk4 Deprecations

Gtk

  1. ColorSelectionDialog renamed to ColorChooserDialog
  2. FontSelectionDialog renamed to FontChooserDialog
  3. Dialogs are now fully async and do not have .run() methods as a result.
  4. Dialogs require window as second arg of ctors
  5. NoteBook.appendPage now requires Widget as second arg, instead of string.
  6. Window.showAll gone

Gdk

  1. GtkPoint gone

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.

@Blquinn
Copy link

Blquinn commented Jan 21, 2021

Created a PR so you can see what I changed... Lots of broken stuff at the moment #320

@MikeWey
Copy link
Member

MikeWey commented Jan 21, 2021

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.

MikeWey added a commit that referenced this issue Jan 22, 2021
@JeysonFlores
Copy link

It has been more than a year since this thread began, is there any improvements?

@ichordev
Copy link

Where's the progress on this up to? Is any help needed?

@yookoala
Copy link

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

@okias
Copy link

okias commented Jan 6, 2023

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 😞.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants