Skip to content

[gtk] add wayland support on linux#51039

Draft
feliwir wants to merge 1 commit into
microsoft:masterfrom
feliwir:gtk-wayland
Draft

[gtk] add wayland support on linux#51039
feliwir wants to merge 1 commit into
microsoft:masterfrom
feliwir:gtk-wayland

Conversation

@feliwir
Copy link
Copy Markdown
Contributor

@feliwir feliwir commented Apr 8, 2026

Fixes #51038

  • Changes comply with the maintainer guide.
  • SHA512s are updated for each updated download.
  • The "supports" clause reflects platforms that may be fixed by this new version, or no changes were necessary.
  • Any fixed CI baseline and CI feature baseline entries are removed from that file, or no entries needed to be changed.
  • All patch files in the port are applied and succeed.
  • The version database is fixed by rerunning ./vcpkg x-add-version --all and committing the result.
  • Exactly one version is added in each modified versions file.

@feliwir
Copy link
Copy Markdown
Contributor Author

feliwir commented Apr 8, 2026

@microsoft-github-policy-service agree

@feliwir
Copy link
Copy Markdown
Contributor Author

feliwir commented Apr 8, 2026

apparently the wayland version by the wayland distro in the CI is too old. What should be the fix here?

Comment thread ports/gtk/portfile.cmake
set(osx false)
if(VCPKG_TARGET_IS_LINUX)
set(OPTIONS -Dwayland-backend=false) # CI missing at least wayland-protocols
set(wayland true)
Copy link
Copy Markdown
Contributor

@AenBleidd AenBleidd Apr 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this should be always enabled by default? It is still possible to build GTK with X11 backend, and thus this port should give a possibility to do that, and not just hardcode Wayland for Linux

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, currently x11 is also hardcoded for linux. When enabling wayland that does not disable x11, it just enables both backends. So on a X11 desktop GTK would pick the x11 backend, on a wayland desktop the wayland backend (currently it quits there).

Ideally we'd want VCPKG features for the backend selection, but in general this port currently lacks any proper feature support. E.g. vulkan, opengl etc. should also be selectable.
To me it seemed like this is out of scope of this PR

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By this change you will force all applications to build (or install) Wayland even if they don't use it, so this is a breaking change. Also can you confirm that with Wayland backend application will switch to X11 when there is not Wayland support and what is more important will not require installing anything additional?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can confirm this since i've used Gtk (without VCPKG) for years. The automatic backend selection is the default behaviour unless explicitly set: https://docs.gtk.org/gtk4/running.html#gdk_backend

This port not having features forces a lot of restrictions. My distro has no X11 support, still this port forces me to build & compile the x11 backend.

If majority wants me to pull this out as a feature I'll do so, but then the other backends should be "optional" aswell

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And in this port you explicitly wet it to use Wayland. I do know that on Wayland X11 applications can run because Wayland provides a special mediator library.
I'm not sure this will work other way around when you build an application setting a Wayland backend that ill fall back to X11 if Wayland is not present.
To clarify: I'm ok to have Wayland a defaul backend, but there should be a possibility to configure this port to use some other backend.

If majority wants me to pull this out as a feature I'll do so, but then the other backends should be "optional" aswell

This is basically up to maintainers to decide.
However, the only 'other' backend is broadway, since macos is MacOs specific, and win32 is Windows specific.

Copy link
Copy Markdown
Member

@BillyONeal BillyONeal Apr 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are things I believe to be true:

There is some time where we would have had to change the backend we choose out of the box, and now that all of the major distros are done so, I think we should. I understand that is exceedingly unfortunate for @AenBleidd 's use case where vcpkg was building all of the X related libraries he needs, but given the GTK maintainer's statement linked above ( gtk-rs/gtk4-rs#1963 (comment) ) that seems like a strong statement that is not the expected user base from their perspective.

EDIT: But if even Ubuntu 22.04 "Noble"'s Wayland is too old we might have no good options?

To that end, I think we should change this to Wayland and/or both. portfile.cmake can have an option or something to make it easy for folks in @AenBleidd 's scenario to maintain an overlay port.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not happy with that but that's fair enough. My suggestion would be at least to announce it somewhere before merging that people are aware beforehand and not just awake in the morning to see all their builds failed not knowing what they need to do next to fix them all (I know about version pinning but let's be honest: it doesn't really work since you cannot fix a particular version of particular library without affecting other libraries).
Anyway, @BillyONeal, thank you for the detailed analysis and sorry for any possible mess.

Copy link
Copy Markdown
Contributor

@AenBleidd AenBleidd Apr 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@BillyONeal, a little piece of information for you.
When I last tried to build Wayland (like really build without system packages installed), it was failed due to broken ports (see my comment here).
Not sure how much this is relevant now but worth taking a look I support since you want to enforce Wayland.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess technically we could make them features and pick one with default-features. That might be slightly less painful for you but default features get forced on everywhere...

Copy link
Copy Markdown
Member

@BillyONeal BillyONeal Apr 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I last tried to build Wayland (like really build without system packages installed), it was failed due to broken ports (see my comment #49620 (comment)).

I agree that this is unfortunate but I think this entire "try to build X or Wayland yourself in vcpkg" scenario is a niche of a niche and that the majority of our Linux customers are going to want a GTK that works out of the box with their distro. (Which is consistent with our requiring a specific triplet variable to be turned on to make those ports do anything)

@feliwir feliwir requested a review from AenBleidd April 8, 2026 12:40
@vicroms vicroms added the requires:vcpkg-team-review This PR or issue requires someone on the vcpkg team to take a further look. label Apr 8, 2026
@BillyONeal
Copy link
Copy Markdown
Member

apparently the wayland version by the wayland distro in the CI is too old.

We are using Ubuntu 22.04 "Noble Numbat". Is that really too old or is it just that we didn't install something?

@feliwir
Copy link
Copy Markdown
Contributor Author

feliwir commented Apr 13, 2026

apparently the wayland version by the wayland distro in the CI is too old.

We are using Ubuntu 22.04 "Noble Numbat". Is that really too old or is it just that we didn't install something?

i am not really sure to be honest, that's why i did a PR updating wayland in in #51042
The log states that the installed version (1.22) is too low (>= 1.23.1)

@BillyONeal BillyONeal removed the requires:vcpkg-team-review This PR or issue requires someone on the vcpkg team to take a further look. label Apr 16, 2026
@BillyONeal
Copy link
Copy Markdown
Member

i am not really sure to be honest, that's why i did a PR updating wayland in in #51042

Our understanding with all these windowing components on *nix is that it is not usually desired or practical for users to build them themselves as

  1. windowing theming/styling/etc. is usually desired to match what the environment uses, and
  2. those bits can take a while to build and most customers don't expect vcpkg to provide them

If 24.04's Wayland is too old then while I broadly agree with the direction I think changing it entirely will have to wait for 26.04 "Resolute Raccoon" which hopefully has one new enough. That comes out later this month but it is likely to be a bit before we can adopt it as a few other big dependencies like CUDA have to update too.

In the meantime, please consider changing this to make Wayland an off by default feature, and X11 a default feature. (I understand that we said we discourage default features, and we still do, but the existence of an environment variable to select this makes it look like this just barely threads the "libarchive needle")

To that end it probably would be a good idea to audit all users of "gtk" and make sure they say "default-features": false on that dependency edge if that is applicable to them, but that isn't strictly necessary to land changes consistent with the plan above.

@BillyONeal BillyONeal marked this pull request as draft April 16, 2026 21:42
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

Successfully merging this pull request may close these issues.

[gtk] Missing wayland support?

4 participants