bevyengine / bevyengine/bevy

UI Components Size/Layout can be changed when moving between monitors

Open
#10,700 0 comments 0 reactions 0 assignees View on GitHub
A-Windowing C-Bug O-Linux S-Needs-Investigation
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 16h
Merged PRs (30d)
171

Description

## Bevy version
0.12.0

## \[Optional\] Relevant system information
- Cargo Version: 1.71.1
- Graphics Platform: X11

If your bug is rendering-related, copy the adapter info that appears when you run Bevy.

```ignore
AdapterInfo { name: "NVIDIA GeForce GTX 1050 Ti", vendor: 4318, device: 7298, device_type: DiscreteGpu, driver: "NVIDIA", driver_info: "535.129.03", backend: Vulkan }
SystemInfo { os: "Linux 23.1.0 Manjaro Linux", kernel: "5.15.138-1-MANJARO", cpu: "Intel(R) Core(TM) i5-4690K CPU @ 3.50GHz", core_count: "4", memory: "31.3 GiB" }
```

You should also consider testing the examples of our upstream dependencies to help isolate any setup-specific issue:

- [`wgpu`](https://github.com/gfx-rs/wgpu) for rendering problems
- [`winit`](https://github.com/rust-windowing/winit) for input and window management
- [`gilrs`](https://docs.rs/gilrs/latest/gilrs/) for gamepad inputs

## What you did
I am unsure what triggered the bug, but I first noticed it when working on a small UI wrapper library. The library itself does not perform any size calculations or layouts. It simply generates the relevant `commands.spawn(...)`, and has **no active systems or even components**, so it is highly unlikely that the UI library itself is causing the issue.

A link to the commit where a working example of the bug can be found: [Here.](https://github.com/TheDudeFromCI/bevy_wh_elements/tree/1ecf321b92a20df89d8f021e28dd554992ea38b3)
To run the bug, please execute the `menu` example. The bug was first noticed with this code base in this exact commit.

## What went wrong
A simple UI menu was constructed with a specific layout on the screen. However, when moving the window from one monitor to another, the layout of the components changed. No code changes were performed, and the window was still the exact same running instance between both monitors. No custom systems were running (save for a passive event logger on button interact).

Both monitors are completely identical in resolution, refresh rate, and scale. Though, they are from different brands if that makes a difference.

## Additional information
Here are two screenshots, showing the exact same app instance on two different monitors.

![Screenshot_20231122_082416](https://github.com/bevyengine/bevy/assets/3118172/1007f63d-8718-4da2-8533-078c8b2c0de5)
![Screenshot_20231122_082430](https://github.com/bevyengine/bevy/assets/3118172/0930b3be-3a11-4f04-b729-a41f7e32c5bb)

I mentioned this potential bug in the Discord server and was recommended to publish a bug report here.

Contributor guide

Open the contributing guide

Research direction

Run the linked bevy_wh_elements commit and its `menu` example on the reported X11 setup, then compare the UI layout before and after moving the window between monitors. Review Bevy's UI and window-management paths, and check the upstream winit example to isolate the behavior. Done means the same running app preserves its component sizes and layout across identical monitors.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
desktop-dev, game-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.