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.
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()
withasync-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 thedefault-width
anddefault-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