abstreet icon indicating copy to clipboard operation
abstreet copied to clipboard

Window height resized to 600px after loading

Open matthieu-foucault opened this issue 2 years ago • 2 comments

Platform: Linux (ArchLinux, Gnome 43.2, Wayland)

When starting the game with RUST_LOG=trace RUST_BACKTRACE=1 cargo run --bin game -- --dev, I observe the following behaviour:

  • the window starts with a 800x600px size, then goes full screen, and then down to 1920x600px
  • according to the window decoration, it's always maximized, so you have to click twice on the "maximize" icon to go to full screen after that.

Here are some relevant logs:

[2022-12-15T23:45:31Z WARN  widgetry::runner] Monitor scale factor is 1, screen window is 800, but the application requires 1500. Overriding the scale factor to 1.
[2022-12-15T23:45:31Z TRACE widgetry::runner] winit event says the window was resized from 800, 600 to ScreenDims { width: 1920.0, height: 1013.0 }. But inner size is ScreenDims { width: 1920.0, height: 1013.0 }, so using that
[2022-12-15T23:45:33Z TRACE widgetry::runner] winit event says the window was resized from 1920, 1013 to ScreenDims { width: 1920.0, height: 600.0 }. But inner size is ScreenDims { width: 1920.0, height: 600.0 }, so using that

I'm not sure why the initial window is 800x600px. From what I understand, the issue likely lies in glutin, but that crate was completely rewritten recently, so if there's a bug there it's not going to get fixed.

It looks like updating glutin isn't a straightforward task.

matthieu-foucault avatar Dec 16 '22 00:12 matthieu-foucault

We've fought bugs like this before, sadly. Per https://github.com/a-b-street/abstreet/blob/c05671367feb899dbb757f279633ca537d1234b0/widgetry/src/runner.rs#L67, we've previously observed that opening a window on Linux can fire a bunch of resize events early on, despite asking to start maximized.

Why would the issue be in glutin and not winit? I thought winit creates/manages the window and its size, and glutin is just for getting the OpenGL context.

It looks like updating glutin isn't a straightforward task.

I glanced at their changelog and new API, and indeed, it seems much harder to do what we're doing now. https://crates.io/crates/glutin-winit maybe helps? I'm not sure how worthwhile upgrading glutin is, and I don't see how it would help with this bug

dabreegster avatar Dec 16 '22 09:12 dabreegster

I did a bit more research and apparently the issue is with neither package "it's just how Wayland works" (similar issue in winit repo) The winit/glutin maintainer did open an issue that could be the cause of this though.

matthieu-foucault avatar Dec 16 '22 17:12 matthieu-foucault