Skip to content

feat(linux): port to gtk4#1258

Open
johncarmack1984 wants to merge 10 commits into
tauri-apps:devfrom
johncarmack1984:gtk4
Open

feat(linux): port to gtk4#1258
johncarmack1984 wants to merge 10 commits into
tauri-apps:devfrom
johncarmack1984:gtk4

Conversation

@johncarmack1984

@johncarmack1984 johncarmack1984 commented Jul 3, 2026

Copy link
Copy Markdown

Closes #1051. Supersedes #1104. This takes @conradhale's GTK4 port and @rmakestrash-jpg's continuation of it (rebase to 0.34.5, the optional libadwaita feature, the gtk::init ordering fix, plus @aurelj's no-x11 compile fix), merges everything onto current dev, and bumps the stack to gtk4-rs 0.11 / glib 0.22. Their commits carry their authorship in the branch history; my work is the forward merge, the 0.11 bump, and CI.

Discussed in tauri-apps/wry#1474. gtk4 0.11 here matches @Ranrar's wry gtk4/webkit6 branch, so the two can land as a coherent pair.

What the forward merge had to reconcile, so nobody has to re-derive it in review:

Breaking, beyond the obvious type swap: public gtk types in the Unix extension traits are gtk4 0.11 types; the x11 feature is backed by gdk4-x11; new optional libadwaita feature; MSRV rises to 1.92, gtk4-rs 0.11's floor. The MSRV bump is crate-wide, not Linux-only, and it's the one call here I most want maintainer eyes on.

Verified: cargo check --all-features, clippy --all-targets (lib clean; the two remaining lints are in examples unchanged from dev), and cargo test, on rust 1.96 / Debian trixie / GTK 4.18. Both things this draft was waiting on have since happened: tauri itself builds against this branch (wry on webkit6, muda on gtk4), and a real Tauri app runs on it under X11 -- window creation, the event loop, and keyboard input all through this port. The menu in this capture was opened by key events going through the gtk4 event controllers:

a Tauri app running on this tao branch

Wayland session time is what's left.

@socket-security

socket-security Bot commented Jul 3, 2026

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedasync-channel@​2.5.010010093100100
Addedgdk4-wayland@​0.11.410010093100100
Addedgdk4-x11@​0.11.410010093100100
Addedgtk4@​0.11.410010093100100
Addedlibadwaita@​0.9.110010093100100
Updatedbitflags@​2.7.0 ⏵ 2.13.010010093100100

View full report

@amrbashir

Copy link
Copy Markdown
Member

Thanks for the PR but I should let you know that I am working on alternative that uses current winit code base at https://github.com/tauri-apps/winit-gtk4/tree/amr/feat/gtk4

I don't know yet but there is a good chance will be using winit-gtk4 instead of porting tao to gtk4

@johncarmack1984

johncarmack1984 commented Jul 3, 2026

Copy link
Copy Markdown
Author

winit-gtk4 on the winit codebase makes sense to me. If that's the direction, happy to help over there instead. point me at what needs doing. No attachment to this specific PR; whatever transfers (the muda side, the headless test setup), transfers. My only aim is resolving the security warnings.

@johncarmack1984 johncarmack1984 marked this pull request as ready for review July 3, 2026 23:15
@johncarmack1984 johncarmack1984 requested a review from a team as a code owner July 3, 2026 23:15
johncarmack1984 and others added 7 commits July 3, 2026 16:23
The gtk4 port as inherited: started in tauri-apps#1104, continued with the rebase
to 0.34.5, the optional libadwaita feature, the gtk::init ordering fix,
and the no-x11 compile fix.

Co-authored-by: Conrad Hale <halec5@mail.uc.edu>
Co-authored-by: rmakestrash-jpg <rmakbox@gmail.com>
Co-authored-by: Aurélien Jacobs <aurel@gnuage.org>
Comment thread .github/workflows/sync-upstream.yml Outdated
@github-actions

github-actions Bot commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

Package Changes Through 1879ad8

There are 1 changes which include tao with minor

Planned Package Versions

The following package releases are the planned based on the context of changes in this pull request.

package current next
tao 0.35.3 0.36.0

Add another change file through the GitHub UI by following this link.


Read about change files or the docs at github.com/jbolda/covector

dtolnay/rust-toolchain has no 1.92 tag, so the version ref fails to
resolve; @master with the toolchain input is the documented form for
untagged versions.
@FabianLars

Copy link
Copy Markdown
Member

if we use tao (in the beginning*) instead of winit then i wonder if it makes sense to put it behind a feature flag and have gtk3 and gtk4 side by side for a while. That would make migration in wry and tauri a bit easier i think and would potentially make a 2.x release possible.

Alternatively we could release tao gtk4 as 0.50 or something but having to deal with to release trains kinda sucks.

* in the beginning: i'm not sure about winit-gtk4's, and more importantly winit 0.31's timelines so perhaps it makes sense to start the gtk4 migration with tao and then later on migrate to winit. That would allow us to move a bit quicker. If we don't even want to consider a 2.x tauri (pre)release than this doesn't matter i guess.

@johncarmack1984

Copy link
Copy Markdown
Author

@FabianLars The flag is realistic. Everything gtk-facing lives in platform_impl/linux plus the unix extension traits, so the shape would be: today's backend moves to linux/gtk3 unchanged, this port lands as linux/gtk4, mutually exclusive features with gtk3 as the default, compile_error! on both or neither. CI grows a second linux leg. Current users see zero change until they opt in.

Two caveats. The unix extension traits expose gtk types, so those signatures switch with the feature. wry and tauri cross that seam either way, the flag just makes it opt-in. And gtk4 dropped the global-position APIs, so outer_position and set_always_on_bottom go unsupported there. Side by side means nobody inherits that until they choose it.

The RUSTSEC warnings only clear for builds that opt in, so I'd call the flag the migration path rather than the fix. For tauri the same flag would need to travel through wry and muda (tauri-apps/muda#369 can take the same shape), plus tray-icon for apps that use it.

Happy to restructure this PR that way if that's the direction. The port is done, so what's left is layout and plumbing.

@FabianLars

Copy link
Copy Markdown
Member

disregard my feature flag idea. i was overruled.

@johncarmack1984

Copy link
Copy Markdown
Author

No worries on my end; the backend is identical either way, so nothing here is wasted. Feel free to take this PR whole, in parts, or not at all, whatever fits the v3 shape. Happy to grab whatever other gtk4 migrations are needed to get tauri past gtk3, whether it's tauri v2.x or v3+

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

Upgrade tao to gtk4-rs

4 participants