fix(wayland): add client side decorations & fix error protocol 71 - #979
Conversation
Package Changes Through 9703609There are 1 changes which include tao with patch Planned Package VersionsThe following package releases are the planned based on the context of changes in this pull request.
Add another change file through the GitHub UI by following this link. Read about change files or the docs at github.com/jbolda/covector |
amrbashir
left a comment
There was a problem hiding this comment.
This is looking very good and just a few things and should be good to merge, could you add a change file (or multiple change files for each bug your are fixing in this PR) in .changes directory?
|
Btw I haven noticed you didn't sign your commits and I can't merge the PR unless they are signed. You need to setup commit signing, then you can sign past commit like this. |
The changes add a custom header bar with window control buttons (close, maximize/restore, minimize) to the Linux Wayland platform implementation. This provides a consistent user experience for window management across platforms. The header bar is implemented using GTK widgets and is added to the top of the application window. The drag area of the header bar is also used to enable window moving and resizing functionality.
## Explanation The changes made in this commit ensure that the window is only maximized if it is also resizable. This is to prevent issues where a non-resizable window is maximized, which could lead to unexpected behavior. The main changes are: 1. In the `set_maximized` function, the code checks if the window is resizable before maximizing it. If it's not resizable, the window is not maximized. 2. In the `is_maximizable` function, the code checks if the window is resizable and if the maximized state is true before returning `true`. These changes improve the overall behavior and consistency of the window maximization functionality.
This commit introduces a new `WindowMaximizeProcess` struct that handles the step-by-step process of maximizing a window. The changes include: - Implement the `WindowMaximizeProcess` struct with methods to handle the maximize process on linux. - Update the `EventLoop` and `Window` modules to use the new `WindowMaximizeProcess` struct when handling window maximize requests. - Add a new `KeyboardInput` event handler to the `resizable.rs` example to toggle the window's maximized state.
The changes in this commit focus on improving the handling of window button events on Linux platforms. The key changes are: 1. Moved the `LMB` constant declaration to the correct location to avoid duplicating it. 2. Removed the Wayland-specific button press event handling, as it was redundant and not necessary. 3. Simplified the window button event handling by removing the unnecessary logic related to Wayland-specific header bar handling. These changes help to simplify the event loop implementation and make the code more maintainable.
309f50f to
64fe001
Compare
amrbashir
left a comment
There was a problem hiding this comment.
Just one more thing to take care of and this should be good to go. Thanks for your patience.
amrbashir
left a comment
There was a problem hiding this comment.
LGTM, Thank you for this awesome PR
|
@amrbashir Thank you for your review. It was the kindest and most thoughtful review I’ve ever received. |
The default client side decoration handling of GTK is now used once again. Custom CSD don't make any sense when no custom widgets are added to the title bar. Futhermore, the custom CSD didn't work correctly and introduced multiple bugs regarding the titlebar and server-side rendering on Wayland. This is mostly a revert of tauri-apps#979. Fixes tauri-apps#1046, tauri-apps/tauri#13749, tauri-apps/tauri#14251, tauri-apps/tauri#14748 Supersedes tauri-apps#1055
The default client side decoration handling of GTK is now used once again. Custom CSD don't make any sense when no custom widgets are added to the title bar. Futhermore, the custom CSD didn't work correctly and introduced multiple bugs regarding the titlebar and server-side rendering on Wayland. This is mostly a revert of tauri-apps#979. Fixes tauri-apps#1046, tauri-apps/tauri#13749, tauri-apps/tauri#14251, tauri-apps/tauri#14748 Supersedes tauri-apps#1055
This ensures that the window is resizable before maximizing it to avoid unexpected behavior.
…cessary (#1218) * fix(wayland): remove broken custom CSD The default client side decoration handling of GTK is now used once again. Custom CSD don't make any sense when no custom widgets are added to the title bar. Futhermore, the custom CSD didn't work correctly and introduced multiple bugs regarding the titlebar and server-side rendering on Wayland. This is mostly a revert of #979. Fixes #1046, tauri-apps/tauri#13749, tauri-apps/tauri#14251, tauri-apps/tauri#14748 Supersedes #1055 * fix(wayland): propagate window events for CSD This reverts #941, which broke CSD event handling on Wayland. A new fix for #939 might now be needed. Fixes tauri-apps/tauri#13440 Might fix (unconfirmed) tauri-apps/tauri#11856 * fix(wayland): ensure compositors don't force decorations This enables CSD for undecorated windows to ensure that compositors with server-side decoration support (e.g. KDE Plasma) do not apply them when decorations are disabled for the window. Changing the decoration state for existing windows is however still not supported. This is a workaround for a GTK bug: https://gitlab.gnome.org/GNOME/gtk/-/work_items/5479 Fixes #899, tauri-apps/tauri#6562 * chore: add changelog entry for Wayland CSD fixes * fix(linux): reapply maximize fix from #979 This ensures that the window is resizable before maximizing it to avoid unexpected behavior. * Revert "fix(wayland): propagate window events for CSD" This reverts commit 25edb8e. * Reapply "fix(wayland): propagate window events for CSD" This reverts commit 6b11c08. * enable min/max buttons * prevent crash on wsl/weston when maximizing undecorated window * prevent duplicate mouse events * keep default decorations --------- Co-authored-by: Fabian-Lars <30730186+FabianLars@users.noreply.github.com>

Fixes #977
Reproduce Errror Protocol 71
In the resizable example, when
resizableis set tofalseandwith_maximized(true)is used, it works fine on macOS, but an “Error Protocol 71” occurs on Linux using Wayland.This behavior seems a bit unusual.
MacOS
Wayland on Linux
Changes
1. Confirmed that the resize state is true when maximizing.1. Added conditions for maximizing in the Linux environment.To prevent “Error Protocol 71,” I added a condition to check the resizable state when maximizing in the Linux environment.2. Wayland Header
While X11 has built-in headers for maximize and minimize buttons, Wayland does not have these buttons by default. Therefore, I added headers specifically for Wayland.
before
after
3. resizing in Wayland
Unlike X11, in Wayland, even when the
resizablecondition is set to true, resizing was not possible, and moving the window was also not allowed. However, by modifying the conditions in the event loop, window movement is now enabled.before
after
Issues still not resolvedIn Linux, when creating a window, it should maximize on the screen withwith_maximized(true), just like on macOS, even ifresizableis set tofalse.