bevyengine / bevyengine/bevy

`WindowLevel::AlwaysOnTop` is not working

Open
#22,840 1 comment 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 and features
0.18.0

## \[Optional\] Relevant system information
Ubuntu 24.04, X11

## What you did

```rust
use bevy::{prelude::*, window::WindowLevel};

fn main() {
App::new()
.add_plugins(DefaultPlugins.set(WindowPlugin {
primary_window: Some(Window {
window_level: WindowLevel::AlwaysOnTop,
..default()
}),
..default()
}))
.run();
}
```

## What went wrong

I set the primary window's `window_level` to `WindowLevel::AlwaysOnTop` when constructing `App` in `fn main()`, but it has no effect.

## Additional information

To check how `WindowLevel` is treated when a window is created, I added a `panic!()` statement inside the `if` block that sets `WindowLevel` in `fn changed_windows()` (file `bevy_winit-0.18.0/src/system.rs`) .

No panic occurred. In other words, `window.window_level` already equals `cache.window_level` at the first window creation, so the code never reaches the `if` block and `WindowLevel` does not get set.

```sh
# Copy bevy_winit-0.18.0 to the project directory.
cp -rt . ~/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bevy_winit-0.18.0
```

```toml
# Cargo.toml
[patch.crates-io]
bevy_winit = { path = "bevy_winit-0.18.0" }
```

```rust
// bevy_winit-0.18.0/src/system.rs (line number 485)
if window.window_level != cache.window_level {
panic!();
winit_window.set_window_level(convert_window_level(window.window_level));
}
```

Contributor guide

Open the contributing guide

Research direction

Start in bevy_winit-0.18.0/src/system.rs, especially changed_windows() and the window/cache initialization path. Reproduce the provided WindowLevel::AlwaysOnTop example on Ubuntu 24.04 with X11 and trace why the initial values match. Done means a newly created primary window is actually kept always on top.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
desktop
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.