-
-
Notifications
You must be signed in to change notification settings - Fork 196
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
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 |
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.
@Zamoca42 thank you, this looks awesome, left a few comments
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 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
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.
Just one more thing to take care of and this should be good to go. Thanks for your patience.
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.
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. |
Fixes #977
Reproduce Errror Protocol 71
In the resizable example, when
resizable
is set tofalse
andwith_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
resizable
condition 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 ifresizable
is set tofalse
.