-
Notifications
You must be signed in to change notification settings - Fork 7.5k
[gtk] add wayland support on linux #51039
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
Open
feliwir
wants to merge
1
commit into
microsoft:master
Choose a base branch
from
feliwir:gtk-wayland
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+8
−2
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
This is basically up to maintainers to decide.
However, the only 'other' backend is
broadway, sincemacosis MacOs specific, andwin32is Windows specific.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I double checked the documentation. This is true, but still this adds a hard dependency on Wayland libraries during the build, and this might be not desired. I do see that the backend options should be configurable (for Linux) with the X11 set as a default.
@vicroms, @BillyONeal, it would be nice if you could take a look at this.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that the default should be that all available backends are compiled in.
The Gtk version we currently build with this port is a "crippled" version of the default Gtk. Preferably the built binaries should have similar / more features than the Gtk shipped with the OS / distro.
See this quote of a Gtk maintainer: gtk-rs/gtk4-rs#1963 (comment)
I think we should try to become a solid choice for Gtk users and that the Gtk team actually approves our effort / port being used
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This "default' means that all the port users that were previously build it with x11 libraries only will need to build it now with wayland as well.
Personally I prefer to have a choice which libraries I would like to build and don't blow up my build pipeline with unneded dependencies (don't forget, that not all people build ports with the system libraries included, some prefer to have a pure static builds (and vcpkg by default builds static libraries for Linux unless *-dynamic port is selected)) with the controlled dependencies, not just with everything that comes with the distro).
This is a little bit more complicated that you think since there are a lot of users of vcpkg with very different scenarious, and as a package manager it should give a choice to the users and not just promote some particular way of building a library.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with you that features would be sweet, the question is just if this is in scope of this PR.
To have all Gtk build options represented as features would require us to add more than 10+ features probably (e.g. the renderer choice etc.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't need to do anything in one PR. You can start with backend options and add other features later.
I mean, if you do this change now, it will be visible immediately (ok, for the majority of users after the next monthly release), and at that point it will be too late to improve something since the only option will be the rollback.
Regarding the other features, if would be nice to have them if they are required.