Skip to content

Commit

Permalink
wayland: fix CSD decorations glitch when closing
Browse files Browse the repository at this point in the history
In rare cases destroying subsurfaces before the main surface could
result in a frame where the window is still shown, but decorations
got hidden, right before the window itself disappears.
  • Loading branch information
kchibisov committed Apr 19, 2024
1 parent 4f47a4e commit 9ab4c03
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/changelog/unreleased.md
Expand Up @@ -253,3 +253,4 @@ changelog entry.
- On Web, fix setting cursor icon overriding cursor visibility.
- On Windows, fix cursor not confined to center of window when grabbed and hidden.
- On macOS, fix sequence of mouse events being out of order when dragging on the trackpad.
- On Wayland, fix decoration glitch on close with some compositors
10 changes: 7 additions & 3 deletions src/platform_impl/linux/wayland/window/state.rs
Expand Up @@ -57,9 +57,6 @@ pub struct WindowState {
/// The connection to Wayland server.
pub connection: Connection,

/// The window frame, which is created from the configure request.
frame: Option<WinitFrame>,

/// The `Shm` to set cursor.
pub shm: WlShm,

Expand Down Expand Up @@ -155,6 +152,13 @@ pub struct WindowState {

/// The underlying SCTK window.
pub window: Window,

// NOTE: The spec says that destroying parent(`window` in our case), will unmap the
// subsurfaces. Thus to achieve atomic unmap of the client, drop the decorations
// frame after the `window` is dropped. To achieve that we rely on rust's struct
// field drop order guarantees.
/// The window frame, which is created from the configure request.
frame: Option<WinitFrame>,
}

impl WindowState {
Expand Down

0 comments on commit 9ab4c03

Please sign in to comment.