Skip to content

Fix min size hint with Wayland CSD frame#4561

Open
LeonMatthes wants to merge 1 commit intorust-windowing:masterfrom
LeonMatthes:4559-csd-min-size-hint
Open

Fix min size hint with Wayland CSD frame#4561
LeonMatthes wants to merge 1 commit intorust-windowing:masterfrom
LeonMatthes:4559-csd-min-size-hint

Conversation

@LeonMatthes
Copy link
Copy Markdown

@LeonMatthes LeonMatthes commented Apr 24, 2026

If a window is created with a minimum size hint and then needs client-side decorations on Wayland, the frame will actually reduce the real available size of the client application.
This fix takes this into account and causes the window to correctly increase its size based on the height that the frame needs.

Closes #4559

I'm not an expert on how the Wayland protocol works so if there is a better way to do this I am happy to implement it.

  • Tested on all platforms changed

Manually tested on niri by modifying the application example with a min/max size constraint of 500x500.
Without this patch the logs contain:

2026-04-24T09:38:26.349803Z  INFO application: Window=94422165750384 changed scale to 1.75
2026-04-24T09:38:26.349824Z  INFO application: Surface resized to PhysicalSize { width: 875, height: 814 }

With the patch it turns into:

2026-04-24T09:41:39.882414Z  INFO application: Window=93888069161584 changed scale to 1.75
2026-04-24T09:41:39.882434Z  INFO application: Surface resized to PhysicalSize { width: 875, height: 814 }
2026-04-24T09:41:39.913587Z  INFO application: User wake up
2026-04-24T09:41:39.914579Z  INFO application: Surface resized to PhysicalSize { width: 875, height: 875 }

(875 is 500 when taking the scale factor into account)

  • Added an entry to the changelog module if knowledge of this change could be valuable to users
  • Updated documentation to reflect any user-facing changes, including notes of platform-specific behavior
  • Created or updated an example program if it would help users understand this functionality

If a window is created with a minimum size hint and then needs
client-side decorations on Wayland, the frame will actually reduce the
real available size of the client application.
This fix takes this into account and causes the window to correctly
increase its size based on the height that the frame needs.

Closes rust-windowing#4559
@LeonMatthes
Copy link
Copy Markdown
Author

Hm, CI is failing on an unrelated clippy warning (the X11 code is not changed by this PR).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Wayland Client Side Decorations cause min_size hint to be applied incorrectly

1 participant