Skip to content

On wayland ViewportCommand::InnerSize doesn't update the content size #4196

@ColinKinloch

Description

@ColinKinloch

Describe the bug

On wayland (mutter) when the window is resized using ViewportCommand::InnerSize the viewport size doesn't match the window.

Drag Resize Handle Press "Phone Size" Drag Resize Handle Press "Desktop Size"
Screenshot from 2024-03-20 11-30-33 Screenshot from 2024-03-20 11-28-20 Screenshot from 2024-03-20 11-30-54 Screenshot from 2024-03-20 11-28-35

I suspect this is because winit doesn't send Resized events after the resize, the correct way to handle this is applying the value returned from request_inner_size to the viewport here:

ViewportCommand::InnerSize(size) => {
let width_px = pixels_per_point * size.x.max(1.0);
let height_px = pixels_per_point * size.y.max(1.0);
if window
.request_inner_size(PhysicalSize::new(width_px, height_px))
.is_some()
{
log::debug!("ViewportCommand::InnerSize ignored by winit");
}
}

To Reproduce
Steps to reproduce the behavior:

  1. On gnome shell press the Phone Size button, note the window contents are stretched
  2. Resize the window, note the window contents are not stretched
  3. Repeat

Expected behavior
Contents are not stretched

Screenshots

Desktop (please complete the following information):

  • OS: Fedora 39

#4197 makes it easier to test.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething is broken

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions