gtk-rs / gtk4-rs

Rust bindings of GTK 4
https://gtk-rs.org/gtk4-rs/
MIT License
1.89k stars 174 forks source link

Expose `gdk-wayland` & `gdk-x11` with a feature flag #243

Closed bilelmoussaoui closed 3 years ago

bilelmoussaoui commented 3 years ago

It would be nice to be able to include both gdkx11 & gdkwayland directly into the re-exported crates from gtk if those features are enabled.

Of course, the features shouldn't be set by default.

It's mostly to avoid having to

gdk4wayland = {package = "gdk4-wayland", git = "https://github.com/gtk-rs/gtk4-rs", optional = true}
gdk4x11 = {package = "gdk4-x11", git = "https://github.com/gtk-rs/gtk4-rs", optional = true}
gtk4 = {git = "https://github.com/gtk-rs/gtk4-rs", optional = true}

and instead it should probably be

gtk4 = {git = "https://github.com/gtk-rs/gtk4-rs", optional = true, features = ["gdkx11", "gdkwayland"]}
sdroege commented 3 years ago

gtk4 = {git = "https://github.com/gtk-rs/gtk4-rs", optional = true, features = ["gdkx11", "gdkwayland"]}

Would that re-export nothing if no Wayland support is enabled in this GTK build or how would this work? Note that you can build GTK with only X11 or only Wayland support.

bilelmoussaoui commented 3 years ago

gtk4 = {git = "https://github.com/gtk-rs/gtk4-rs", optional = true, features = ["gdkx11", "gdkwayland"]}

Would that re-export nothing if no Wayland support is enabled in this GTK build or how would this work? Note that you can build GTK with only X11 or only Wayland support.

It's mostly to re-export gdk4-x11 & gdk4-wayland , instead of having to add them manually as dependencies. There are no checks to automatically include them because I don't believe that's a desired behaviour as they will pull both x11 & wayland specific crates.

bilelmoussaoui commented 3 years ago

See the linked PR, it's probably more explicit of what I had in mind

sdroege commented 3 years ago

I see. Doesn't seem like that much of a simplification but OK :)

But doesn't this introduce a circular dependency between gdk->gdkx11->gdk now?

bilelmoussaoui commented 3 years ago

But doesn't this introduce a circular dependency between gdk->gdkx11->gdk now?

Not at all, because those are gtk features and not gdk. This is mostly for the cases where you just use the exported crates from gtk and might need the wayland/x11 integration

sdroege commented 3 years ago

Oh yeah I missed that :) Seems good to me then