`with_always_on_top` causes window to display incorrectly when window size is equal to screen size
- Dominant language
- Rust
- Stars
- 30.6k
- Forks
- 2.1k
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 72
Description
When I create a window with a size equal to the screen and use always_on_top, the window displays incorrectly and transparency becomes invalid
I tried using screen recording software, but I couldn’t see this in the recorded video, so I used my mobile phone to shoot. Please bear with me.
First time, I didn't use `with_always_on_top`, the window was created normally (size 1920*1080, position 10, 10).
The second time, I used with_always_on_top, and I could see that a black window appeared covering the full screen (actually its upper left corner should be (10,10)). When I clicked outside the window, the window became Displayed normally. (This situation seems to be that when the window has focus, it will display abnormally, and when it is out of focus, it will display normally.)
I don’t know if this is a problem with the implementation of always_on_top on Windows.
https://github.com/emilk/egui/assets/59609929/1e1734e0-1784-482e-ae69-5206d267bac9

The versions of egui and eframe are both 0.27.2
my option and updateFn of app:
```rust
// option
let option = eframe::NativeOptions {
viewport: ViewportBuilder::default()
.with_position([10.0, 10.0])
.with_inner_size([1920.0, 1080.0])
.with_decorations(false)
.with_always_on_top()
.with_transparent(true),
..Default::default()
};
// app
impl eframe::App for MyApp {
fn update(&mut self, ctx: &Context, frame: &mut eframe::Frame) {
egui::CentralPanel::default()
.frame(Frame::none().fill(Color32::from_black_alpha(128)))
.show(ctx, |ui| {
if ctx.input(|i| i.key_pressed(Key::Escape)) {
ctx.send_viewport_cmd(ViewportCommand::Close);
}
if ui.button("close").clicked() {
ctx.send_viewport_cmd(ViewportCommand::Close);
}
});
}
}
```
Contributor guide
Research direction
Reproduce the issue on Windows using eframe NativeOptions with ViewportBuilder, with_inner_size, with_position, with_always_on_top, and with_transparent enabled. Start by tracing the native viewport/window handling for this configuration; done means a screen-sized window keeps its requested position and transparency while focused and unfocused.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- desktop
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100