Skip to content

fix(linux): Port to gtk4-rs #1104

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

Draft
wants to merge 1 commit into
base: dev
Choose a base branch
from
Draft

Conversation

conradhale
Copy link

@conradhale conradhale commented Mar 25, 2025

Closes #1051

You can find more info on most of the changes in the GTK docs

Summary of changes

Most of the X11-specific features have been removed from GTK4. This includes getting/setting window position, setting cursor position, getting global coordinates of pointer, setting window level (always-on-top), making window visible on all workspaces, and setting the skip taskbar hint.

Some of these methods can still be found in gdk-x11, however, X11 support is set to be completely removed from GTK5, and has been deprecated in GTK4.18. I personally do not think it is worth the effort to add the extra code to continue supporting these features though. Most developers using TAO really shouldn't depend on X11-only features since the number of people using X11 is becoming increasingly small. Differences in behavior on X11 and Wayland is also in many cases a recipe for bugs.

I've also added some features that were previously missing from the Wayland backend, like getting the cursor position (relative to the surface), and setting the urgency hint for the window (uses xdg-activation like winit).

gtk-rs-core also removed MainContext::channel, so I've followed the reccomendation of using context.spawn_local() with async-channel.

Also, due to the GtkWidget::configure_event being removed, I had to subclass GtkWindow to allow connecting to changes in the Window's size allocation, since the default-width and default-height property change notification are fired too late to be used for making layout changes.

Finally, I switched to using gdk-x11 and gdk-wayland instead of gdk-x11-sys and gdk-wayland-sys. It's now possible to get the window xid and wl_surface id without unsafe code, making the raw_window_handle functions implementations closer to winit's.

Todo

  • Support creating window with Libadwaita (Enabled via cargo feature probably).
  • Update .changes
  • Test on X11

Copy link
Contributor

Package Changes Through f250ce8

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.32.8 0.33.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

@conradhale conradhale force-pushed the dev branch 2 times, most recently from 2483636 to 987aeae Compare March 30, 2025 20:59
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.

Upgrade tao to gtk4-rs
1 participant